From cae85c00f94bb9cae0f323b96b6bd044d18ac978 Mon Sep 17 00:00:00 2001 From: Christophe Moine Date: Wed, 8 Jan 2014 15:26:14 +0100 Subject: [PATCH] Add more no_release attributes to allow using custom roles --- lib/symfony1/deploy.rb | 10 +++++----- lib/symfony1/propel.rb | 14 +++++++------- lib/symfony1/symfony.rb | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/symfony1/deploy.rb b/lib/symfony1/deploy.rb index 7530bde..da47414 100644 --- a/lib/symfony1/deploy.rb +++ b/lib/symfony1/deploy.rb @@ -1,11 +1,11 @@ namespace :deploy do desc "Runs the symfony migrations" - task :migrate do + task :migrate, :roles => :app, :except => { :no_release => true } do symfony.orm.migrate end desc "Symlink static directories and static files that need to remain between deployments." - task :share_childs do + task :share_childs, :roles => :app, :except => { :no_release => true } do if shared_children shared_children.each do |link| run "#{try_sudo} mkdir -p #{shared_path}/#{link}" @@ -24,7 +24,7 @@ end desc "Customize the finalize_update task to work with symfony." - task :finalize_update, :except => { :no_release => true } do + task :finalize_update, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} chmod -R g+w #{latest_release}" if fetch(:group_writable, true) run "#{try_sudo} mkdir -p #{latest_release}/cache" run "#{try_sudo} chmod -R g+w #{latest_release}/cache" @@ -40,14 +40,14 @@ end desc "Need to overwrite the deploy:cold task so it doesn't try to run the migrations." - task :cold do + task :cold, :roles => :app, :except => { :no_release => true } do update symfony.orm.build_db_and_load start end desc "Deploy the application and run the test suite." - task :testall do + task :testall, :roles => :app, :except => { :no_release => true } do update_code create_symlink symfony.orm.build_db_and_load diff --git a/lib/symfony1/propel.rb b/lib/symfony1/propel.rb index 95d4364..dfaf0d6 100644 --- a/lib/symfony1/propel.rb +++ b/lib/symfony1/propel.rb @@ -1,7 +1,7 @@ namespace :symfony do namespace :propel do desc "Ensure Propel is correctly configured" - task :setup do + task :setup, :roles => :app, :except => { :no_release => true } do conf_files_exists = capture("if test -s #{shared_path}/config/propel.ini -a -s #{shared_path}/config/databases.yml ; then echo 'exists' ; fi").strip # share childs again (for propel.ini file) @@ -15,40 +15,40 @@ end desc "Migrates database to current version" - task :migrate do + task :migrate, :roles => :app, :except => { :no_release => true } do puts "propel doesn't have built-in migration for now" end desc "Generate model lib form and filters classes based on your schema" - task :build_classes do + task :build_classes, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} #{php_bin} #{latest_release}/symfony propel:build --model --env=#{symfony_env_prod}" run "#{try_sudo} #{php_bin} #{latest_release}/symfony propel:build --forms --env=#{symfony_env_prod}" run "#{try_sudo} #{php_bin} #{latest_release}/symfony propel:build --filters --env=#{symfony_env_prod}" end desc "Generate code & database based on your schema" - task :build_all do + task :build_all, :roles => :app, :except => { :no_release => true } do if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database? (y/N)") run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --no-confirmation --env=#{symfony_env_prod}'" end end desc "Generate code & database based on your schema & load fixtures" - task :build_all_and_load do + task :build_all_and_load, :roles => :app, :except => { :no_release => true } do if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database and load #{symfony_env_prod}'s fixtures? (y/N)") run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --and-load --no-confirmation --env=#{symfony_env_prod}'" end end desc "Generate sql & database based on your schema" - task :build_db do + task :build_db, :roles => :app, :except => { :no_release => true } do if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database? (y/N)") run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --no-confirmation --env=#{symfony_env_prod}'" end end desc "Generate sql & database based on your schema & load fixtures" - task :build_db_and_load do + task :build_db_and_load, :roles => :app, :except => { :no_release => true } do if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database and load #{symfony_env_prod}'s fixtures? (y/N)") run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --and-load --no-confirmation --env=#{symfony_env_prod}'" end diff --git a/lib/symfony1/symfony.rb b/lib/symfony1/symfony.rb index e399d86..7627568 100644 --- a/lib/symfony1/symfony.rb +++ b/lib/symfony1/symfony.rb @@ -16,13 +16,13 @@ end desc "Clears the cache" - task :cc do + task :cc, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony cache:clear'" run "#{try_sudo} chmod -R g+w #{latest_release}/cache" end desc "Creates symbolic link to symfony lib in shared" - task :create_lib_symlink do + task :create_lib_symlink, :roles => :app, :except => { :no_release => true } do prompt_with_default(:version, symfony_version) symlink_path = "#{latest_release}/lib/vendor/symfony" @@ -32,7 +32,7 @@ namespace :configure do desc "Configure database DSN" - task :database do + task :database, :roles => :app, :except => { :no_release => true } do prompt_with_default(:dsn, "mysql:host=localhost;dbname=#{application}") prompt_with_default(:db_username, "root") db_password = Capistrano::CLI.password_prompt("db_password : ") @@ -53,17 +53,17 @@ namespace :project do desc "Disables an application in a given environment" - task :disable do + task :disable, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:disable #{symfony_env_prod}'" end desc "Enables an application in a given environment" - task :enable do + task :enable, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:enable #{symfony_env_prod}'" end desc "Fixes symfony directory permissions" - task :permissions do + task :permissions, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:permissions'" end @@ -75,7 +75,7 @@ end desc "Clears all non production environment controllers" - task :clear_controllers do + task :clear_controllers, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:clear-controllers'" end