diff options
| author | Andre Arko <andre@arko.net> | 2010-11-02 14:04:00 -0700 |
|---|---|---|
| committer | Andre Arko <andre@arko.net> | 2010-11-02 14:04:00 -0700 |
| commit | 47022b08b7ae0585adb30321e797f631f8592b60 (patch) | |
| tree | 9888ef8c6a430cc0998f8de3a98ba6be24961a66 /lib/bundler/deployment.rb | |
| parent | 3e80910277945787b2aa362adab262d449d288bc (diff) | |
| download | bundler-47022b08b7ae0585adb30321e797f631f8592b60.tar.gz | |
Refactor :bundle_roles so it works for cap and vlad, expand docs
Diffstat (limited to 'lib/bundler/deployment.rb')
| -rw-r--r-- | lib/bundler/deployment.rb | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb index f305f50d38..73ee604d2a 100644 --- a/lib/bundler/deployment.rb +++ b/lib/bundler/deployment.rb @@ -1,22 +1,37 @@ module Bundler class Deployment def self.define_task(context, task_method = :task, opts = {}) + if context.is_a?(Capistrano::Configuration) + context_name = "capistrano" + role_default = "{:except => {:no_release => true}}" + else + context_name = "vlad" + role_default = "[:app]" + end + + roles = context.fetch(:bundle_roles, nil) + opts[:roles] = roles if roles + context.send :namespace, :bundle do send :desc, <<-DESC Install the current Bundler environment. By default, gems will be \ installed to the shared/bundle path. Gems in the development and \ test group will not be installed. The install command is executed \ - with the --deployment and --quiet flags. You can override any of \ - these defaults by setting the variables shown below. If the bundle \ - cmd cannot be found then you can override the bundle_cmd variable \ - to specifiy which one it should use. + with the --deployment and --quiet flags. If the bundle cmd cannot \ + be found then you can override the bundle_cmd variable to specifiy \ + which one it should use. + + You can override any of these defaults by setting the variables shown below. + + N.B. bundle_roles must be defined before you require 'bundler/#{context_name}' \ + in your deploy.rb file. - set :bundle_gemfile, "Gemfile" - set :bundle_dir, File.join(fetch(:shared_path), 'bundle') - set :bundle_flags, "--deployment --quiet" - set :bundle_without, [:development, :test] - set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle" - set :bundle_roles, {:except => {:no_release => true}} # e.g. [:app, :batch] + set :bundle_gemfile, "Gemfile" + set :bundle_dir, File.join(fetch(:shared_path), 'bundle') + set :bundle_flags, "--deployment --quiet" + set :bundle_without, [:development, :test] + set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle" + set :bundle_roles, #{role_default} # e.g. [:app, :batch] DESC send task_method, :install, opts do bundle_cmd = context.fetch(:bundle_cmd, "bundle") |
