From be80a6c6169a309767d140f0af000d770d09e5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Raye=CC=81?= Date: Thu, 20 Feb 2014 10:28:36 +0100 Subject: [PATCH] Allow to skip or not interactive_mode for the task capifony:doctrine:load:fixtures --- lib/symfony2/doctrine.rb | 5 ++++- spec/capifony_symfony2_doctrine_spec.rb | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/symfony2/doctrine.rb b/lib/symfony2/doctrine.rb index 8ad2e5e..fe7479a 100755 --- a/lib/symfony2/doctrine.rb +++ b/lib/symfony2/doctrine.rb @@ -94,7 +94,10 @@ desc "Load data fixtures" task :load_fixtures, :roles => :app, :except => { :no_release => true } do - run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:fixtures:load #{console_options}#{doctrine_em_flag}'", :once => true + if !interactive_mode || Capistrano::CLI.ui.agree("Careful, database will be purged. Do you want to continue? (Y/N)") + run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:fixtures:load --no-interaction #{console_options}#{doctrine_em_flag}'", :once => true + end + capifony_puts_ok end namespace :migrations do diff --git a/spec/capifony_symfony2_doctrine_spec.rb b/spec/capifony_symfony2_doctrine_spec.rb index a51503a..a03be71 100755 --- a/spec/capifony_symfony2_doctrine_spec.rb +++ b/spec/capifony_symfony2_doctrine_spec.rb @@ -108,7 +108,7 @@ @configuration.find_and_execute_task('symfony:doctrine:load_fixtures') end - it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:fixtures:load --env=prod --no-debug\'') } + it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:fixtures:load --no-interaction --env=prod --no-debug\'') } end it "defines symfony:doctrine:migrations tasks" do @@ -204,7 +204,7 @@ it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:schema:create --env=prod --no-debug --em=custom_em\'') } it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:schema:drop --force --env=prod --no-debug --em=custom_em\'') } it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:schema:update --force --env=prod --no-debug --em=custom_em\'') } - it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:fixtures:load --env=prod --no-debug --em=custom_em\'') } + it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:fixtures:load --no-interaction --env=prod --no-debug --em=custom_em\'') } it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:migrations:status --env=prod --no-debug --em=custom_em\'') } end