Skip to content

Commit

Permalink
Add more no_release attributes to allow using custom roles
Browse files Browse the repository at this point in the history
  • Loading branch information
xophm1 committed Jan 27, 2014
1 parent 2a5ba88 commit cae85c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions lib/symfony1/deploy.rb
Original file line number Diff line number Diff line change
@@ -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}"
Expand All @@ -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"
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions lib/symfony1/propel.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions lib/symfony1/symfony.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 : ")
Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit cae85c0

Please sign in to comment.