Skip to content

Commit

Permalink
Honor the Capistrano 3.1 no_release flag.
Browse files Browse the repository at this point in the history
Skip bundle install task on servers that are marked with
no_release: true.
  • Loading branch information
mattbrictson committed Feb 9, 2014
1 parent 70893ae commit 1da8dfc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# future release

* Honor `:no_release` flag by using `release_roles` in Capistrano 3.1

# 1.1.2 (8 Feb 2014)

* Added `bundle_env_variables` option for specifying environment variables that should be set when running `bundle`.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It also prefixes certain binaries to use `bundle exec`.

## Installation

Add this line to your application's Gemfile:
Add these lines to your application's Gemfile:

gem 'capistrano', '~> 3.1'
gem 'capistrano-bundler', '~> 1.1.2'
Expand Down Expand Up @@ -39,6 +39,7 @@ set :bundle_bins, fetch(:bundle_bins, []).push %w(my_new_binary)
Configurable options:

set :bundle_roles, :all # this is default
set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) } # this is default
set :bundle_binstubs, -> { shared_path.join('bin') } # this is default
set :bundle_gemfile, -> { release_path.join('MyGemfile') } # default: nil
set :bundle_path, -> { shared_path.join('bundle') } # this is default
Expand Down
6 changes: 5 additions & 1 deletion lib/capistrano/tasks/bundler.cap
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ namespace :bundler do
test group will not be installed. The install command is executed \
with the --deployment and --quiet flags.

By default, bundler will not be run on servers with no_release: true.

You can override any of these defaults by setting the variables shown below.

set :bundle_roles, :all

set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) }
set :bundle_binstubs, -> { shared_path.join('bin') }
set :bundle_gemfile, -> { release_path.join('Gemfile') }
set :bundle_path, -> { shared_path.join('bundle') }
Expand All @@ -17,7 +20,7 @@ namespace :bundler do
set :bundle_env_variables, {}
DESC
task :install do
on roles fetch(:bundle_roles) do
on fetch(:bundle_servers) do
within release_path do
with fetch(:bundle_env_variables, {}) do
options = ["install"]
Expand Down Expand Up @@ -57,6 +60,7 @@ namespace :load do
set :bundle_bins, %w{gem rake rails}

set :bundle_roles, :all
set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) }
set :bundle_binstubs, -> { shared_path.join('bin') }
set :bundle_path, -> { shared_path.join('bundle') }
set :bundle_without, %w{development test}.join(' ')
Expand Down

0 comments on commit 1da8dfc

Please sign in to comment.