What does :except => {:no_release => true} mean in Capistrano DSL

denysonique picture denysonique · Oct 31, 2011 · Viewed 8.2k times · Source

For example in:

 task :restart, :roles => :app, :except => { :no_release => true } do
 end

Answer

davekaro picture davekaro · Nov 2, 2011

Looking at the handbook, it appears that you can pass the :no_release attribute to the role definition (commonly done for the web role). This indicates that the code should not be checked out on servers in that role.

So, I'm guessing that when a task specifies :except => { :no_release => true } - it's saying "Skip this task on the servers (roles) that have :no_release defined as true."

role :app, "your app-server here"
role :web, "your web-server here", :no_release => true
role :db,  "your db-server here", :primary => true

...

desc "restart passenger"
task :restart, :except => { :no_release => true } do
  run "touch #{current_path}/tmp/restart.txt"
end

In the above example, the restart operation should not run on the web server. Again, this is not tested... just going by my observations.