# File lib/bundler/deployment.rb, line 3 3: def self.define_task(context, task_method = :task, opts = {}) 4: if defined?(Capistrano) && context.is_a?(Capistrano::Configuration) 5: context_name = "capistrano" 6: role_default = "{:except => {:no_release => true}}" 7: error_type = ::Capistrano::CommandError 8: else 9: context_name = "vlad" 10: role_default = "[:app]" 11: error_type = ::Rake::CommandFailedError 12: end 13: 14: roles = context.fetch(:bundle_roles, false) 15: opts[:roles] = roles if roles 16: 17: context.send :namespace, :bundle do 18: 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] 19: send task_method, :install, opts do 20: bundle_cmd = context.fetch(:bundle_cmd, "bundle") 21: bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet") 22: bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle')) 23: bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile") 24: bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact 25: app_path = context.fetch(:latest_release) 26: if app_path.to_s.empty? 27: raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.") 28: end 29: args = ["--gemfile #{File.join(app_path, bundle_gemfile)}"] 30: args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty? 31: args << bundle_flags.to_s 32: args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty? 33: 34: run "cd #{app_path} && #{bundle_cmd} install #{args.join(' ')}" 35: end 36: end 37: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.