capistrano-edge 2.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +770 -0
- data/Manifest +104 -0
- data/README.rdoc +66 -0
- data/Rakefile +35 -0
- data/bin/cap +4 -0
- data/bin/capify +95 -0
- data/capistrano.gemspec +51 -0
- data/examples/sample.rb +14 -0
- data/lib/capistrano.rb +2 -0
- data/lib/capistrano/callback.rb +45 -0
- data/lib/capistrano/cli.rb +47 -0
- data/lib/capistrano/cli/execute.rb +84 -0
- data/lib/capistrano/cli/help.rb +125 -0
- data/lib/capistrano/cli/help.txt +75 -0
- data/lib/capistrano/cli/options.rb +224 -0
- data/lib/capistrano/cli/ui.rb +40 -0
- data/lib/capistrano/command.rb +283 -0
- data/lib/capistrano/configuration.rb +43 -0
- data/lib/capistrano/configuration/actions/file_transfer.rb +47 -0
- data/lib/capistrano/configuration/actions/inspect.rb +46 -0
- data/lib/capistrano/configuration/actions/invocation.rb +293 -0
- data/lib/capistrano/configuration/callbacks.rb +148 -0
- data/lib/capistrano/configuration/connections.rb +204 -0
- data/lib/capistrano/configuration/execution.rb +143 -0
- data/lib/capistrano/configuration/loading.rb +197 -0
- data/lib/capistrano/configuration/namespaces.rb +197 -0
- data/lib/capistrano/configuration/roles.rb +73 -0
- data/lib/capistrano/configuration/servers.rb +85 -0
- data/lib/capistrano/configuration/variables.rb +127 -0
- data/lib/capistrano/errors.rb +15 -0
- data/lib/capistrano/extensions.rb +57 -0
- data/lib/capistrano/logger.rb +59 -0
- data/lib/capistrano/processable.rb +53 -0
- data/lib/capistrano/recipes/compat.rb +32 -0
- data/lib/capistrano/recipes/deploy.rb +438 -0
- data/lib/capistrano/recipes/deploy/dependencies.rb +44 -0
- data/lib/capistrano/recipes/deploy/local_dependency.rb +54 -0
- data/lib/capistrano/recipes/deploy/remote_dependency.rb +105 -0
- data/lib/capistrano/recipes/deploy/scm.rb +19 -0
- data/lib/capistrano/recipes/deploy/scm/accurev.rb +169 -0
- data/lib/capistrano/recipes/deploy/scm/base.rb +196 -0
- data/lib/capistrano/recipes/deploy/scm/bzr.rb +83 -0
- data/lib/capistrano/recipes/deploy/scm/cvs.rb +152 -0
- data/lib/capistrano/recipes/deploy/scm/darcs.rb +85 -0
- data/lib/capistrano/recipes/deploy/scm/git.rb +274 -0
- data/lib/capistrano/recipes/deploy/scm/mercurial.rb +137 -0
- data/lib/capistrano/recipes/deploy/scm/none.rb +44 -0
- data/lib/capistrano/recipes/deploy/scm/perforce.rb +138 -0
- data/lib/capistrano/recipes/deploy/scm/subversion.rb +121 -0
- data/lib/capistrano/recipes/deploy/strategy.rb +19 -0
- data/lib/capistrano/recipes/deploy/strategy/base.rb +79 -0
- data/lib/capistrano/recipes/deploy/strategy/checkout.rb +20 -0
- data/lib/capistrano/recipes/deploy/strategy/copy.rb +210 -0
- data/lib/capistrano/recipes/deploy/strategy/export.rb +20 -0
- data/lib/capistrano/recipes/deploy/strategy/remote.rb +52 -0
- data/lib/capistrano/recipes/deploy/strategy/remote_cache.rb +56 -0
- data/lib/capistrano/recipes/deploy/templates/maintenance.rhtml +53 -0
- data/lib/capistrano/recipes/ext/rails-database-migrations.rb +50 -0
- data/lib/capistrano/recipes/ext/web-disable-enable.rb +40 -0
- data/lib/capistrano/recipes/standard.rb +37 -0
- data/lib/capistrano/recipes/templates/maintenance.rhtml +53 -0
- data/lib/capistrano/recipes/upgrade.rb +33 -0
- data/lib/capistrano/role.rb +102 -0
- data/lib/capistrano/server_definition.rb +56 -0
- data/lib/capistrano/shell.rb +260 -0
- data/lib/capistrano/ssh.rb +99 -0
- data/lib/capistrano/task_definition.rb +70 -0
- data/lib/capistrano/transfer.rb +216 -0
- data/lib/capistrano/version.rb +18 -0
- data/setup.rb +1346 -0
- data/test/cli/execute_test.rb +132 -0
- data/test/cli/help_test.rb +165 -0
- data/test/cli/options_test.rb +317 -0
- data/test/cli/ui_test.rb +28 -0
- data/test/cli_test.rb +17 -0
- data/test/command_test.rb +286 -0
- data/test/configuration/actions/file_transfer_test.rb +61 -0
- data/test/configuration/actions/inspect_test.rb +65 -0
- data/test/configuration/actions/invocation_test.rb +224 -0
- data/test/configuration/callbacks_test.rb +220 -0
- data/test/configuration/connections_test.rb +349 -0
- data/test/configuration/execution_test.rb +175 -0
- data/test/configuration/loading_test.rb +132 -0
- data/test/configuration/namespace_dsl_test.rb +311 -0
- data/test/configuration/roles_test.rb +144 -0
- data/test/configuration/servers_test.rb +121 -0
- data/test/configuration/variables_test.rb +184 -0
- data/test/configuration_test.rb +88 -0
- data/test/deploy/local_dependency_test.rb +76 -0
- data/test/deploy/remote_dependency_test.rb +114 -0
- data/test/deploy/scm/accurev_test.rb +23 -0
- data/test/deploy/scm/base_test.rb +55 -0
- data/test/deploy/scm/git_test.rb +184 -0
- data/test/deploy/scm/mercurial_test.rb +129 -0
- data/test/deploy/scm/none_test.rb +35 -0
- data/test/deploy/strategy/copy_test.rb +258 -0
- data/test/extensions_test.rb +69 -0
- data/test/fixtures/cli_integration.rb +5 -0
- data/test/fixtures/config.rb +5 -0
- data/test/fixtures/custom.rb +3 -0
- data/test/logger_test.rb +123 -0
- data/test/role_test.rb +11 -0
- data/test/server_definition_test.rb +121 -0
- data/test/shell_test.rb +90 -0
- data/test/ssh_test.rb +104 -0
- data/test/task_definition_test.rb +101 -0
- data/test/transfer_test.rb +160 -0
- data/test/utils.rb +38 -0
- metadata +321 -0
data/Manifest
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
bin/cap
|
2
|
+
bin/capify
|
3
|
+
CHANGELOG.rdoc
|
4
|
+
examples/sample.rb
|
5
|
+
lib/capistrano/callback.rb
|
6
|
+
lib/capistrano/cli/execute.rb
|
7
|
+
lib/capistrano/cli/help.rb
|
8
|
+
lib/capistrano/cli/help.txt
|
9
|
+
lib/capistrano/cli/options.rb
|
10
|
+
lib/capistrano/cli/ui.rb
|
11
|
+
lib/capistrano/cli.rb
|
12
|
+
lib/capistrano/command.rb
|
13
|
+
lib/capistrano/configuration/actions/file_transfer.rb
|
14
|
+
lib/capistrano/configuration/actions/inspect.rb
|
15
|
+
lib/capistrano/configuration/actions/invocation.rb
|
16
|
+
lib/capistrano/configuration/callbacks.rb
|
17
|
+
lib/capistrano/configuration/connections.rb
|
18
|
+
lib/capistrano/configuration/execution.rb
|
19
|
+
lib/capistrano/configuration/loading.rb
|
20
|
+
lib/capistrano/configuration/namespaces.rb
|
21
|
+
lib/capistrano/configuration/roles.rb
|
22
|
+
lib/capistrano/configuration/servers.rb
|
23
|
+
lib/capistrano/configuration/variables.rb
|
24
|
+
lib/capistrano/configuration.rb
|
25
|
+
lib/capistrano/errors.rb
|
26
|
+
lib/capistrano/extensions.rb
|
27
|
+
lib/capistrano/logger.rb
|
28
|
+
lib/capistrano/processable.rb
|
29
|
+
lib/capistrano/recipes/compat.rb
|
30
|
+
lib/capistrano/recipes/deploy/dependencies.rb
|
31
|
+
lib/capistrano/recipes/deploy/local_dependency.rb
|
32
|
+
lib/capistrano/recipes/deploy/remote_dependency.rb
|
33
|
+
lib/capistrano/recipes/deploy/scm/accurev.rb
|
34
|
+
lib/capistrano/recipes/deploy/scm/base.rb
|
35
|
+
lib/capistrano/recipes/deploy/scm/bzr.rb
|
36
|
+
lib/capistrano/recipes/deploy/scm/cvs.rb
|
37
|
+
lib/capistrano/recipes/deploy/scm/darcs.rb
|
38
|
+
lib/capistrano/recipes/deploy/scm/git.rb
|
39
|
+
lib/capistrano/recipes/deploy/scm/mercurial.rb
|
40
|
+
lib/capistrano/recipes/deploy/scm/none.rb
|
41
|
+
lib/capistrano/recipes/deploy/scm/perforce.rb
|
42
|
+
lib/capistrano/recipes/deploy/scm/subversion.rb
|
43
|
+
lib/capistrano/recipes/deploy/scm.rb
|
44
|
+
lib/capistrano/recipes/deploy/strategy/base.rb
|
45
|
+
lib/capistrano/recipes/deploy/strategy/checkout.rb
|
46
|
+
lib/capistrano/recipes/deploy/strategy/copy.rb
|
47
|
+
lib/capistrano/recipes/deploy/strategy/export.rb
|
48
|
+
lib/capistrano/recipes/deploy/strategy/remote.rb
|
49
|
+
lib/capistrano/recipes/deploy/strategy/remote_cache.rb
|
50
|
+
lib/capistrano/recipes/deploy/strategy.rb
|
51
|
+
lib/capistrano/recipes/deploy/templates/maintenance.rhtml
|
52
|
+
lib/capistrano/recipes/deploy.rb
|
53
|
+
lib/capistrano/recipes/standard.rb
|
54
|
+
lib/capistrano/recipes/templates/maintenance.rhtml
|
55
|
+
lib/capistrano/recipes/upgrade.rb
|
56
|
+
lib/capistrano/role.rb
|
57
|
+
lib/capistrano/server_definition.rb
|
58
|
+
lib/capistrano/shell.rb
|
59
|
+
lib/capistrano/ssh.rb
|
60
|
+
lib/capistrano/task_definition.rb
|
61
|
+
lib/capistrano/transfer.rb
|
62
|
+
lib/capistrano/version.rb
|
63
|
+
lib/capistrano.rb
|
64
|
+
Rakefile
|
65
|
+
README.rdoc
|
66
|
+
setup.rb
|
67
|
+
test/cli/execute_test.rb
|
68
|
+
test/cli/help_test.rb
|
69
|
+
test/cli/options_test.rb
|
70
|
+
test/cli/ui_test.rb
|
71
|
+
test/cli_test.rb
|
72
|
+
test/command_test.rb
|
73
|
+
test/configuration/actions/file_transfer_test.rb
|
74
|
+
test/configuration/actions/inspect_test.rb
|
75
|
+
test/configuration/actions/invocation_test.rb
|
76
|
+
test/configuration/callbacks_test.rb
|
77
|
+
test/configuration/connections_test.rb
|
78
|
+
test/configuration/execution_test.rb
|
79
|
+
test/configuration/loading_test.rb
|
80
|
+
test/configuration/namespace_dsl_test.rb
|
81
|
+
test/configuration/roles_test.rb
|
82
|
+
test/configuration/servers_test.rb
|
83
|
+
test/configuration/variables_test.rb
|
84
|
+
test/configuration_test.rb
|
85
|
+
test/deploy/local_dependency_test.rb
|
86
|
+
test/deploy/remote_dependency_test.rb
|
87
|
+
test/deploy/scm/accurev_test.rb
|
88
|
+
test/deploy/scm/base_test.rb
|
89
|
+
test/deploy/scm/git_test.rb
|
90
|
+
test/deploy/scm/mercurial_test.rb
|
91
|
+
test/deploy/strategy/copy_test.rb
|
92
|
+
test/extensions_test.rb
|
93
|
+
test/fixtures/cli_integration.rb
|
94
|
+
test/fixtures/config.rb
|
95
|
+
test/fixtures/custom.rb
|
96
|
+
test/logger_test.rb
|
97
|
+
test/role_test.rb
|
98
|
+
test/server_definition_test.rb
|
99
|
+
test/shell_test.rb
|
100
|
+
test/ssh_test.rb
|
101
|
+
test/task_definition_test.rb
|
102
|
+
test/transfer_test.rb
|
103
|
+
test/utils.rb
|
104
|
+
Manifest
|
data/README.rdoc
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
= Capistrano
|
2
|
+
|
3
|
+
Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH. It uses a simple DSL (borrowed in part from Rake, http://rake.rubyforge.org/) that allows you to define _tasks_, which may be applied to machines in certain roles. It also supports tunneling connections via some gateway machine to allow operations to be performed behind VPN's and firewalls.
|
4
|
+
|
5
|
+
Capistrano was originally designed to simplify and automate deployment of web applications to distributed environments, and originally came bundled with a set of tasks designed for deploying Rails applications. The deployment tasks are now (as of Capistrano 2.0) opt-in and require clients to explicitly put
|
6
|
+
"load 'deploy'" in their recipes.
|
7
|
+
|
8
|
+
== DEPENDENCIES
|
9
|
+
|
10
|
+
* Net::SSH v2 (http://net-ssh.rubyforge.org)
|
11
|
+
* Net::SFTP v2 (http://net-ssh.rubyforge.org)
|
12
|
+
* Net::SCP v1 (http://net-ssh.rubyforge.org)
|
13
|
+
* Net::SSH::Gateway v1 (http://net-ssh.rubyforge.org)
|
14
|
+
* HighLine (http://highline.rubyforge.org)
|
15
|
+
|
16
|
+
If you want to run the tests, you'll also need to have the following dependencies installed:
|
17
|
+
|
18
|
+
* Echoe (for the Rakefile)
|
19
|
+
* Mocha (http://mocha.rubyforge.org)
|
20
|
+
|
21
|
+
== ASSUMPTIONS
|
22
|
+
|
23
|
+
Capistrano is "opinionated software", which means it has very firm ideas about how things ought to be done, and tries to force those ideas on you. Some of the assumptions behind these opinions are:
|
24
|
+
|
25
|
+
* You are using SSH to access the remote servers.
|
26
|
+
* You either have the same password to all target machines, or you have public keys in place to allow passwordless access to them.
|
27
|
+
|
28
|
+
Do not expect these assumptions to change.
|
29
|
+
|
30
|
+
== USAGE
|
31
|
+
|
32
|
+
In general, you'll use Capistrano as follows:
|
33
|
+
|
34
|
+
* Create a recipe file ("capfile" or "Capfile").
|
35
|
+
* Use the +cap+ script to execute your recipe.
|
36
|
+
|
37
|
+
Use the +cap+ script as follows:
|
38
|
+
|
39
|
+
cap sometask
|
40
|
+
|
41
|
+
By default, the script will look for a file called one of +capfile+ or +Capfile+. The +someaction+ text indicates which task to execute. You can do "cap -h" to see all the available options and "cap -T" to see all the available tasks.
|
42
|
+
|
43
|
+
== LICENSE:
|
44
|
+
|
45
|
+
(The MIT License)
|
46
|
+
|
47
|
+
Copyright (c) 2005-2008 Jamis Buck <jamis@37signals.com>
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
50
|
+
a copy of this software and associated documentation files (the
|
51
|
+
'Software'), to deal in the Software without restriction, including
|
52
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
53
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
54
|
+
permit persons to whom the Software is furnished to do so, subject to
|
55
|
+
the following conditions:
|
56
|
+
|
57
|
+
The above copyright notice and this permission notice shall be
|
58
|
+
included in all copies or substantial portions of the Software.
|
59
|
+
|
60
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
61
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
62
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
63
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
64
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
65
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
66
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "./lib/capistrano/version"
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'echoe'
|
5
|
+
rescue LoadError
|
6
|
+
abort "You'll need to have `echoe' installed to use Capistrano's Rakefile"
|
7
|
+
end
|
8
|
+
|
9
|
+
version = Capistrano::Version::STRING.dup
|
10
|
+
if ENV['SNAPSHOT'].to_i == 1
|
11
|
+
version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
|
12
|
+
end
|
13
|
+
|
14
|
+
Echoe.new('capistrano', version) do |p|
|
15
|
+
p.include_gemspec = true
|
16
|
+
p.changelog = "CHANGELOG.rdoc"
|
17
|
+
|
18
|
+
p.author = "Jamis Buck"
|
19
|
+
p.email = "jamis@jamisbuck.org"
|
20
|
+
|
21
|
+
p.summary = <<-DESC.strip.gsub(/\n\s+/, " ")
|
22
|
+
Capistrano is a utility and framework for executing commands in parallel
|
23
|
+
on multiple remote machines, via SSH.
|
24
|
+
DESC
|
25
|
+
|
26
|
+
p.url = "http://www.capify.org"
|
27
|
+
p.need_zip = true
|
28
|
+
p.rdoc_pattern = /^(lib|README.rdoc|CHANGELOG.rdoc)/
|
29
|
+
|
30
|
+
p.dependencies = ["net-ssh >=2.0.10",
|
31
|
+
"net-sftp >=2.0.0",
|
32
|
+
"net-scp >=1.0.0",
|
33
|
+
"net-ssh-gateway >=1.0.0",
|
34
|
+
"highline"]
|
35
|
+
end
|
data/bin/cap
ADDED
data/bin/capify
ADDED
@@ -0,0 +1,95 @@
|
|
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
|
+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
41
|
+
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
42
|
+
load 'config/deploy'
|
43
|
+
FILE
|
44
|
+
|
45
|
+
"config/deploy.rb" => unindent(<<-FILE),
|
46
|
+
set :application, "set your application name here"
|
47
|
+
set :repository, "set your repository location here"
|
48
|
+
|
49
|
+
# If you have previously been relying upon the code to start, stop
|
50
|
+
# and restart your mongrel application, or if you rely on the database
|
51
|
+
# migration code, please uncomment the lines you require below
|
52
|
+
|
53
|
+
# load 'ext/rails/migrations'
|
54
|
+
|
55
|
+
# There are also new utility libaries shipped with the core these
|
56
|
+
# include the following, please see individual files for more
|
57
|
+
# documentation, or run `cap -T` with the following lines commented out
|
58
|
+
# to see what they make available.
|
59
|
+
|
60
|
+
# load 'ext/apache'
|
61
|
+
# load 'ext/passenger_mod_rails'
|
62
|
+
|
63
|
+
# load 'ext/web-disable-enable'
|
64
|
+
|
65
|
+
# If you aren't deploying to /u/apps/\#{application} on the target
|
66
|
+
# servers (which is the default), you can specify the actual location
|
67
|
+
# via the :deploy_to variable:
|
68
|
+
# set :deploy_to, "/var/www/\#{application}"
|
69
|
+
|
70
|
+
# If you aren't using Subversion to manage your source code, specify
|
71
|
+
# your SCM below:
|
72
|
+
# set :scm, :subversion
|
73
|
+
|
74
|
+
role :web, "your web-server here"
|
75
|
+
FILE
|
76
|
+
}
|
77
|
+
|
78
|
+
base = ARGV.shift
|
79
|
+
files.each do |file, content|
|
80
|
+
file = File.join(base, file)
|
81
|
+
if File.exists?(file)
|
82
|
+
warn "[skip] `#{file}' already exists"
|
83
|
+
elsif File.exists?(file.downcase)
|
84
|
+
warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
|
85
|
+
elsif !File.exists?(File.dirname(file))
|
86
|
+
FileUtils.mkdir(File.dirname(file))
|
87
|
+
retry
|
88
|
+
warn "[skip] directory `#{File.dirname(file)}' did not exist, created."
|
89
|
+
else
|
90
|
+
puts "[add] writing `#{file}'"
|
91
|
+
File.open(file, "w") { |f| f.write(content) }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
puts "[done] capified!"
|
data/capistrano.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{capistrano-edge}
|
3
|
+
s.version = "2.5.6"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Jamis Buck", "Lee Hambley"]
|
7
|
+
s.date = %q{2009-02-24}
|
8
|
+
s.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
|
9
|
+
s.email = %q{jamis@jamisbuck.org}
|
10
|
+
s.executables = ["cap", "capify"]
|
11
|
+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/capistrano/callback.rb", "lib/capistrano/cli/execute.rb", "lib/capistrano/cli/help.rb", "lib/capistrano/cli/help.txt", "lib/capistrano/cli/options.rb", "lib/capistrano/cli/ui.rb", "lib/capistrano/cli.rb", "lib/capistrano/command.rb", "lib/capistrano/configuration/actions/file_transfer.rb", "lib/capistrano/configuration/actions/inspect.rb", "lib/capistrano/configuration/actions/invocation.rb", "lib/capistrano/configuration/callbacks.rb", "lib/capistrano/configuration/connections.rb", "lib/capistrano/configuration/execution.rb", "lib/capistrano/configuration/loading.rb", "lib/capistrano/configuration/namespaces.rb", "lib/capistrano/configuration/roles.rb", "lib/capistrano/configuration/servers.rb", "lib/capistrano/configuration/variables.rb", "lib/capistrano/configuration.rb", "lib/capistrano/errors.rb", "lib/capistrano/extensions.rb", "lib/capistrano/logger.rb", "lib/capistrano/processable.rb", "lib/capistrano/recipes/compat.rb", "lib/capistrano/recipes/deploy/dependencies.rb", "lib/capistrano/recipes/deploy/local_dependency.rb", "lib/capistrano/recipes/deploy/remote_dependency.rb", "lib/capistrano/recipes/deploy/scm/accurev.rb", "lib/capistrano/recipes/deploy/scm/base.rb", "lib/capistrano/recipes/deploy/scm/bzr.rb", "lib/capistrano/recipes/deploy/scm/cvs.rb", "lib/capistrano/recipes/deploy/scm/darcs.rb", "lib/capistrano/recipes/deploy/scm/git.rb", "lib/capistrano/recipes/deploy/scm/mercurial.rb", "lib/capistrano/recipes/deploy/scm/none.rb", "lib/capistrano/recipes/deploy/scm/perforce.rb", "lib/capistrano/recipes/deploy/scm/subversion.rb", "lib/capistrano/recipes/deploy/scm.rb", "lib/capistrano/recipes/deploy/strategy/base.rb", "lib/capistrano/recipes/deploy/strategy/checkout.rb", "lib/capistrano/recipes/deploy/strategy/copy.rb", "lib/capistrano/recipes/deploy/strategy/export.rb", "lib/capistrano/recipes/deploy/strategy/remote.rb", "lib/capistrano/recipes/deploy/strategy/remote_cache.rb", "lib/capistrano/recipes/deploy/strategy.rb", "lib/capistrano/recipes/deploy/templates/maintenance.rhtml", "lib/capistrano/recipes/deploy.rb", "lib/capistrano/recipes/standard.rb", "lib/capistrano/recipes/templates/maintenance.rhtml", "lib/capistrano/recipes/upgrade.rb", "lib/capistrano/role.rb", "lib/capistrano/server_definition.rb", "lib/capistrano/shell.rb", "lib/capistrano/ssh.rb", "lib/capistrano/task_definition.rb", "lib/capistrano/transfer.rb", "lib/capistrano/version.rb", "lib/capistrano.rb", "README.rdoc"]
|
12
|
+
s.files = ["bin/cap", "bin/capify", "CHANGELOG.rdoc", "examples/sample.rb", "lib/capistrano/callback.rb", "lib/capistrano/cli/execute.rb", "lib/capistrano/cli/help.rb", "lib/capistrano/cli/help.txt", "lib/capistrano/cli/options.rb", "lib/capistrano/cli/ui.rb", "lib/capistrano/cli.rb", "lib/capistrano/command.rb", "lib/capistrano/configuration/actions/file_transfer.rb", "lib/capistrano/configuration/actions/inspect.rb", "lib/capistrano/configuration/actions/invocation.rb", "lib/capistrano/configuration/callbacks.rb", "lib/capistrano/configuration/connections.rb", "lib/capistrano/configuration/execution.rb", "lib/capistrano/configuration/loading.rb", "lib/capistrano/configuration/namespaces.rb", "lib/capistrano/configuration/roles.rb", "lib/capistrano/configuration/servers.rb", "lib/capistrano/configuration/variables.rb", "lib/capistrano/configuration.rb", "lib/capistrano/errors.rb",
|
13
|
+
"lib/capistrano/extensions.rb", "lib/capistrano/logger.rb", "lib/capistrano/processable.rb", "lib/capistrano/recipes/compat.rb", "lib/capistrano/recipes/deploy/dependencies.rb", "lib/capistrano/recipes/deploy/local_dependency.rb", "lib/capistrano/recipes/deploy/remote_dependency.rb", "lib/capistrano/recipes/deploy/scm/accurev.rb", "lib/capistrano/recipes/deploy/scm/base.rb", "lib/capistrano/recipes/deploy/scm/bzr.rb", "lib/capistrano/recipes/deploy/scm/cvs.rb", "lib/capistrano/recipes/deploy/scm/darcs.rb", "lib/capistrano/recipes/deploy/scm/git.rb", "lib/capistrano/recipes/deploy/scm/mercurial.rb", "lib/capistrano/recipes/deploy/scm/none.rb", "lib/capistrano/recipes/deploy/scm/perforce.rb", "lib/capistrano/recipes/deploy/scm/subversion.rb", "lib/capistrano/recipes/deploy/scm.rb", "lib/capistrano/recipes/deploy/strategy/base.rb", "lib/capistrano/recipes/deploy/strategy/checkout.rb", "lib/capistrano/recipes/deploy/strategy/copy.rb", "lib/capistrano/recipes/deploy/strategy/export.rb", "lib/capistrano/recipes/deploy/strategy/remote.rb", "lib/capistrano/recipes/deploy/strategy/remote_cache.rb", "lib/capistrano/recipes/deploy/strategy.rb", "lib/capistrano/recipes/deploy/templates/maintenance.rhtml", "lib/capistrano/recipes/deploy.rb",
|
14
|
+
"lib/capistrano/recipes/ext/rails-database-migrations.rb", "lib/capistrano/recipes/ext/web-disable-enable.rb", "lib/capistrano/recipes/standard.rb", "lib/capistrano/recipes/templates/maintenance.rhtml", "lib/capistrano/recipes/upgrade.rb", "lib/capistrano/role.rb", "lib/capistrano/server_definition.rb", "lib/capistrano/shell.rb", "lib/capistrano/ssh.rb", "lib/capistrano/task_definition.rb", "lib/capistrano/transfer.rb", "lib/capistrano/version.rb", "lib/capistrano.rb", "Rakefile", "README.rdoc", "setup.rb", "test/cli/execute_test.rb", "test/cli/help_test.rb", "test/cli/options_test.rb", "test/cli/ui_test.rb", "test/cli_test.rb", "test/command_test.rb", "test/configuration/actions/file_transfer_test.rb", "test/configuration/actions/inspect_test.rb", "test/configuration/actions/invocation_test.rb", "test/configuration/callbacks_test.rb", "test/configuration/connections_test.rb", "test/configuration/execution_test.rb", "test/configuration/loading_test.rb", "test/configuration/namespace_dsl_test.rb", "test/configuration/roles_test.rb", "test/configuration/servers_test.rb", "test/configuration/variables_test.rb", "test/configuration_test.rb", "test/deploy/local_dependency_test.rb", "test/deploy/remote_dependency_test.rb", "test/deploy/scm/accurev_test.rb", "test/deploy/scm/base_test.rb", "test/deploy/scm/git_test.rb", "test/deploy/scm/mercurial_test.rb", "test/deploy/strategy/copy_test.rb", "test/extensions_test.rb", "test/fixtures/cli_integration.rb", "test/fixtures/config.rb", "test/fixtures/custom.rb", "test/logger_test.rb", "test/role_test.rb", "test/server_definition_test.rb", "test/shell_test.rb", "test/ssh_test.rb", "test/task_definition_test.rb", "test/transfer_test.rb", "test/utils.rb", "Manifest", "capistrano.gemspec", "test/deploy/scm/none_test.rb"]
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.homepage = %q{http://www.capify.org}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Capistrano", "--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{capistrano-edge}
|
20
|
+
s.rubygems_version = %q{1.2.0}
|
21
|
+
s.summary = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
|
22
|
+
s.test_files = ["test/cli/execute_test.rb", "test/cli/help_test.rb", "test/cli/options_test.rb", "test/cli/ui_test.rb", "test/cli_test.rb", "test/command_test.rb", "test/configuration/actions/file_transfer_test.rb", "test/configuration/actions/inspect_test.rb", "test/configuration/actions/invocation_test.rb", "test/configuration/callbacks_test.rb", "test/configuration/connections_test.rb", "test/configuration/execution_test.rb", "test/configuration/loading_test.rb", "test/configuration/namespace_dsl_test.rb", "test/configuration/roles_test.rb", "test/configuration/servers_test.rb", "test/configuration/variables_test.rb", "test/configuration_test.rb", "test/deploy/local_dependency_test.rb", "test/deploy/remote_dependency_test.rb", "test/deploy/scm/accurev_test.rb", "test/deploy/scm/base_test.rb", "test/deploy/scm/git_test.rb", "test/deploy/scm/mercurial_test.rb", "test/deploy/scm/none_test.rb", "test/deploy/strategy/copy_test.rb", "test/extensions_test.rb", "test/logger_test.rb", "test/role_test.rb", "test/server_definition_test.rb", "test/shell_test.rb", "test/ssh_test.rb", "test/task_definition_test.rb", "test/transfer_test.rb"]
|
23
|
+
|
24
|
+
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
+
s.specification_version = 2
|
27
|
+
|
28
|
+
if current_version >= 3 then
|
29
|
+
s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.10"])
|
30
|
+
s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
|
31
|
+
s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
|
32
|
+
s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
|
33
|
+
s.add_runtime_dependency(%q<highline>, [">= 0"])
|
34
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
35
|
+
else
|
36
|
+
s.add_dependency(%q<net-ssh>, [">= 2.0.10"])
|
37
|
+
s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
|
38
|
+
s.add_dependency(%q<net-scp>, [">= 1.0.0"])
|
39
|
+
s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
|
40
|
+
s.add_dependency(%q<highline>, [">= 0"])
|
41
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
42
|
+
end
|
43
|
+
else
|
44
|
+
s.add_dependency(%q<net-ssh>, [">= 2.0.10"])
|
45
|
+
s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
|
46
|
+
s.add_dependency(%q<net-scp>, [">= 1.0.0"])
|
47
|
+
s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
|
48
|
+
s.add_dependency(%q<highline>, [">= 0"])
|
49
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
50
|
+
end
|
51
|
+
end
|
data/examples/sample.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# set :user, "flippy"
|
2
|
+
# set :password, "hello-flippy"
|
3
|
+
# set :gateway, "gateway.example.com"
|
4
|
+
|
5
|
+
role :web, "web1.example.com"
|
6
|
+
role :app, "app1.example.com", "app2.example.com"
|
7
|
+
|
8
|
+
desc <<-DESC
|
9
|
+
This is a sample task. It is only intended to be used as a demonstration of \
|
10
|
+
how you can define your own tasks.
|
11
|
+
DESC
|
12
|
+
task :sample_task, :roles => :app do
|
13
|
+
run "ls -l"
|
14
|
+
end
|
data/lib/capistrano.rb
ADDED
@@ -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 -r 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, but you'll often wind up duplicating logic
|
24
|
+
# defined in the CLI class. The above snippet, redone using the Configuration
|
25
|
+
# class directly, would look like:
|
26
|
+
#
|
27
|
+
# require 'capistrano'
|
28
|
+
# require 'capistrano/cli'
|
29
|
+
# config = Capistrano::Configuration.new
|
30
|
+
# config.logger_level = Capistrano::Logger::TRACE
|
31
|
+
# config.set(:password) { Capistrano::CLI.password_prompt }
|
32
|
+
# config.load "config/deploy"
|
33
|
+
# config.update_code
|
34
|
+
#
|
35
|
+
# There may be times that you want/need the additional control offered by
|
36
|
+
# manipulating the Configuration directly, but generally interfacing with
|
37
|
+
# the CLI class is recommended.
|
38
|
+
def initialize(args)
|
39
|
+
@args = args.dup
|
40
|
+
$stdout.sync = true # so that Net::SSH prompts show up
|
41
|
+
end
|
42
|
+
|
43
|
+
# Mix-in the actual behavior
|
44
|
+
include Execute, Options, UI
|
45
|
+
include Help # needs to be included last, because it overrides some methods
|
46
|
+
end
|
47
|
+
end
|