capistrano 2.15.4 → 2.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/lib/capistrano/configuration/loading.rb +8 -0
- data/lib/capistrano/ext/multistage.rb +8 -3
- data/lib/capistrano/recipes/deploy/assets.rb +2 -2
- data/lib/capistrano/recipes/deploy/scm/cvs.rb +1 -1
- data/lib/capistrano/recipes/deploy/scm/git.rb +3 -3
- data/lib/capistrano/recipes/deploy/scm/mercurial.rb +2 -2
- data/lib/capistrano/recipes/deploy/scm/subversion.rb +4 -4
- data/lib/capistrano/version.rb +1 -1
- data/test/configuration/loading_test.rb +16 -0
- data/test/deploy/scm/git_test.rb +53 -0
- data/test/deploy/scm/mercurial_test.rb +4 -4
- data/test/deploy/scm/subversion_test.rb +28 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6d390cc4fc2f8e025b2aba4fa2c287e36c999ed
|
4
|
+
data.tar.gz: 04a65a40859de8159af366edc9b73248a28cdca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebf02e5b3c3bd832ca9c67f8c9cae56cbaf424ef6797d43d611604db68088c43b79f7577e9887b7960984f328162390c566ed38c479754a877fb955b3325a86f
|
7
|
+
data.tar.gz: 43ad8672fb85662636eb379a98987fe32bf0ff72af01d5718b6d303eb95335277aabdbfc058f62b6f249973cd1d97a53a66bcca56029847a837179e3f2466222
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 2.15.5 / July 4 2013
|
2
|
+
|
3
|
+
* Fix multistage argument parsing when using the `-s` option. (@jmazzi)
|
4
|
+
* Tweaks to the asset recipes. (@curtislinden)
|
5
|
+
* Use quotes around SCM usernames and passwords (@carloslopes)
|
6
|
+
* Avoid git warning when cloning Git repository using sha1 (@bpaquet)
|
7
|
+
|
1
8
|
## 2.15.4 / April 29 2013
|
2
9
|
|
3
10
|
* Fix parallel command logging (@gnufied)
|
@@ -163,6 +163,14 @@ module Capistrano
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
def file_in_load_path?(file)
|
167
|
+
begin
|
168
|
+
!!find_file_in_load_path(file)
|
169
|
+
rescue LoadError
|
170
|
+
false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
166
174
|
private
|
167
175
|
|
168
176
|
# Load a recipe from the named file. If +name+ is given, the file will
|
@@ -15,14 +15,19 @@ Capistrano::Configuration.instance.load do
|
|
15
15
|
desc "Set the target stage to `#{name}'."
|
16
16
|
task(name) do
|
17
17
|
set :stage, name.to_sym
|
18
|
-
|
18
|
+
|
19
|
+
file = "#{location}/#{stage}"
|
20
|
+
load file if file_in_load_path?(file)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
24
|
on :load do
|
23
|
-
|
25
|
+
# The first non option argument
|
26
|
+
env = ARGV.detect { |a| a.to_s !~ /\A-/ && a.to_s !~ /=/ }
|
27
|
+
|
28
|
+
if stages.include?(env)
|
24
29
|
# Execute the specified stage so that recipes required in stage can contribute to task list
|
25
|
-
find_and_execute_task(
|
30
|
+
find_and_execute_task(env) if ARGV.any?{ |option| option =~ /-T|--tasks|-e|--explain/ }
|
26
31
|
else
|
27
32
|
# Execute the default stage so that recipes required in stage can contribute tasks
|
28
33
|
find_and_execute_task(default_stage) if exists?(:default_stage)
|
@@ -60,8 +60,8 @@ namespace :deploy do
|
|
60
60
|
DESC
|
61
61
|
task :precompile, :roles => lambda { assets_role }, :except => { :no_release => true } do
|
62
62
|
run <<-CMD.compact
|
63
|
-
cd -- #{latest_release} &&
|
64
|
-
|
63
|
+
cd -- #{latest_release} &&
|
64
|
+
RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} #{rake} assets:precompile
|
65
65
|
CMD
|
66
66
|
|
67
67
|
if capture("ls -1 #{shared_path.shellescape}/#{shared_assets_prefix}/manifest* | wc -l").to_i > 1
|
@@ -84,7 +84,7 @@ module Capistrano
|
|
84
84
|
case text
|
85
85
|
when /\bpassword.*:/i
|
86
86
|
# prompting for a password
|
87
|
-
"#{variable(:scm_password) || variable(:password)}\n
|
87
|
+
%("#{variable(:scm_password) || variable(:password)}"\n)
|
88
88
|
when %r{\(yes/no\)}
|
89
89
|
# let's be agreeable...
|
90
90
|
"yes\n"
|
@@ -136,7 +136,7 @@ module Capistrano
|
|
136
136
|
args = []
|
137
137
|
|
138
138
|
# Add an option for the branch name so :git_shallow_clone works with branches
|
139
|
-
args << "-b #{variable(:branch)}" unless variable(:branch).nil?
|
139
|
+
args << "-b #{variable(:branch)}" unless variable(:branch).nil? || variable(:branch) == revision
|
140
140
|
args << "-o #{remote}" unless remote == 'origin'
|
141
141
|
if depth = variable(:git_shallow_clone)
|
142
142
|
args << "--depth #{depth}"
|
@@ -263,7 +263,7 @@ module Capistrano
|
|
263
263
|
unless pass = variable(:scm_password)
|
264
264
|
pass = Capistrano::CLI.password_prompt
|
265
265
|
end
|
266
|
-
"#{pass}\n
|
266
|
+
%("#{pass}"\n)
|
267
267
|
when %r{\(yes/no\)}
|
268
268
|
# git is asking whether or not to connect
|
269
269
|
"yes\n"
|
@@ -272,7 +272,7 @@ module Capistrano
|
|
272
272
|
unless pass = variable(:scm_passphrase)
|
273
273
|
pass = Capistrano::CLI.password_prompt
|
274
274
|
end
|
275
|
-
"#{pass}\n
|
275
|
+
%("#{pass}"\n)
|
276
276
|
when /accept \(t\)emporarily/
|
277
277
|
# git is asking whether to accept the certificate
|
278
278
|
"t\n"
|
@@ -73,7 +73,7 @@ module Capistrano
|
|
73
73
|
when /^user:/mi
|
74
74
|
# support :scm_user for backwards compatibility of this module
|
75
75
|
if user = variable(:scm_username) || variable(:scm_user)
|
76
|
-
"#{user}\n
|
76
|
+
%("#{user}"\n)
|
77
77
|
else
|
78
78
|
raise "No variable :scm_username specified and Mercurial asked!\n" +
|
79
79
|
"Prompt was: #{text}"
|
@@ -84,7 +84,7 @@ module Capistrano
|
|
84
84
|
raise "No variable :scm_password specified and Mercurial asked!\n" +
|
85
85
|
"Prompt was: #{text}"
|
86
86
|
end
|
87
|
-
"#{pass}\n
|
87
|
+
%("#{pass}"\n)
|
88
88
|
when /yes\/no/i
|
89
89
|
"yes\n"
|
90
90
|
end
|
@@ -73,13 +73,13 @@ module Capistrano
|
|
73
73
|
case text
|
74
74
|
when /\bpassword.*:/i
|
75
75
|
# subversion is prompting for a password
|
76
|
-
"#{scm_password_prompt}\n
|
76
|
+
%("#{scm_password_prompt}"\n)
|
77
77
|
when %r{\(yes/no\)}
|
78
78
|
# subversion is asking whether or not to connect
|
79
79
|
"yes\n"
|
80
80
|
when /passphrase/i
|
81
81
|
# subversion is asking for the passphrase for the user's key
|
82
|
-
"#{variable(:scm_passphrase)}\n
|
82
|
+
%("#{variable(:scm_passphrase)}"\n)
|
83
83
|
when /The entry \'(.+?)\' is no longer a directory/
|
84
84
|
raise Capistrano::Error, "subversion can't update because directory '#{$1}' was replaced. Please add it to svn:ignore."
|
85
85
|
when /accept \(t\)emporarily/
|
@@ -97,8 +97,8 @@ module Capistrano
|
|
97
97
|
def authentication
|
98
98
|
username = variable(:scm_username)
|
99
99
|
return "" unless username
|
100
|
-
result =
|
101
|
-
result <<
|
100
|
+
result = %(--username "#{variable(:scm_username)}")
|
101
|
+
result << %(--password "#{variable(:scm_password)}") unless variable(:scm_auth_cache) || variable(:scm_prefer_prompt)
|
102
102
|
result << "--no-auth-cache " unless variable(:scm_auth_cache)
|
103
103
|
result
|
104
104
|
end
|
data/lib/capistrano/version.rb
CHANGED
@@ -129,4 +129,20 @@ class ConfigurationLoadingTest < Test::Unit::TestCase
|
|
129
129
|
assert_equal :custom, @config.ping
|
130
130
|
assert_equal :custom, config2.ping
|
131
131
|
end
|
132
|
+
|
133
|
+
def test_file_in_load_path_returns_true_when_file_is_in_load_path
|
134
|
+
File.stubs(:file?).returns(false)
|
135
|
+
File.stubs(:file?).with("custom/path/for/file.rb").returns(true)
|
136
|
+
|
137
|
+
@config.load_paths << "custom/path/for"
|
138
|
+
assert_equal true, @config.file_in_load_path?("file")
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_file_in_load_path_returns_false_when_file_is_not_in_load_path
|
142
|
+
File.stubs(:file?).returns(false)
|
143
|
+
File.stubs(:file?).with("custom/path/for/file.rb").returns(false)
|
144
|
+
|
145
|
+
@config.load_paths << "custom/path/for"
|
146
|
+
assert_equal false, @config.file_in_load_path?("file")
|
147
|
+
end
|
132
148
|
end
|
data/test/deploy/scm/git_test.rb
CHANGED
@@ -43,6 +43,21 @@ class DeploySCMGitTest < Test::Unit::TestCase
|
|
43
43
|
assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev} && #{git} submodule -q init && #{git} submodule -q sync && export GIT_RECURSIVE=$([ ! \"`#{git} --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && #{git} submodule -q update --init $GIT_RECURSIVE", @source.checkout(rev, dest).gsub(/\s+/, ' ')
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_checkout_branching
|
47
|
+
@config[:repository] = "git@somehost.com:project.git"
|
48
|
+
dest = "/var/www"
|
49
|
+
rev = 'c2d9e79'
|
50
|
+
assert_equal "git clone -q git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy c2d9e79", @source.checkout(rev, dest)
|
51
|
+
|
52
|
+
# with :branch
|
53
|
+
@config[:branch] = "master"
|
54
|
+
assert_equal "git clone -q -b master git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy c2d9e79", @source.checkout(rev, dest)
|
55
|
+
|
56
|
+
# with :branch with hash code
|
57
|
+
@config[:branch] = "c2d9e79"
|
58
|
+
assert_equal "git clone -q git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy c2d9e79", @source.checkout(rev, dest)
|
59
|
+
end
|
60
|
+
|
46
61
|
def test_checkout_submodules_without_recursive
|
47
62
|
@config[:repository] = "git@somehost.com:project.git"
|
48
63
|
dest = "/var/www"
|
@@ -217,5 +232,43 @@ class DeploySCMGitTest < Test::Unit::TestCase
|
|
217
232
|
assert_equal "git", @source.local.command
|
218
233
|
assert_equal "/foo/bar/git", @source.command
|
219
234
|
end
|
235
|
+
|
236
|
+
def test_sends_password_if_set
|
237
|
+
require 'capistrano/logger'
|
238
|
+
text = "password:"
|
239
|
+
@config[:scm_password] = "opensesame"
|
240
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_prompt_password
|
244
|
+
require 'capistrano/logger'
|
245
|
+
require 'capistrano/cli'
|
246
|
+
Capistrano::CLI.stubs(:password_prompt).returns("opensesame")
|
247
|
+
|
248
|
+
text = 'password:'
|
249
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_sends_passphrase_if_set
|
253
|
+
require 'capistrano/logger'
|
254
|
+
text = "passphrase:"
|
255
|
+
@config[:scm_passphrase] = "opensesame"
|
256
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_prompt_passphrase
|
260
|
+
require 'capistrano/logger'
|
261
|
+
require 'capistrano/cli'
|
262
|
+
Capistrano::CLI.stubs(:password_prompt).returns("opensesame")
|
263
|
+
|
264
|
+
text = 'passphrase:'
|
265
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
266
|
+
end
|
267
|
+
|
268
|
+
private
|
269
|
+
|
270
|
+
def mock_state
|
271
|
+
{ :channel => { :host => "abc" } }
|
272
|
+
end
|
220
273
|
end
|
221
274
|
|
@@ -48,10 +48,10 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
|
|
48
48
|
require 'capistrano/logger'
|
49
49
|
@config[:scm_user] = "fred"
|
50
50
|
text = "user:"
|
51
|
-
assert_equal "fred\n
|
51
|
+
assert_equal %("fred"\n), @source.handle_data(mock_state, :test_stream, text)
|
52
52
|
# :scm_username takes priority
|
53
53
|
@config[:scm_username] = "wilma"
|
54
|
-
assert_equal "wilma\n
|
54
|
+
assert_equal %("wilma"\n), @source.handle_data(mock_state, :test_stream, text)
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_sync
|
@@ -72,7 +72,7 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
|
|
72
72
|
require 'capistrano/logger'
|
73
73
|
text = "password:"
|
74
74
|
@config[:scm_password] = "opensesame"
|
75
|
-
assert_equal "opensesame\n
|
75
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_prompts_for_password_if_preferred
|
@@ -81,7 +81,7 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
|
|
81
81
|
Capistrano::CLI.stubs(:password_prompt).with("hg password: ").returns("opensesame")
|
82
82
|
@config[:scm_prefer_prompt] = true
|
83
83
|
text = "password:"
|
84
|
-
assert_equal "opensesame\n
|
84
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
85
85
|
end
|
86
86
|
|
87
87
|
|
@@ -37,4 +37,32 @@ Last Changed Date: 2009-03-11 11:04:25 -0700 (Wed, 11 Mar 2009)
|
|
37
37
|
assert_equal "svn switch -q -r602 http://svn.github.com/capistrano/capistrano.git /var/www", @source.sync(rev, dest)
|
38
38
|
end
|
39
39
|
|
40
|
+
def test_sends_password_if_set
|
41
|
+
require 'capistrano/logger'
|
42
|
+
text = "password:"
|
43
|
+
@config[:scm_password] = "opensesame"
|
44
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_prompt_password
|
48
|
+
require 'capistrano/logger'
|
49
|
+
require 'capistrano/cli'
|
50
|
+
Capistrano::CLI.stubs(:password_prompt).returns("opensesame")
|
51
|
+
|
52
|
+
text = 'password:'
|
53
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_sends_passphrase
|
57
|
+
require 'capistrano/logger'
|
58
|
+
text = 'passphrase:'
|
59
|
+
@config[:scm_passphrase] = "opensesame"
|
60
|
+
assert_equal %("opensesame"\n), @source.handle_data(mock_state, :test_stream, text)
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def mock_state
|
66
|
+
{ :channel => { :host => "abc" } }
|
67
|
+
end
|
40
68
|
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.15.
|
4
|
+
version: 2.15.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04
|
12
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|