capistrano 2.5.13 → 2.5.18
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.
- data/{CHANGELOG.rdoc → CHANGELOG} +35 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/capistrano/cli/execute.rb +1 -0
- data/lib/capistrano/cli/options.rb +5 -1
- data/lib/capistrano/configuration/servers.rb +4 -2
- data/lib/capistrano/configuration.rb +2 -1
- data/lib/capistrano/recipes/deploy/scm/git.rb +11 -11
- data/lib/capistrano/recipes/deploy/scm/mercurial.rb +1 -1
- data/lib/capistrano/recipes/deploy/strategy/copy.rb +5 -0
- data/lib/capistrano/recipes/deploy.rb +0 -2
- data/lib/capistrano/version.rb +11 -11
- data/test/cli/execute_test.rb +2 -2
- data/test/cli/options_test.rb +12 -0
- data/test/configuration/actions/invocation_test.rb +1 -0
- data/test/configuration/servers_test.rb +30 -1
- metadata +6 -9
- data/TESTING.md +0 -16
- data/lib/capistrano/recipes/upgrade.rb +0 -33
- data/setup.rb +0 -1346
- /data/{README.rdoc → README} +0 -0
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
== 2.5.18 / March 14, 2010
|
|
2
|
+
|
|
3
|
+
Small fix for rolling back if a shell scripts exits non-zero; enabled a rollback if git (or other) externals fail during the deploy.
|
|
4
|
+
|
|
5
|
+
* #151 check return code status of system command to create local copy and rollback if not 0 (David King)
|
|
6
|
+
|
|
7
|
+
== 2.5.17 / February 27, 2010
|
|
8
|
+
|
|
9
|
+
Various small bug fixes.
|
|
10
|
+
|
|
11
|
+
== 2.5.16 / February 14, 2010
|
|
12
|
+
|
|
13
|
+
Fixed a small regression in 2.5.15
|
|
14
|
+
|
|
15
|
+
== 2.5.15 / 14 February 2010
|
|
16
|
+
|
|
17
|
+
Fixes a feature request not to overwrite roles when using the ROLES environmental variable.
|
|
18
|
+
|
|
19
|
+
* #126 - The option to not overwriting the roles which are defined in the task definition.
|
|
20
|
+
* Removed the `upgrade` file as it has been a couple of years since 1.x was in the wild.
|
|
21
|
+
* Slight internal re-factor of the way we calculate the `version`
|
|
22
|
+
|
|
23
|
+
== 2.5.14 / 18 January 2010
|
|
24
|
+
|
|
25
|
+
Fixes a low-value bug, thanks to Chris G for the well submitted patch:
|
|
26
|
+
|
|
27
|
+
* #139 - Improves consistency of variable lookup, scm variables with a local_ prefix will be honoured with priority locally (Chris Griego)
|
|
28
|
+
|
|
29
|
+
== 2.5.13 / 6 January 2010
|
|
30
|
+
|
|
31
|
+
* Small maintenance release:
|
|
32
|
+
|
|
33
|
+
* #118 - Modified CLI test to not load user or system configuration file (Emily Price)
|
|
34
|
+
* #88 - Re-fixed a problem here, massive apologies to all concerned. (Hangover from 2.5.12)
|
|
35
|
+
|
|
1
36
|
== 2.5.12 / 5 January 2010
|
|
2
37
|
|
|
3
38
|
* Tweak the directory version listing (caused a lot of problems, please upgrade immediately)
|
data/Rakefile
CHANGED
|
@@ -5,6 +5,7 @@ begin
|
|
|
5
5
|
Jeweler::Tasks.new do |gem|
|
|
6
6
|
gem.version
|
|
7
7
|
gem.name = "capistrano"
|
|
8
|
+
gem.executables = %W(capify cap)
|
|
8
9
|
gem.summary = %Q{Capistrano – Welcome to easy deployment with Ruby over SSH}
|
|
9
10
|
gem.description = %Q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
|
|
10
11
|
gem.homepage = "http://github.com/capistrano/capistrano"
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.5.
|
|
1
|
+
2.5.18
|
|
@@ -79,6 +79,10 @@ module Capistrano
|
|
|
79
79
|
"Make the output as quiet as possible."
|
|
80
80
|
) { options[:verbose] = 0 }
|
|
81
81
|
|
|
82
|
+
opts.on("-r", "--preserve-roles",
|
|
83
|
+
"Preserve task roles"
|
|
84
|
+
) { options[:preserve_roles] = true }
|
|
85
|
+
|
|
82
86
|
opts.on("-S", "--set-before NAME=VALUE",
|
|
83
87
|
"Set a variable before the recipes are loaded."
|
|
84
88
|
) do |pair|
|
|
@@ -112,7 +116,7 @@ module Capistrano
|
|
|
112
116
|
"Display the Capistrano version, and exit."
|
|
113
117
|
) do
|
|
114
118
|
require 'capistrano/version'
|
|
115
|
-
puts "Capistrano v#{Capistrano::Version
|
|
119
|
+
puts "Capistrano v#{Capistrano::Version}"
|
|
116
120
|
exit
|
|
117
121
|
end
|
|
118
122
|
|
|
@@ -48,7 +48,9 @@ module Capistrano
|
|
|
48
48
|
filter_server_list(hosts.uniq)
|
|
49
49
|
end
|
|
50
50
|
else
|
|
51
|
-
|
|
51
|
+
roles = role_list_from(ENV['ROLES'] || options[:roles] || self.roles.keys)
|
|
52
|
+
roles = roles & Array(options[:roles]) if preserve_roles && !options[:roles].nil?
|
|
53
|
+
|
|
52
54
|
only = options[:only] || {}
|
|
53
55
|
except = options[:except] || {}
|
|
54
56
|
|
|
@@ -93,4 +95,4 @@ module Capistrano
|
|
|
93
95
|
end
|
|
94
96
|
end
|
|
95
97
|
end
|
|
96
|
-
end
|
|
98
|
+
end
|
|
@@ -19,11 +19,12 @@ module Capistrano
|
|
|
19
19
|
# define roles, and set configuration variables.
|
|
20
20
|
class Configuration
|
|
21
21
|
# The logger instance defined for this configuration.
|
|
22
|
-
attr_accessor :debug, :logger, :dry_run
|
|
22
|
+
attr_accessor :debug, :logger, :dry_run, :preserve_roles
|
|
23
23
|
|
|
24
24
|
def initialize(options={}) #:nodoc:
|
|
25
25
|
@debug = false
|
|
26
26
|
@dry_run = false
|
|
27
|
+
@preserve_roles = false
|
|
27
28
|
@logger = Logger.new(options)
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -120,11 +120,11 @@ module Capistrano
|
|
|
120
120
|
# default, Git's reference of HEAD (the latest changeset in the default
|
|
121
121
|
# branch, usually called "master").
|
|
122
122
|
def head
|
|
123
|
-
|
|
123
|
+
variable(:branch) || 'HEAD'
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
def origin
|
|
127
|
-
|
|
127
|
+
variable(:remote) || 'origin'
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
# Performs a clone on the remote machine, then checkout on the branch
|
|
@@ -135,21 +135,21 @@ module Capistrano
|
|
|
135
135
|
|
|
136
136
|
args = []
|
|
137
137
|
args << "-o #{remote}" unless remote == 'origin'
|
|
138
|
-
if depth =
|
|
138
|
+
if depth = variable(:git_shallow_clone)
|
|
139
139
|
args << "--depth #{depth}"
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
execute = []
|
|
143
143
|
if args.empty?
|
|
144
|
-
execute << "#{git} clone #{verbose} #{
|
|
144
|
+
execute << "#{git} clone #{verbose} #{variable(:repository)} #{destination}"
|
|
145
145
|
else
|
|
146
|
-
execute << "#{git} clone #{verbose} #{args.join(' ')} #{
|
|
146
|
+
execute << "#{git} clone #{verbose} #{args.join(' ')} #{variable(:repository)} #{destination}"
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
# checkout into a local branch rather than a detached HEAD
|
|
150
150
|
execute << "cd #{destination} && #{git} checkout #{verbose} -b deploy #{revision}"
|
|
151
151
|
|
|
152
|
-
if
|
|
152
|
+
if variable(:git_enable_submodules)
|
|
153
153
|
execute << "#{git} submodule #{verbose} init"
|
|
154
154
|
execute << "#{git} submodule #{verbose} sync"
|
|
155
155
|
execute << "#{git} submodule #{verbose} update"
|
|
@@ -180,14 +180,14 @@ module Capistrano
|
|
|
180
180
|
# changes between calls, but as long as the repositories are all
|
|
181
181
|
# based from each other it should still work fine.
|
|
182
182
|
if remote != 'origin'
|
|
183
|
-
execute << "#{git} config remote.#{remote}.url #{
|
|
183
|
+
execute << "#{git} config remote.#{remote}.url #{variable(:repository)}"
|
|
184
184
|
execute << "#{git} config remote.#{remote}.fetch +refs/heads/*:refs/remotes/#{remote}/*"
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
# since we're in a local branch already, just reset to specified revision rather than merge
|
|
188
188
|
execute << "#{git} fetch #{verbose} #{remote} && #{git} reset #{verbose} --hard #{revision}"
|
|
189
189
|
|
|
190
|
-
if
|
|
190
|
+
if variable(:git_enable_submodules)
|
|
191
191
|
execute << "#{git} submodule #{verbose} init"
|
|
192
192
|
execute << "for mod in `#{git} submodule status | awk '{ print $2 }'`; do #{git} config -f .git/config submodule.${mod}.url `#{git} config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done"
|
|
193
193
|
execute << "#{git} submodule #{verbose} sync"
|
|
@@ -234,7 +234,7 @@ module Capistrano
|
|
|
234
234
|
|
|
235
235
|
def command
|
|
236
236
|
# For backwards compatibility with 1.x version of this module
|
|
237
|
-
|
|
237
|
+
variable(:git) || super
|
|
238
238
|
end
|
|
239
239
|
|
|
240
240
|
# Determines what the response should be for a particular bit of text
|
|
@@ -246,7 +246,7 @@ module Capistrano
|
|
|
246
246
|
case text
|
|
247
247
|
when /\bpassword.*:/i
|
|
248
248
|
# git is prompting for a password
|
|
249
|
-
unless pass =
|
|
249
|
+
unless pass = variable(:scm_password)
|
|
250
250
|
pass = Capistrano::CLI.password_prompt
|
|
251
251
|
end
|
|
252
252
|
"#{pass}\n"
|
|
@@ -255,7 +255,7 @@ module Capistrano
|
|
|
255
255
|
"yes\n"
|
|
256
256
|
when /passphrase/i
|
|
257
257
|
# git is asking for the passphrase for the user's key
|
|
258
|
-
unless pass =
|
|
258
|
+
unless pass = variable(:scm_passphrase)
|
|
259
259
|
pass = Capistrano::CLI.password_prompt
|
|
260
260
|
end
|
|
261
261
|
"#{pass}\n"
|
|
@@ -18,7 +18,7 @@ module Capistrano
|
|
|
18
18
|
# For mercurial HEAD == tip except that it bases this assumption on what
|
|
19
19
|
# tip is in the current repository (so push before you deploy)
|
|
20
20
|
def head
|
|
21
|
-
|
|
21
|
+
variable(:branch) || "tip"
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Clone the repository and update to the specified changeset.
|
|
@@ -53,6 +53,11 @@ module Capistrano
|
|
|
53
53
|
system(source.checkout(revision, copy_cache))
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
# Check the return code of last system command and rollback if not 0
|
|
57
|
+
unless $? == 0
|
|
58
|
+
raise Capistrano::Error, "shell command failed with return code #{$?}"
|
|
59
|
+
end
|
|
60
|
+
|
|
56
61
|
logger.debug "copying cache to deployment staging area #{destination}"
|
|
57
62
|
Dir.chdir(copy_cache) do
|
|
58
63
|
FileUtils.mkdir_p(destination)
|
|
@@ -51,8 +51,6 @@ _cset(:shared_path) { File.join(deploy_to, shared_dir) }
|
|
|
51
51
|
_cset(:current_path) { File.join(deploy_to, current_dir) }
|
|
52
52
|
_cset(:release_path) { File.join(releases_path, release_name) }
|
|
53
53
|
|
|
54
|
-
# re: https://capistrano.lighthouseapp.com/projects/8716/tickets/88-getting-the-newest-directory
|
|
55
|
-
# remove system inconsistencies with ls and let ruby sort the releases
|
|
56
54
|
_cset(:releases) { capture("ls -x #{releases_path}").split.sort }
|
|
57
55
|
_cset(:current_release) { File.join(releases_path, releases.last) }
|
|
58
56
|
_cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
|
data/lib/capistrano/version.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
require '
|
|
2
|
-
|
|
1
|
+
require 'scanf'
|
|
3
2
|
module Capistrano
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
TINY
|
|
4
|
+
class Version
|
|
5
|
+
|
|
6
|
+
CURRENT = File.read(File.dirname(__FILE__) + '/../../VERSION')
|
|
7
|
+
|
|
8
|
+
MAJOR, MINOR, TINY = CURRENT.scanf('%d.%d.%d')
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
CURRENT = new(MAJOR, MINOR, TINY)
|
|
10
|
+
STRING = CURRENT.to_s
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
def self.to_s
|
|
13
|
+
CURRENT
|
|
14
|
+
end
|
|
15
|
+
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
end
|
data/test/cli/execute_test.rb
CHANGED
|
@@ -15,7 +15,7 @@ class CLIExecuteTest < Test::Unit::TestCase
|
|
|
15
15
|
def setup
|
|
16
16
|
@cli = MockCLI.new
|
|
17
17
|
@logger = stub_everything
|
|
18
|
-
@config = stub(:logger => @logger, :debug= => nil, :dry_run= => nil)
|
|
18
|
+
@config = stub(:logger => @logger, :debug= => nil, :dry_run= => nil, :preserve_roles= => nil)
|
|
19
19
|
@config.stubs(:set)
|
|
20
20
|
@config.stubs(:load)
|
|
21
21
|
@config.stubs(:trigger)
|
|
@@ -129,4 +129,4 @@ class CLIExecuteTest < Test::Unit::TestCase
|
|
|
129
129
|
MockCLI.expects(:parse).with(ARGV).returns(cli)
|
|
130
130
|
MockCLI.execute
|
|
131
131
|
end
|
|
132
|
-
end
|
|
132
|
+
end
|
data/test/cli/options_test.rb
CHANGED
|
@@ -93,6 +93,18 @@ class CLIOptionsTest < Test::Unit::TestCase
|
|
|
93
93
|
assert_equal 0, @cli.options[:verbose]
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
def test_parse_options_with_r_should_set_preserve_roles_option
|
|
97
|
+
@cli.args << "-r"
|
|
98
|
+
@cli.parse_options!
|
|
99
|
+
assert @cli.options[:preserve_roles]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def test_parse_options_with_preserve_roles_should_set_preserve_roles_option
|
|
103
|
+
@cli.args << "--preserve-roles"
|
|
104
|
+
@cli.parse_options!
|
|
105
|
+
assert @cli.options[:preserve_roles]
|
|
106
|
+
end
|
|
107
|
+
|
|
96
108
|
def test_parse_options_with_S_should_set_pre_vars
|
|
97
109
|
@cli.args << "-S" << "foo=bar"
|
|
98
110
|
@cli.parse_options!
|
|
@@ -5,9 +5,11 @@ require 'capistrano/configuration/servers'
|
|
|
5
5
|
class ConfigurationServersTest < Test::Unit::TestCase
|
|
6
6
|
class MockConfig
|
|
7
7
|
attr_reader :roles
|
|
8
|
+
attr_accessor :preserve_roles
|
|
8
9
|
|
|
9
10
|
def initialize
|
|
10
11
|
@roles = {}
|
|
12
|
+
@preserve_roles = false
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
include Capistrano::Configuration::Servers
|
|
@@ -62,6 +64,33 @@ class ConfigurationServersTest < Test::Unit::TestCase
|
|
|
62
64
|
ENV.delete('ROLES')
|
|
63
65
|
end
|
|
64
66
|
|
|
67
|
+
def test_task_with_roles_as_environment_variable_and_preserve_roles_should_apply_only_to_existant_task_role
|
|
68
|
+
ENV['ROLES'] = "app,file"
|
|
69
|
+
@config.preserve_roles = true
|
|
70
|
+
task = new_task(:testing,@config, :roles => :app)
|
|
71
|
+
assert_equal %w(app1 app2 app3).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
|
72
|
+
ensure
|
|
73
|
+
ENV.delete('ROLES')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_task_with_roles_as_environment_variable_and_preserve_roles_should_apply_only_to_existant_task_roles
|
|
77
|
+
ENV['ROLES'] = "app,file,web"
|
|
78
|
+
@config.preserve_roles = true
|
|
79
|
+
task = new_task(:testing,@config, :roles => [ :app,:file ])
|
|
80
|
+
assert_equal %w(app1 app2 app3 file).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
|
81
|
+
ensure
|
|
82
|
+
ENV.delete('ROLES')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_task_with_roles_as_environment_variable_and_preserve_roles_should_not_apply_if_not_exists_those_task_roles
|
|
86
|
+
ENV['ROLES'] = "file,web"
|
|
87
|
+
@config.preserve_roles = true
|
|
88
|
+
task = new_task(:testing,@config, :roles => [ :app ])
|
|
89
|
+
assert_equal [], @config.find_servers_for_task(task).map { |s| s.host }.sort
|
|
90
|
+
ensure
|
|
91
|
+
ENV.delete('ROLES')
|
|
92
|
+
end
|
|
93
|
+
|
|
65
94
|
def test_task_with_hosts_as_environment_variable_should_apply_only_to_those_hosts
|
|
66
95
|
ENV['HOSTS'] = "foo,bar"
|
|
67
96
|
task = new_task(:testing)
|
|
@@ -126,4 +155,4 @@ class ConfigurationServersTest < Test::Unit::TestCase
|
|
|
126
155
|
assert_equal %w(app1 app2 app3), @config.find_servers(:roles => lambda { :app }).map { |s| s.host }.sort
|
|
127
156
|
assert_equal %w(app2 file), @config.find_servers(:roles => lambda { [:report, :file] }).map { |s| s.host }.sort
|
|
128
157
|
end
|
|
129
|
-
end
|
|
158
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.
|
|
4
|
+
version: 2.5.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamis Buck
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2010-
|
|
13
|
+
date: 2010-03-14 00:00:00 +01:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -78,18 +78,17 @@ email:
|
|
|
78
78
|
- jamis@jamisbuck.org
|
|
79
79
|
- lee.hambley@gmail.com
|
|
80
80
|
executables:
|
|
81
|
-
- cap
|
|
82
81
|
- capify
|
|
82
|
+
- cap
|
|
83
83
|
extensions: []
|
|
84
84
|
|
|
85
85
|
extra_rdoc_files:
|
|
86
|
-
- README
|
|
86
|
+
- README
|
|
87
87
|
files:
|
|
88
88
|
- .gitignore
|
|
89
|
-
- CHANGELOG
|
|
90
|
-
- README
|
|
89
|
+
- CHANGELOG
|
|
90
|
+
- README
|
|
91
91
|
- Rakefile
|
|
92
|
-
- TESTING.md
|
|
93
92
|
- VERSION
|
|
94
93
|
- bin/cap
|
|
95
94
|
- bin/capify
|
|
@@ -144,7 +143,6 @@ files:
|
|
|
144
143
|
- lib/capistrano/recipes/deploy/templates/maintenance.rhtml
|
|
145
144
|
- lib/capistrano/recipes/standard.rb
|
|
146
145
|
- lib/capistrano/recipes/templates/maintenance.rhtml
|
|
147
|
-
- lib/capistrano/recipes/upgrade.rb
|
|
148
146
|
- lib/capistrano/role.rb
|
|
149
147
|
- lib/capistrano/server_definition.rb
|
|
150
148
|
- lib/capistrano/shell.rb
|
|
@@ -152,7 +150,6 @@ files:
|
|
|
152
150
|
- lib/capistrano/task_definition.rb
|
|
153
151
|
- lib/capistrano/transfer.rb
|
|
154
152
|
- lib/capistrano/version.rb
|
|
155
|
-
- setup.rb
|
|
156
153
|
- test/cli/execute_test.rb
|
|
157
154
|
- test/cli/help_test.rb
|
|
158
155
|
- test/cli/options_test.rb
|
data/TESTING.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
Testing Capistrano
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
1. Install the Following Gem Dependencies
|
|
5
|
-
|
|
6
|
-
`# gem install mocha echoe`
|
|
7
|
-
|
|
8
|
-
2. Run the following
|
|
9
|
-
|
|
10
|
-
`$ rake test`
|
|
11
|
-
|
|
12
|
-
3. Output Should Resemble
|
|
13
|
-
|
|
14
|
-
`Finished in 0.859017 seconds.`
|
|
15
|
-
`523 tests, 1271 assertions, 0 failures, 0 errors`
|
|
16
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Tasks to aid the migration of an established Capistrano 1.x installation to
|
|
2
|
-
# Capistrano 2.x.
|
|
3
|
-
|
|
4
|
-
namespace :upgrade do
|
|
5
|
-
desc <<-DESC
|
|
6
|
-
Migrate from the revisions log to REVISION. Capistrano 1.x recorded each \
|
|
7
|
-
deployment to a revisions.log file. Capistrano 2.x is cleaner, and just \
|
|
8
|
-
puts a REVISION file in the root of the deployed revision. This task \
|
|
9
|
-
migrates from the revisions.log used in Capistrano 1.x, to the REVISION \
|
|
10
|
-
tag file used in Capistrano 2.x. It is non-destructive and may be safely \
|
|
11
|
-
run any number of times.
|
|
12
|
-
DESC
|
|
13
|
-
task :revisions, :except => { :no_release => true } do
|
|
14
|
-
revisions = capture("cat #{deploy_to}/revisions.log")
|
|
15
|
-
|
|
16
|
-
mapping = {}
|
|
17
|
-
revisions.each do |line|
|
|
18
|
-
revision, directory = line.chomp.split[-2,2]
|
|
19
|
-
mapping[directory] = revision
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
commands = mapping.keys.map do |directory|
|
|
23
|
-
"echo '.'; test -d #{directory} && echo '#{mapping[directory]}' > #{directory}/REVISION"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
command = commands.join(";")
|
|
27
|
-
|
|
28
|
-
run "cd #{releases_path}; #{command}; true" do |ch, stream, out|
|
|
29
|
-
STDOUT.print(".")
|
|
30
|
-
STDOUT.flush
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|