Permalink
Browse files

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

  • Loading branch information...
1 parent 8b1197a commit b76932de5512f7b1e618ddf52fe63e1bcdbd23b7 @mgallego committed Nov 27, 2012
Showing with 24 additions and 2 deletions.
  1. +4 −2 lib/symfony2/symfony.rb
  2. +2 −0 spec/capifony_symfony2_spec.rb
  3. +18 −0 spec/capifony_symfony2_symfony_spec.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
@@ -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
@@ -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

0 comments on commit b76932d

Please sign in to comment.