Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override :except => {:no_release => true} #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ You can modify any of the following options in your `deploy.rb` config.
- `unicorn_roles` - Define which roles to perform unicorn recpies on. Default to `:app`.
- `unicorn_config_path` - Set the directory where unicorn config files reside. Default to `current_path/config`.
- `unicorn_config_filename` - Set the filename of the unicorn config file. Not used in multistage installations. Default to `unicorn.rb`.
- `unicorn_task_options` - Set unicorn task options. Default to `:except => {:no_release => true}`.

### Multistage

Expand Down
20 changes: 12 additions & 8 deletions lib/capistrano-unicorn/capistrano_integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,27 +143,31 @@ def unicorn_roles
fetch(:unicorn_roles, :app)
end

def unicorn_task_options
fetch(:unicorn_task_options, :except => {:no_release => true})
end

#
# Unicorn cap tasks
#
namespace :unicorn do
desc 'Start Unicorn master process'
task :start, :roles => unicorn_roles, :except => {:no_release => true} do
task :start, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run start_unicorn
end

desc 'Stop Unicorn'
task :stop, :roles => unicorn_roles, :except => {:no_release => true} do
task :stop, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run kill_unicorn('QUIT')
end

desc 'Immediately shutdown Unicorn'
task :shutdown, :roles => unicorn_roles, :except => {:no_release => true} do
task :shutdown, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run kill_unicorn('TERM')
end

desc 'Restart Unicorn'
task :restart, :roles => unicorn_roles, :except => {:no_release => true} do
task :restart, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run <<-END
#{duplicate_unicorn}

Expand All @@ -176,12 +180,12 @@ def unicorn_roles
end

desc 'Duplicate Unicorn'
task :duplicate, :roles => unicorn_roles, :except => {:no_release => true} do
task :duplicate, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run duplicate_unicorn()
end

desc 'Reload Unicorn'
task :reload, :roles => unicorn_roles, :except => {:no_release => true} do
task :reload, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run <<-END
if #{unicorn_is_running?}; then
echo "Reloading Unicorn...";
Expand All @@ -193,7 +197,7 @@ def unicorn_roles
end

desc 'Add a new worker'
task :add_worker, :roles => unicorn_roles, :except => {:no_release => true} do
task :add_worker, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run <<-END
if #{unicorn_is_running?}; then
echo "Adding a new Unicorn worker...";
Expand All @@ -205,7 +209,7 @@ def unicorn_roles
end

desc 'Remove amount of workers'
task :remove_worker, :roles => unicorn_roles, :except => {:no_release => true} do
task :remove_worker, {:roles => unicorn_roles}.merge(unicorn_task_options) do
run <<-END
if #{unicorn_is_running?}; then
echo "Removing a Unicorn worker...";
Expand Down