Parent

Methods

Class Index [+]

Quicksearch

Bundler::Deployment

Public Class Methods

define_task(context, task_method = :task, opts = {}) click to toggle source
    # File lib/bundler/deployment.rb, line 3
 3:     def self.define_task(context, task_method = :task, opts = {})
 4:       if context.is_a?(Capistrano::Configuration)
 5:         context_name = "capistrano"
 6:         role_default = "{:except => {:no_release => true}}"
 7:       else
 8:         context_name = "vlad"
 9:         role_default = "[:app]"
10:       end
11: 
12:       roles = context.fetch(:bundle_roles, nil)
13:       opts[:roles] = roles if roles
14: 
15:       context.send :namespace, :bundle do
16:         send :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. 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,    #{role_default} # e.g. [:app, :batch]
17:         send task_method, :install, opts do
18:           bundle_cmd     = context.fetch(:bundle_cmd, "bundle")
19:           bundle_flags   = context.fetch(:bundle_flags, "--deployment --quiet")
20:           bundle_dir     = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle'))
21:           bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile")
22:           bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact
23: 
24:           args = ["--gemfile #{File.join(context.fetch(:current_release), bundle_gemfile)}"]
25:           args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
26:           args << bundle_flags.to_s
27:           args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
28: 
29:           run "#{bundle_cmd} install #{args.join(' ')}"
30:         end
31:       end
32:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.