minmb-capistrano 2.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +7 -0
  3. data/CHANGELOG +1170 -0
  4. data/Gemfile +13 -0
  5. data/README.md +94 -0
  6. data/Rakefile +11 -0
  7. data/bin/cap +4 -0
  8. data/bin/capify +92 -0
  9. data/capistrano.gemspec +40 -0
  10. data/lib/capistrano.rb +5 -0
  11. data/lib/capistrano/callback.rb +45 -0
  12. data/lib/capistrano/cli.rb +47 -0
  13. data/lib/capistrano/cli/execute.rb +85 -0
  14. data/lib/capistrano/cli/help.rb +125 -0
  15. data/lib/capistrano/cli/help.txt +81 -0
  16. data/lib/capistrano/cli/options.rb +243 -0
  17. data/lib/capistrano/cli/ui.rb +40 -0
  18. data/lib/capistrano/command.rb +303 -0
  19. data/lib/capistrano/configuration.rb +57 -0
  20. data/lib/capistrano/configuration/actions/file_transfer.rb +50 -0
  21. data/lib/capistrano/configuration/actions/inspect.rb +46 -0
  22. data/lib/capistrano/configuration/actions/invocation.rb +329 -0
  23. data/lib/capistrano/configuration/alias_task.rb +26 -0
  24. data/lib/capistrano/configuration/callbacks.rb +147 -0
  25. data/lib/capistrano/configuration/connections.rb +237 -0
  26. data/lib/capistrano/configuration/execution.rb +142 -0
  27. data/lib/capistrano/configuration/loading.rb +205 -0
  28. data/lib/capistrano/configuration/log_formatters.rb +75 -0
  29. data/lib/capistrano/configuration/namespaces.rb +223 -0
  30. data/lib/capistrano/configuration/roles.rb +77 -0
  31. data/lib/capistrano/configuration/servers.rb +116 -0
  32. data/lib/capistrano/configuration/variables.rb +127 -0
  33. data/lib/capistrano/errors.rb +19 -0
  34. data/lib/capistrano/ext/multistage.rb +64 -0
  35. data/lib/capistrano/ext/string.rb +5 -0
  36. data/lib/capistrano/extensions.rb +57 -0
  37. data/lib/capistrano/fix_rake_deprecated_dsl.rb +8 -0
  38. data/lib/capistrano/logger.rb +166 -0
  39. data/lib/capistrano/processable.rb +57 -0
  40. data/lib/capistrano/recipes/compat.rb +32 -0
  41. data/lib/capistrano/recipes/deploy.rb +625 -0
  42. data/lib/capistrano/recipes/deploy/assets.rb +201 -0
  43. data/lib/capistrano/recipes/deploy/dependencies.rb +44 -0
  44. data/lib/capistrano/recipes/deploy/local_dependency.rb +54 -0
  45. data/lib/capistrano/recipes/deploy/remote_dependency.rb +117 -0
  46. data/lib/capistrano/recipes/deploy/scm.rb +19 -0
  47. data/lib/capistrano/recipes/deploy/scm/accurev.rb +169 -0
  48. data/lib/capistrano/recipes/deploy/scm/base.rb +200 -0
  49. data/lib/capistrano/recipes/deploy/scm/bzr.rb +86 -0
  50. data/lib/capistrano/recipes/deploy/scm/cvs.rb +153 -0
  51. data/lib/capistrano/recipes/deploy/scm/darcs.rb +96 -0
  52. data/lib/capistrano/recipes/deploy/scm/git.rb +293 -0
  53. data/lib/capistrano/recipes/deploy/scm/mercurial.rb +137 -0
  54. data/lib/capistrano/recipes/deploy/scm/none.rb +55 -0
  55. data/lib/capistrano/recipes/deploy/scm/perforce.rb +152 -0
  56. data/lib/capistrano/recipes/deploy/scm/subversion.rb +121 -0
  57. data/lib/capistrano/recipes/deploy/strategy.rb +19 -0
  58. data/lib/capistrano/recipes/deploy/strategy/base.rb +92 -0
  59. data/lib/capistrano/recipes/deploy/strategy/checkout.rb +20 -0
  60. data/lib/capistrano/recipes/deploy/strategy/copy.rb +338 -0
  61. data/lib/capistrano/recipes/deploy/strategy/export.rb +20 -0
  62. data/lib/capistrano/recipes/deploy/strategy/remote.rb +52 -0
  63. data/lib/capistrano/recipes/deploy/strategy/remote_cache.rb +57 -0
  64. data/lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb +21 -0
  65. data/lib/capistrano/recipes/standard.rb +37 -0
  66. data/lib/capistrano/recipes/templates/maintenance.rhtml +53 -0
  67. data/lib/capistrano/role.rb +102 -0
  68. data/lib/capistrano/server_definition.rb +56 -0
  69. data/lib/capistrano/shell.rb +265 -0
  70. data/lib/capistrano/ssh.rb +95 -0
  71. data/lib/capistrano/task_definition.rb +77 -0
  72. data/lib/capistrano/transfer.rb +218 -0
  73. data/lib/capistrano/version.rb +11 -0
  74. data/test/cli/execute_test.rb +132 -0
  75. data/test/cli/help_test.rb +165 -0
  76. data/test/cli/options_test.rb +329 -0
  77. data/test/cli/ui_test.rb +28 -0
  78. data/test/cli_test.rb +17 -0
  79. data/test/command_test.rb +322 -0
  80. data/test/configuration/actions/file_transfer_test.rb +61 -0
  81. data/test/configuration/actions/inspect_test.rb +76 -0
  82. data/test/configuration/actions/invocation_test.rb +288 -0
  83. data/test/configuration/alias_task_test.rb +118 -0
  84. data/test/configuration/callbacks_test.rb +201 -0
  85. data/test/configuration/connections_test.rb +439 -0
  86. data/test/configuration/execution_test.rb +175 -0
  87. data/test/configuration/loading_test.rb +148 -0
  88. data/test/configuration/namespace_dsl_test.rb +332 -0
  89. data/test/configuration/roles_test.rb +157 -0
  90. data/test/configuration/servers_test.rb +183 -0
  91. data/test/configuration/variables_test.rb +190 -0
  92. data/test/configuration_test.rb +77 -0
  93. data/test/deploy/local_dependency_test.rb +76 -0
  94. data/test/deploy/remote_dependency_test.rb +146 -0
  95. data/test/deploy/scm/accurev_test.rb +23 -0
  96. data/test/deploy/scm/base_test.rb +55 -0
  97. data/test/deploy/scm/bzr_test.rb +51 -0
  98. data/test/deploy/scm/darcs_test.rb +37 -0
  99. data/test/deploy/scm/git_test.rb +221 -0
  100. data/test/deploy/scm/mercurial_test.rb +134 -0
  101. data/test/deploy/scm/none_test.rb +35 -0
  102. data/test/deploy/scm/perforce_test.rb +23 -0
  103. data/test/deploy/scm/subversion_test.rb +40 -0
  104. data/test/deploy/strategy/copy_test.rb +360 -0
  105. data/test/extensions_test.rb +69 -0
  106. data/test/fixtures/cli_integration.rb +5 -0
  107. data/test/fixtures/config.rb +5 -0
  108. data/test/fixtures/custom.rb +3 -0
  109. data/test/logger_formatting_test.rb +149 -0
  110. data/test/logger_test.rb +134 -0
  111. data/test/recipes_test.rb +25 -0
  112. data/test/role_test.rb +11 -0
  113. data/test/server_definition_test.rb +121 -0
  114. data/test/shell_test.rb +96 -0
  115. data/test/ssh_test.rb +113 -0
  116. data/test/task_definition_test.rb +117 -0
  117. data/test/transfer_test.rb +168 -0
  118. data/test/utils.rb +37 -0
  119. metadata +316 -0
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capistrano.gemspec
4
+ gemspec
5
+
6
+ #
7
+ # Development Dependencies from the Gemfile
8
+ # are merged here.
9
+ #
10
+ group :development do
11
+ gem "rake"
12
+ gem "pry"
13
+ end
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ ## Capistrano
2
+
3
+ [![Build
4
+ Status](https://secure.travis-ci.org/capistrano/capistrano.png)](http://travis-ci.org/capistrano/capistrano)[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/capistrano/capistrano)
5
+
6
+
7
+ Capistrano is a utility and framework for executing commands in parallel on
8
+ multiple remote machines, via SSH. It uses a simple DSL (borrowed in part from
9
+ [Rake](http://rake.rubyforge.org/)) that allows you to define _tasks_, which may
10
+ be applied to machines in certain roles. It also supports tunneling connections
11
+ via some gateway machine to allow operations to be performed behind VPN's and
12
+ firewalls.
13
+
14
+ Capistrano was originally designed to simplify and automate deployment of web
15
+ applications to distributed environments, and originally came bundled with a set
16
+ of tasks designed for deploying Rails applications.
17
+
18
+ ## Documentation
19
+
20
+ * [https://github.com/capistrano/capistrano/wiki](https://github.com/capistrano/capistrano/wiki)
21
+
22
+ ## DEPENDENCIES
23
+
24
+ * [Net::SSH](http://net-ssh.rubyforge.org)
25
+ * [Net::SFTP](http://net-ssh.rubyforge.org)
26
+ * [Net::SCP](http://net-ssh.rubyforge.org)
27
+ * [Net::SSH::Gateway](http://net-ssh.rubyforge.org)
28
+ * [HighLine](http://highline.rubyforge.org)
29
+ * [Ruby](http://www.ruby-lang.org/en/) ≥ 1.8.7
30
+
31
+ If you want to run the tests, you'll also need to install the dependencies with
32
+ Bundler, see the `Gemfile` within .
33
+
34
+ ## ASSUMPTIONS
35
+
36
+ Capistrano is "opinionated software", which means it has very firm ideas about
37
+ how things ought to be done, and tries to force those ideas on you. Some of the
38
+ assumptions behind these opinions are:
39
+
40
+ * You are using SSH to access the remote servers.
41
+ * You either have the same password to all target machines, or you have public
42
+ keys in place to allow passwordless access to them.
43
+
44
+ Do not expect these assumptions to change.
45
+
46
+ ## USAGE
47
+
48
+ In general, you'll use Capistrano as follows:
49
+
50
+ * Create a recipe file ("capfile" or "Capfile").
51
+ * Use the `cap` script to execute your recipe.
52
+
53
+ Use the `cap` script as follows:
54
+
55
+ cap sometask
56
+
57
+ By default, the script will look for a file called one of `capfile` or
58
+ `Capfile`. The `sometask` text indicates which task to execute. You can do
59
+ "cap -h" to see all the available options and "cap -T" to see all the available
60
+ tasks.
61
+
62
+ ## CONTRIBUTING:
63
+
64
+ * Fork Capistrano
65
+ * Create a topic branch - `git checkout -b my_branch`
66
+ * Rebase your branch so that all your changes are reflected in one
67
+ commit
68
+ * Push to your branch - `git push origin my_branch`
69
+ * Create a Pull Request from your branch, include as much documentation
70
+ as you can in the commit message/pull request, following these
71
+ [guidelines on writing a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
72
+ * That's it!
73
+
74
+
75
+ ## LICENSE:
76
+
77
+ Permission is hereby granted, free of charge, to any person obtaining
78
+ a copy of this software and associated documentation files (the
79
+ 'Software'), to deal in the Software without restriction, including
80
+ without limitation the rights to use, copy, modify, merge, publish,
81
+ distribute, sublicense, and/or sell copies of the Software, and to
82
+ permit persons to whom the Software is furnished to do so, subject to
83
+ the following conditions:
84
+
85
+ The above copyright notice and this permission notice shall be
86
+ included in all copies or substantial portions of the Software.
87
+
88
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
89
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
91
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
92
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
93
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
94
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/*_test.rb'
8
+ test.verbose = true
9
+ end
10
+
11
+ task :default => :test
data/bin/cap ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'capistrano/cli'
4
+ Capistrano::CLI.execute
data/bin/capify ADDED
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'fileutils'
5
+
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: #{File.basename($0)} [path]"
8
+
9
+ opts.on("-h", "--help", "Displays this help info") do
10
+ puts opts
11
+ exit 0
12
+ end
13
+
14
+ begin
15
+ opts.parse!(ARGV)
16
+ rescue OptionParser::ParseError => e
17
+ warn e.message
18
+ puts opts
19
+ exit 1
20
+ end
21
+ end
22
+
23
+ if ARGV.empty?
24
+ abort "Please specify the directory to capify, e.g. `#{File.basename($0)} .'"
25
+ elsif !File.exists?(ARGV.first)
26
+ abort "`#{ARGV.first}' does not exist."
27
+ elsif !File.directory?(ARGV.first)
28
+ abort "`#{ARGV.first}' is not a directory."
29
+ elsif ARGV.length > 1
30
+ abort "Too many arguments; please specify only the directory to capify."
31
+ end
32
+
33
+ def unindent(string)
34
+ indentation = string[/\A\s*/]
35
+ string.strip.gsub(/^#{indentation}/, "")
36
+ end
37
+
38
+ files = {
39
+ "Capfile" => unindent(<<-FILE),
40
+
41
+ load 'deploy'
42
+
43
+ # Uncomment if you are using Rails' asset pipeline
44
+ # load 'deploy/assets'
45
+
46
+ load 'config/deploy' # remove this line to skip loading any of the default tasks
47
+ FILE
48
+
49
+ "config/deploy.rb" => 'set :application, "set your application name here"
50
+ set :repository, "set your repository location here"
51
+
52
+ # set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
53
+ # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
54
+
55
+ role :web, "your web-server here" # Your HTTP server, Apache/etc
56
+ role :app, "your app-server here" # This may be the same as your `Web` server
57
+ role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
58
+ role :db, "your slave db-server here"
59
+
60
+ # if you want to clean up old releases on each deploy uncomment this:
61
+ # after "deploy:restart", "deploy:cleanup"
62
+
63
+ # if you\'re still using the script/reaper helper you will need
64
+ # these http://github.com/rails/irs_process_scripts
65
+
66
+ # If you are using Passenger mod_rails uncomment this:
67
+ # namespace :deploy do
68
+ # task :start do ; end
69
+ # task :stop do ; end
70
+ # task :restart, :roles => :app, :except => { :no_release => true } do
71
+ # run "#{try_sudo} touch #{File.join(current_path,\'tmp\',\'restart.txt\')}"
72
+ # end
73
+ # end'}
74
+
75
+ base = ARGV.shift
76
+ files.each do |file, content|
77
+ file = File.join(base, file)
78
+ if File.exists?(file)
79
+ warn "[skip] '#{file}' already exists"
80
+ elsif File.exists?(file.downcase)
81
+ warn "[skip] '#{file.downcase}' exists, which could conflict with `#{file}'"
82
+ else
83
+ unless File.exists?(File.dirname(file))
84
+ puts "[add] making directory '#{File.dirname(file)}'"
85
+ FileUtils.mkdir(File.dirname(file))
86
+ end
87
+ puts "[add] writing '#{file}'"
88
+ File.open(file, "w") { |f| f.write(content) }
89
+ end
90
+ end
91
+
92
+ puts "[done] capified!"
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "capistrano/version"
4
+
5
+ Gem::Specification.new do |s|
6
+
7
+ s.name = "minmb-capistrano"
8
+ s.version = Capistrano::Version.to_s
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Jamis Buck", "Lee Hambley"]
11
+ s.email = ["jamis@jamisbuck.org", "lee.hambley@gmail.com"]
12
+ s.homepage = "http://github.com/minmb/capistrano"
13
+ s.summary = %q{Capistrano - Welcome to easy deployment with Ruby over SSH}
14
+ s.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+ s.extra_rdoc_files = [
20
+ "README.md"
21
+ ]
22
+
23
+ s.specification_version = 3 if s.respond_to? :specification_version
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<highline>, [">= 0"])
27
+ s.add_runtime_dependency(%q<minmb-net-ssh>, [">= 2.0.14"])
28
+ s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
29
+ s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
30
+ s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
31
+ s.add_development_dependency(%q<mocha>, ["0.9.12"])
32
+ else
33
+ s.add_dependency(%q<minmb-net-ssh>, [">= 2.0.14"])
34
+ s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
35
+ s.add_dependency(%q<net-scp>, [">= 1.0.0"])
36
+ s.add_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
37
+ s.add_dependency(%q<highline>, [">= 0"])
38
+ s.add_dependency(%q<mocha>, ["0.9.12"])
39
+ end
40
+ end
data/lib/capistrano.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'capistrano/fix_rake_deprecated_dsl'
2
+
3
+ require 'capistrano/configuration'
4
+ require 'capistrano/extensions'
5
+ require 'capistrano/ext/string'
@@ -0,0 +1,45 @@
1
+ module Capistrano
2
+ class Callback
3
+ attr_reader :source, :options, :only, :except
4
+
5
+ def initialize(source, options={})
6
+ @source = source
7
+ @options = options
8
+ @only = Array(options[:only]).map { |v| v.to_s }
9
+ @except = Array(options[:except]).map { |v| v.to_s }
10
+ end
11
+
12
+ def applies_to?(task)
13
+ if task && only.any?
14
+ return only.include?(task.fully_qualified_name)
15
+ elsif task && except.any?
16
+ return !except.include?(task.fully_qualified_name)
17
+ else
18
+ return true
19
+ end
20
+ end
21
+ end
22
+
23
+ class ProcCallback < Callback
24
+ def call
25
+ source.call
26
+ end
27
+ end
28
+
29
+ class TaskCallback < Callback
30
+ attr_reader :config
31
+
32
+ def initialize(config, source, options={})
33
+ super(source, options)
34
+ @config = config
35
+ end
36
+
37
+ def call
38
+ config.find_and_execute_task(source)
39
+ end
40
+
41
+ def applies_to?(task)
42
+ super && (task.nil? || task.fully_qualified_name != source.to_s)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,47 @@
1
+ require 'capistrano'
2
+ require 'capistrano/cli/execute'
3
+ require 'capistrano/cli/help'
4
+ require 'capistrano/cli/options'
5
+ require 'capistrano/cli/ui'
6
+
7
+ module Capistrano
8
+ # The CLI class encapsulates the behavior of capistrano when it is invoked
9
+ # as a command-line utility. This allows other programs to embed Capistrano
10
+ # and preserve its command-line semantics.
11
+ class CLI
12
+ # The array of (unparsed) command-line options
13
+ attr_reader :args
14
+
15
+ # Create a new CLI instance using the given array of command-line parameters
16
+ # to initialize it. By default, +ARGV+ is used, but you can specify a
17
+ # different set of parameters (such as when embedded cap in a program):
18
+ #
19
+ # require 'capistrano/cli'
20
+ # Capistrano::CLI.parse(%W(-vvvv -f config/deploy update_code)).execute!
21
+ #
22
+ # Note that you can also embed cap directly by creating a new Configuration
23
+ # instance and setting it up, The above snippet, redone using the
24
+ # Configuration class directly, would look like:
25
+ #
26
+ # require 'capistrano'
27
+ # require 'capistrano/cli'
28
+ # config = Capistrano::Configuration.new
29
+ # config.logger.level = Capistrano::Logger::TRACE
30
+ # config.set(:password) { Capistrano::CLI.password_prompt }
31
+ # config.load "config/deploy"
32
+ # config.update_code
33
+ #
34
+ # There may be times that you want/need the additional control offered by
35
+ # manipulating the Configuration directly, but generally interfacing with
36
+ # the CLI class is recommended.
37
+ def initialize(args)
38
+ @args = args.dup
39
+ $stdout.sync = true # so that Net::SSH prompts show up
40
+ end
41
+
42
+ # Mix-in the actual behavior
43
+ include Execute, Options, UI
44
+ include Help # needs to be included last, because it overrides some methods
45
+
46
+ end
47
+ end
@@ -0,0 +1,85 @@
1
+ require 'capistrano/configuration'
2
+
3
+ module Capistrano
4
+ class CLI
5
+ module Execute
6
+ def self.included(base) #:nodoc:
7
+ base.extend(ClassMethods)
8
+ end
9
+
10
+ module ClassMethods
11
+ # Invoke capistrano using the ARGV array as the option parameters. This
12
+ # is what the command-line capistrano utility does.
13
+ def execute
14
+ parse(ARGV).execute!
15
+ end
16
+ end
17
+
18
+ # Using the options build when the command-line was parsed, instantiate
19
+ # a new Capistrano configuration, initialize it, and execute the
20
+ # requested actions.
21
+ #
22
+ # Returns the Configuration instance used, if successful.
23
+ def execute!
24
+ config = instantiate_configuration(options)
25
+ config.debug = options[:debug]
26
+ config.dry_run = options[:dry_run]
27
+ config.preserve_roles = options[:preserve_roles]
28
+ config.logger.level = options[:verbose]
29
+
30
+ set_pre_vars(config)
31
+ load_recipes(config)
32
+
33
+ config.trigger(:load)
34
+ execute_requested_actions(config)
35
+ config.trigger(:exit)
36
+
37
+ config
38
+ rescue Exception => error
39
+ handle_error(error)
40
+ end
41
+
42
+ def execute_requested_actions(config)
43
+ Array(options[:vars]).each { |name, value| config.set(name, value) }
44
+
45
+ Array(options[:actions]).each do |action|
46
+ config.find_and_execute_task(action, :before => :start, :after => :finish)
47
+ end
48
+ end
49
+
50
+ def set_pre_vars(config) #:nodoc:
51
+ config.set :password, options[:password]
52
+ Array(options[:pre_vars]).each { |name, value| config.set(name, value) }
53
+ end
54
+
55
+ def load_recipes(config) #:nodoc:
56
+ # load the standard recipe definition
57
+ config.load "standard"
58
+
59
+ # load systemwide config/recipe definition
60
+ config.load(options[:sysconf]) if options[:sysconf] && File.file?(options[:sysconf])
61
+
62
+ # load user config/recipe definition
63
+ config.load(options[:dotfile]) if options[:dotfile] && File.file?(options[:dotfile])
64
+
65
+ Array(options[:recipes]).each { |recipe| config.load(recipe) }
66
+ end
67
+
68
+ # Primarily useful for testing, but subclasses of CLI could conceivably
69
+ # override this method to return a Configuration subclass or replacement.
70
+ def instantiate_configuration(options={}) #:nodoc:
71
+ Capistrano::Configuration.new(options)
72
+ end
73
+
74
+ def handle_error(error) #:nodoc:
75
+ case error
76
+ when Net::SSH::AuthenticationFailed
77
+ abort "authentication failed for `#{error.message}'"
78
+ when Capistrano::Error
79
+ abort(error.message)
80
+ else raise error
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end