[Git][noosfero/noosfero][master] 2 commits: noosfero-plugins: add install command

Bráulio Bhavamitra gitlab at gitlab.com
Thu Oct 1 17:32:28 BRT 2015


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
65ca70e0 by Braulio Bhavamitra at 2015-10-01T17:24:50Z
noosfero-plugins: add install command

Enable users to explicitly install plugins' gems.

Also, return error when install/dependencies fail.

- - - - -
9ac9e0ab by Braulio Bhavamitra at 2015-10-01T17:30:25Z
travis-ci: put back irc notifications

It was temporarily disabled for tests

- - - - -


7 changed files:

- .travis.yml
- plugins/fb_app/install.rb
- plugins/open_graph/install.rb
- plugins/orders/install.rb
- plugins/orders_cycle/install.rb
- plugins/shopping_cart/install.rb
- script/noosfero-plugins


Changes:

=====================================
.travis.yml
=====================================
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,10 @@
 notifications:
-  #  irc:
-  #    channels:
-  #      - "chat.freenode.net#noosfero"
-  #      - "chat.freenode.net#noosfero-br"
-  #    template:
-  #      - "%{repository_slug} %{branch} %{commit} %{commit_subject} - %{result} %{build_url}"
+  irc:
+    channels:
+      - "chat.freenode.net#noosfero"
+      - "chat.freenode.net#noosfero-br"
+    template:
+      - "%{repository_slug} %{branch} %{commit} %{commit_subject} - %{result} %{build_url}"
 
 language: ruby
 rvm:
@@ -37,9 +37,6 @@ cache: bundler
 
 before_script:
   - mkdir -p tmp/{pids,cache} log
-# workaround for plugins with Gemfile
-  - perl -pi -e 's/--local --quiet/install --jobs=3 --retry=3 > \/dev\/null/' script/noosfero-plugins
-  - perl -pi -e 's/rm -f \$gemfile/mv "\$gemfile".lock Gemfile.lock; rm -f \$gemfile/' script/noosfero-plugins
   - script/noosfero-plugins disableall
   - bundle exec rake makemo &>/dev/null
 # database
@@ -54,7 +51,7 @@ env:
   - TASK=test:integration
   - TASK=cucumber
   - TASK=selenium
-  - TASK=test:noosfero_plugins
+  - TASK=test:noosfero_plugins BUNDLE_OPTS=install
 
 script:
   - bundle exec rake $TASK


=====================================
plugins/fb_app/install.rb
=====================================
--- a/plugins/fb_app/install.rb
+++ b/plugins/fb_app/install.rb
@@ -1,2 +1,3 @@
 system "script/noosfero-plugins -q enable oauth_client open_graph"
+exit $?.exitstatus
 


=====================================
plugins/open_graph/install.rb
=====================================
--- a/plugins/open_graph/install.rb
+++ b/plugins/open_graph/install.rb
@@ -1,2 +1,3 @@
 system "script/noosfero-plugins -q enable metadata"
+exit $?.exitstatus
 


=====================================
plugins/orders/install.rb
=====================================
--- a/plugins/orders/install.rb
+++ b/plugins/orders/install.rb
@@ -1,2 +1,3 @@
 system "script/noosfero-plugins -q enable delivery"
+exit $?.exitstatus
 


=====================================
plugins/orders_cycle/install.rb
=====================================
--- a/plugins/orders_cycle/install.rb
+++ b/plugins/orders_cycle/install.rb
@@ -1,2 +1,3 @@
 system "script/noosfero-plugins -q enable orders suppliers"
+exit $?.exitstatus
 


=====================================
plugins/shopping_cart/install.rb
=====================================
--- a/plugins/shopping_cart/install.rb
+++ b/plugins/shopping_cart/install.rb
@@ -1,2 +1,3 @@
 system "script/noosfero-plugins -q enable orders delivery"
+exit $?.exitstatus
 


=====================================
script/noosfero-plugins
=====================================
--- a/script/noosfero-plugins
+++ b/script/noosfero-plugins
@@ -77,6 +77,12 @@ run(){
   fi
 }
 
+_install(){
+  # export so that recursive enables for dependencies inherit this option too
+  export BUNDLE_OPTS='install'
+  _enable "$1"
+}
+
 _enable(){
   plugin="$1"
 
@@ -113,10 +119,13 @@ _enable(){
       if [ -e $source/Gemfile ]; then
         gemfile=$(mktemp --tmpdir=.)
         cat $NOOSFERO_DIR/Gemfile $source/Gemfile > $gemfile
-        if ! RUBYOPT='' BUNDLE_GEMFILE="$gemfile" bundle --local --quiet; then
+        if [ -z "$BUNDLE_OPTS" ]; then BUNDLE_OPTS="--local"; fi
+        if ! RUBYOPT='' BUNDLE_GEMFILE="$gemfile" bundle $BUNDLE_OPTS --quiet; then
           dependencies_ok=false
+        else
+          mv "$gemfile".lock Gemfile.lock
         fi
-        rm -f $gemfile $gemfile.lock
+        rm -f $gemfile
       fi
       if ! run $dependencies_file; then
         dependencies_ok=false
@@ -134,9 +143,11 @@ _enable(){
     elif [ "$installation_ok" = false ]; then
       echo "W: failed to install $plugin; not enabling"
       echo
+      exit 1
     elif [ "$dependencies_ok" = false ]; then
       echo "W: failed to load dependencies for $plugin; not enabling"
       echo
+      exit 2
     fi
   fi
 }
@@ -245,7 +256,7 @@ case "$command" in
     fi
     _$command
     ;;
-  enable|disable|new)
+  enable|install|disable|new)
     for plugin in $@; do
       _$command "$plugin"
     done



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/f280b3cabd855ed3daf87e5b2c39fe44b5fa9511...9ac9e0abdcbf464a103d7c7e7a90bc87c24b49da
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151001/d8f512cb/attachment.html>


More information about the Noosfero-dev mailing list