summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-11-02 14:04:00 -0700
committerAndre Arko <andre@arko.net>2010-11-02 14:04:00 -0700
commit47022b08b7ae0585adb30321e797f631f8592b60 (patch)
tree9888ef8c6a430cc0998f8de3a98ba6be24961a66
parent3e80910277945787b2aa362adab262d449d288bc (diff)
downloadbundler-47022b08b7ae0585adb30321e797f631f8592b60.tar.gz
Refactor :bundle_roles so it works for cap and vlad, expand docs
-rw-r--r--lib/bundler/capistrano.rb5
-rw-r--r--lib/bundler/deployment.rb35
2 files changed, 26 insertions, 14 deletions
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb
index d73ddf9244..a304b09f39 100644
--- a/lib/bundler/capistrano.rb
+++ b/lib/bundler/capistrano.rb
@@ -6,8 +6,5 @@ require 'bundler/deployment'
Capistrano::Configuration.instance(:must_exist).load do
after "deploy:update_code", "bundle:install"
-
- opts = {:except => { :no_release => true }}
- opts[:roles] = self[:bundle_roles] if self[:bundle_roles]
- Bundler::Deployment.define_task(self, :task, opts)
+ Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
end
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")