[Git][noosfero/noosfero][master] 2 commits: Plugins: adds command to manage plugin scripts
Rodrigo Souto
gitlab at mg.gitlab.com
Tue Sep 26 08:40:53 BRT 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
ef8ba485 by Gabriel Silva at 2017-09-17T01:45:16+00:00
Plugins: adds command to manage plugin scripts
- Run commands on scripts inside plguins/*/script/init
- These scripts will start and stop along with the application server
Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>
- - - - -
9eb72466 by Rodrigo Souto at 2017-09-26T11:40:37+00:00
Merge branch 'plugin_scripts' into 'master'
Plugins: adds command to manage plugin scripts
See merge request noosfero/noosfero!1310
- - - - -
3 changed files:
- script/development
- script/noosfero-plugins
- script/production
Changes:
=====================================
script/development
=====================================
--- a/script/development
+++ b/script/development
@@ -7,6 +7,7 @@ export RAILS_ENV=development
stop() {
echo "Stopping ..."
./script/delayed_job stop
+ ./script/noosfero-plugins services stop
./script/feed-updater stop
whenever --clear-crontab
if [ -f tmp/pids/unicorn.pid ]; then
@@ -19,6 +20,7 @@ stop() {
start() {
rake db:abort_if_pending_migrations
./script/feed-updater start
+ ./script/noosfero-plugins services start
./script/delayed_job start
trap stop INT TERM EXIT
whenever --write-crontab --set 'environment=development'
=====================================
script/noosfero-plugins
=====================================
--- a/script/noosfero-plugins
+++ b/script/noosfero-plugins
@@ -21,6 +21,7 @@ available_plugins=$(find -L "$available_plugins_dir" -maxdepth 1 -mindepth 1 -ty
enabled_plugins=$(find -L "$enabled_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
base_plugins=$(find -L "$base_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
debian_install="$NOOSFERO_DIR/script/debian-install"
+init_scripts=$(find -L "$enabled_plugins_dir" -type f -wholename '*/script/init/*' )
# operation defaults
quiet=false
@@ -56,6 +57,7 @@ _usage() {
echo " $program_name [OPTIONS] enableall"
echo " $program_name [OPTIONS] disableall"
echo " $program_name [OPTIONS] new PLUGIN [PLUGIN ...]"
+ echo " $program_name [OPTIONS] services [status|start|stop|run]"
echo
echo "Options:"
echo " --quiet|-q"
@@ -218,6 +220,22 @@ _disableall() {
done
}
+_services() {
+ command=$1
+ case "$command" in
+ status|start|stop|run)
+ for script in $init_scripts; do
+ $script $command
+ done
+ ;;
+ *)
+ echo "Unknown command: $command"
+ _usage
+ exit 1
+ ;;
+ esac
+}
+
if [ $# -eq 0 ]; then
_usage
exit 0
@@ -251,7 +269,7 @@ shift
case "$command" in
- enableall|disableall|enable|disable|new)
+ enableall|disableall|enable|disable|new|services)
if [ ! -w "$enabled_plugins_dir" ]; then
echo "E: sorry, you don't have the required permissions to manage plugins"
exit 2
@@ -272,6 +290,9 @@ case "$command" in
_$command "$plugin"
done
;;
+ services)
+ _services $@
+ ;;
*)
echo "Unknown command: $command"
_usage
=====================================
script/production
=====================================
--- a/script/production
+++ b/script/production
@@ -96,10 +96,12 @@ environments_loop() {
RAILS_ENV=$env bundle exec ./script/feed-updater "$action" -i $env
./script/whenever $action $env
done
+ RAILS_ENV=$env ./script/noosfero-plugins services "$action"
else
bundle exec ./script/delayed_job "$action"
bundle exec ./script/feed-updater "$action"
./script/whenever $action
+ ./script/noosfero-plugins services "$action"
fi
}
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/e2704cc16a06cf38969d2e490cfc677272991367...9eb72466c9f015f58d3266cc3c417b5f1240b4b2
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/e2704cc16a06cf38969d2e490cfc677272991367...9eb72466c9f015f58d3266cc3c417b5f1240b4b2
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170926/01f94de3/attachment-0001.html>
More information about the Noosfero-dev
mailing list