Module: Capistrano::CLI::Execute
- Included in:
- Capistrano::CLI
- Defined in:
- lib/capistrano/cli/execute.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary (collapse)
-
+ (Object) included(base)
:nodoc:.
Instance Method Summary (collapse)
-
- (Object) execute!
Using the options build when the command-line was parsed, instantiate a new Capistrano configuration, initialize it, and execute the requested actions.
- - (Object) execute_requested_actions(config)
-
- (Object) handle_error(error)
:nodoc:.
-
- (Object) instantiate_configuration(options = {})
Primarily useful for testing, but subclasses of CLI could conceivably override this method to return a Configuration subclass or replacement.
-
- (Object) load_recipes(config)
:nodoc:.
-
- (Object) set_pre_vars(config)
:nodoc:.
Class Method Details
+ (Object) included(base)
:nodoc:
6 7 8 |
# File 'lib/capistrano/cli/execute.rb', line 6 def self.included(base) #:nodoc: base.extend(ClassMethods) end |
Instance Method Details
- (Object) execute!
Using the options build when the command-line was parsed, instantiate a new Capistrano configuration, initialize it, and execute the requested actions.
Returns the Configuration instance used, if successful.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/capistrano/cli/execute.rb', line 23 def execute! config = instantiate_configuration() config.debug = [:debug] config.dry_run = [:dry_run] config.preserve_roles = [:preserve_roles] config.logger.level = [:verbose] set_pre_vars(config) load_recipes(config) config.trigger(:load) execute_requested_actions(config) config.trigger(:exit) config rescue Exception => error handle_error(error) end |
- (Object) execute_requested_actions(config)
42 43 44 45 46 47 48 |
# File 'lib/capistrano/cli/execute.rb', line 42 def execute_requested_actions(config) Array([:vars]).each { |name, value| config.set(name, value) } Array([:actions]).each do |action| config.find_and_execute_task(action, :before => :start, :after => :finish) end end |
- (Object) handle_error(error)
:nodoc:
74 75 76 77 78 79 80 81 82 |
# File 'lib/capistrano/cli/execute.rb', line 74 def handle_error(error) #:nodoc: case error when Net::SSH::AuthenticationFailed abort "authentication failed for `#{error.}'" when Capistrano::Error abort(error.) else raise error end end |
- (Object) instantiate_configuration(options = {})
Primarily useful for testing, but subclasses of CLI could conceivably override this method to return a Configuration subclass or replacement.
70 71 72 |
# File 'lib/capistrano/cli/execute.rb', line 70 def instantiate_configuration(={}) #:nodoc: Capistrano::Configuration.new() end |
- (Object) load_recipes(config)
:nodoc:
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/capistrano/cli/execute.rb', line 55 def load_recipes(config) #:nodoc: # load the standard recipe definition config.load "standard" # load systemwide config/recipe definition config.load([:sysconf]) if [:sysconf] && File.file?([:sysconf]) # load user config/recipe definition config.load([:dotfile]) if [:dotfile] && File.file?([:dotfile]) Array([:recipes]).each { |recipe| config.load(recipe) } end |
- (Object) set_pre_vars(config)
:nodoc:
50 51 52 53 |
# File 'lib/capistrano/cli/execute.rb', line 50 def set_pre_vars(config) #:nodoc: config.set :password, [:password] Array([:pre_vars]).each { |name, value| config.set(name, value) } end |