controlling order of execution of tasks in one namespace

38 views
Skip to first unread message

sq1020

unread,
Apr 24, 2012, 7:38:43 PM4/24/12
to Capistrano
Hi everyone,

I'm new to Capistrano and I was wondering how you can control the
order of execution of tasks in a certain name space.

For example, I have some extra tasks in my deploy namespace. I wanted
deploy:bundle and deploy:assets to run before deploy:restart so I
added these lines


after 'deploy:update_code', 'deploy:bundle'
after 'deploy:bundle', 'deploy:assets'
after 'deploy:assets', 'deploy:restart'

I'm not sure if this how you're supposed to do it. Please let me know
if you guys have any tips for me!

namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true }
do
run "touch #{current_path}/tmp/restart.txt"
end

task :bundle do
run "cd #{current_path} && bundle install"
end

task :assets do
run "cd #{current_path} && bundle exec rake assets:precompile"
end

end

after 'deploy:update_code', 'deploy:bundle'
after 'deploy:bundle', 'deploy:assets'
after 'deploy:assets', 'deploy:restart'

Donovan Bray

unread,
Apr 27, 2012, 10:31:35 AM4/27/12
to capis...@googlegroups.com
after 'deploy:update_code', 'deploy:bundle'
after 'deploy:bundle', 'deploy:assets'

You could rewrite the above as:

after 'deploy:update_code', 'deploy:bundle', 'deploy:assets'


You don't need the following hook as deploy:restart will be called by capistrano already in the normal deploy chain:

after 'deploy:assets', 'deploy:restart'

Reply all
Reply to author
Forward
0 new messages