diff --git a/plugins/people_block/before_disable.rb b/plugins/people_block/before_disable.rb index 9a9c89f..77914a7 100644 --- a/plugins/people_block/before_disable.rb +++ b/plugins/people_block/before_disable.rb @@ -1,4 +1,2 @@ -raise "\n\n" + - "WARNING: PeopleBlockPlugin shouldn't be disabled,\n" + - " Noosfero doesn't works without that!" + - "\n\n" +raise "\nPeopleBlockPlugin shouldn't be enabled/disabled by hand, Noosfero" + + "\ninstallation already comes with it enabled by default!\n" diff --git a/plugins/people_block/test/unit/people_block_test.rb b/plugins/people_block/test/unit/people_block_test.rb index 93e4989..201a521 100644 --- a/plugins/people_block/test/unit/people_block_test.rb +++ b/plugins/people_block/test/unit/people_block_test.rb @@ -60,7 +60,7 @@ class PeopleBlockTest < ActiveSupport::TestCase should 'prioritize profiles with image by default' do - assert PeopleBlock.new.prioritize_people_with_image + assert PeopleBlock.new.prioritize_profiles_with_image end @@ -97,7 +97,7 @@ class PeopleBlockTest < ActiveSupport::TestCase expects(:profile_image_link).with(person2, :minor).returns(person2.name) expects(:block_title).with(anything).returns('') - content = instance_eval(&block.content) + content = instance_exec(&block.content) assert_match(/#{person1.name}/, content) assert_match(/#{person2.name}/, content) @@ -109,10 +109,11 @@ class PeopleBlockTest < ActiveSupport::TestCase block = PeopleBlock.new - expects(:_).with('View all').returns('View all') - expects(:link_to).with('View all', :controller => 'search', :action => 'people').returns('link-to-people') + stubs(:_).with('View all').returns('View all') + stubs(:link_to).returns('link-to-people') + stubs(:url_for).returns(' ') - assert_equal 'link-to-people', instance_eval(&block.footer) + assert_equal 'link-to-people', instance_exec(&block.footer) end diff --git a/script/noosfero-plugins b/script/noosfero-plugins index 053292f..f1662b8 100755 --- a/script/noosfero-plugins +++ b/script/noosfero-plugins @@ -76,7 +76,8 @@ run(){ _enable(){ plugin="$1" - source="$available_plugins_dir/$plugin" + cd $enabled_plugins_dir + source="../../plugins/$plugin" target="$enabled_plugins_dir/$plugin" run "$source/before_enable.rb" if [ -h "$target" ]; then @@ -98,11 +99,13 @@ _enable(){ fi fi if [ "$installation_ok" = true ] && [ "$dependencies_ok" = true ]; then - ln -s "$source" "$target" + ln -s "$source" "$plugin" plugins_public_dir="$NOOSFERO_DIR/public/plugins" plugins_features_dir="$NOOSFERO_DIR/features/plugins" - test -d "$target/public/" && ln -s "$target/public" "$plugins_public_dir/$plugin" - test -d "$NOOSFERO_DIR/features" && test -d "$target/features" && ln -s "$target/features" "$plugins_features_dir/$plugin" + cd $plugins_public_dir + test -d "$source/public" && ln -s "$source/public" "$plugin" + cd $plugins_features_dir + test -d "$NOOSFERO_DIR/features" && test -d "$source/features" && ln -s "$source/features" "$plugin" _say "$plugin enabled" run "$source/after_enable.rb" needs_migrate=true @@ -122,15 +125,19 @@ _disable(){ target="$enabled_plugins_dir/$plugin" plugins_public_dir="$NOOSFERO_DIR/public/plugins" plugins_features_dir="$NOOSFERO_DIR/features/plugins" - run "$source/before_disable.rb" - if [ -h "$target" ]; then - rm "$target" - test -h "$plugins_public_dir/$plugin" && rm "$plugins_public_dir/$plugin" - test -h "$plugins_features_dir/$plugin" && rm "$plugins_features_dir/$plugin" - _say "$plugin disabled" - run "$source/after_disable.rb" + if ! run "$source/before_disable.rb"; then + echo "W: failed to disabling $plugin" + echo else - _say "$plugin already disabled" + if [ -h "$target" ]; then + rm "$target" + test -h "$plugins_public_dir/$plugin" && rm "$plugins_public_dir/$plugin" + test -h "$plugins_features_dir/$plugin" && rm "$plugins_features_dir/$plugin" + _say "$plugin disabled" + run "$source/after_disable.rb" + else + _say "$plugin already disabled" + fi fi } -- libgit2 0.21.2