Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#273. Create only one run call in the task and Tests

  • Loading branch information...
commit b76932de5512f7b1e618ddf52fe63e1bcdbd23b7 1 parent 8b1197a
@mgallego mgallego authored
View
6 lib/symfony2/symfony.rb
@@ -193,10 +193,12 @@
desc "Clears all non production environment controllers"
task :clear_controllers do
capifony_pretty_print "--> Clear controllers"
-
+
+ command = "#{try_sudo} sh -c 'cd #{latest_release} && rm -f"
controllers_to_clear.each do |link|
- run "#{try_sudo} sh -c 'cd #{latest_release} && rm -f #{web_path}/"+ link +"'"
+ command += " #{web_path}/" + link
end
+ run command + "'"
capifony_puts_ok
end
View
2  spec/capifony_symfony2_spec.rb
@@ -27,5 +27,7 @@
@configuration.fetch(:shared_children).should == ['app/logs', 'web/uploads']
@configuration.fetch(:asset_children).should == ['web/css', 'web/images', 'web/js']
@configuration.fetch(:writable_dirs).should == ['app/logs', 'app/cache']
+ @configuration.fetch(:controllers_to_clear).should == ['app_*.php']
end
+
end
View
18 spec/capifony_symfony2_symfony_spec.rb
@@ -288,6 +288,24 @@
end
it "defines symfony:project tasks" do
+ @configuration.fetch(:controllers_to_clear).should == ['app_*.php']
@configuration.find_task('symfony:project:clear_controllers').should_not == nil
end
+
+ context "when running symfony:project:clear_controllers" do
+ before do
+ @configuration.find_and_execute_task('symfony:project:clear_controllers')
+ end
+ it { should have_run(' sh -c \'cd /var/www/releases/20120927 && rm -f web/app_*.php\'') }
+ end
+
+ context "when running symfony:project:clear_controllers with a given controllers_to_clear" do
+ before do
+ @configuration.set :controllers_to_clear, ['config.php', 'app_dev.php', 'app_test.php']
+ @configuration.find_and_execute_task('symfony:project:clear_controllers')
+ end
+ it { should have_run(' sh -c \'cd /var/www/releases/20120927 && rm -f web/config.php web/app_dev.php web/app_test.php\'') }
+ end
+
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.