capistrano 3.12.1 → 3.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +0 -4
- data/.travis.yml +8 -6
- data/Gemfile +7 -2
- data/README.md +1 -1
- data/features/step_definitions/assertions.rb +1 -1
- data/features/support/vagrant_helpers.rb +6 -0
- data/lib/capistrano/configuration/question.rb +9 -1
- data/lib/capistrano/dsl.rb +1 -1
- data/lib/capistrano/i18n.rb +2 -0
- data/lib/capistrano/scm/git.rb +8 -4
- data/lib/capistrano/scm/tasks/git.rake +2 -1
- data/lib/capistrano/version.rb +1 -1
- data/spec/lib/capistrano/configuration/question_spec.rb +18 -0
- data/spec/lib/capistrano/scm/git_spec.rb +13 -5
- data/spec/support/test_app.rb +8 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34b4f8bf408d7e3aeeb3adcb61a44af437f1015c2206d41dae97602445411558
|
4
|
+
data.tar.gz: 99d880dedf50994b9e8ac61d43ed3ad5a7a2e11a84269a085f59bc463aff3407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07d663529584f6a0fb8b324f55cc4033eabb6812d7212e8dfc5dff4c84a2c6afd038341070811370d92bbbff5fbc93836118e3d5be949a48b47e1c7af5099cf
|
7
|
+
data.tar.gz: a0cd52b0c258c527320fec4057b98014856ebbecebfe187ac29f88f3c562843882457cfcfb33addfe2c17a4c6d0b4b3af625941812ef9bf779998cc4d1aa6cb3
|
@@ -13,14 +13,10 @@ to keep the conversation linked together.
|
|
13
13
|
- [ ] Did you run `bundle exec rubocop -a` to fix linter issues?
|
14
14
|
- [ ] If relevant, did you create a test?
|
15
15
|
- [ ] Did you confirm that the RSpec tests pass?
|
16
|
-
- [ ] If you are fixing a bug or introducing a new feature, did you add a CHANGELOG entry?
|
17
16
|
|
18
17
|
### Other Information
|
19
18
|
|
20
19
|
If there's anything else that's important and relevant to your pull
|
21
20
|
request, mention that information here.
|
22
21
|
|
23
|
-
If you are updating any of the CHANGELOG files or are asked to update the
|
24
|
-
CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file where indicated.
|
25
|
-
|
26
22
|
Thanks for helping improve Capistrano!
|
data/.travis.yml
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
3
|
+
- 3.0
|
4
|
+
- 2.7
|
5
|
+
- 2.6
|
6
|
+
- 2.5
|
7
|
+
- 2.4
|
8
|
+
- 2.3
|
7
9
|
- 2.2
|
8
10
|
- 2.1
|
9
11
|
- 2.0
|
@@ -16,8 +18,8 @@ matrix:
|
|
16
18
|
include:
|
17
19
|
- rvm: rbx-2
|
18
20
|
script: bundle exec rake spec
|
19
|
-
# Run Danger only once, on 2.5
|
20
|
-
- rvm: 2.5
|
21
|
+
# Run Danger only once, on 2.5
|
22
|
+
- rvm: 2.5
|
21
23
|
before_script: bundle exec danger
|
22
24
|
|
23
25
|
script: bundle exec rake spec rubocop
|
data/Gemfile
CHANGED
@@ -26,11 +26,16 @@ if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
|
26
26
|
gem "public_suffix", "< 3.0.0"
|
27
27
|
end
|
28
28
|
|
29
|
-
# Latest versions of i18n don't support Ruby < 2.
|
30
|
-
if Gem::Requirement.new("< 2.
|
29
|
+
# Latest versions of i18n don't support Ruby < 2.4
|
30
|
+
if Gem::Requirement.new("< 2.4").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
31
31
|
gem "i18n", "< 1.3.0"
|
32
32
|
end
|
33
33
|
|
34
|
+
# Latest versions of rake don't support Ruby < 2.2
|
35
|
+
if Gem::Requirement.new("< 2.2").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
36
|
+
gem "rake", "< 13.0.0"
|
37
|
+
end
|
38
|
+
|
34
39
|
# We only run danger once on a new-ish ruby; no need to install it otherwise
|
35
40
|
if Gem::Requirement.new("> 2.4").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
36
41
|
gem "danger"
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Then(/^references in the remote repo are listed$/) do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
Then(/^git wrapper permissions are 0700$/) do
|
8
|
-
permissions_test = %Q([ $(stat -c "%a" #{TestApp.
|
8
|
+
permissions_test = %Q([ $(stat -c "%a" #{TestApp.git_wrapper_path_glob}) == "700" ])
|
9
9
|
_stdout, _stderr, status = vagrant_cli_command("ssh -c #{permissions_test.shellescape}")
|
10
10
|
|
11
11
|
expect(status).to be_success
|
@@ -30,6 +30,12 @@ module VagrantHelpers
|
|
30
30
|
return [stdout, stderr] if status.success?
|
31
31
|
raise VagrantSSHCommandError, status
|
32
32
|
end
|
33
|
+
|
34
|
+
def puts(message)
|
35
|
+
# Attach log messages to the current cucumber feature (`log`),
|
36
|
+
# or simply puts to the console (`super`) if we are outside of cucumber.
|
37
|
+
respond_to?(:log) ? log(message) : super(message)
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
World(VagrantHelpers)
|
@@ -49,7 +49,11 @@ module Capistrano
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def question
|
52
|
-
if default.nil?
|
52
|
+
if prompt && default.nil?
|
53
|
+
I18n.t(:question_prompt, key: prompt, scope: :capistrano)
|
54
|
+
elsif prompt
|
55
|
+
I18n.t(:question_prompt_default, key: prompt, default_value: default, scope: :capistrano)
|
56
|
+
elsif default.nil?
|
53
57
|
I18n.t(:question, key: key, scope: :capistrano)
|
54
58
|
else
|
55
59
|
I18n.t(:question_default, key: key, default_value: default, scope: :capistrano)
|
@@ -63,6 +67,10 @@ module Capistrano
|
|
63
67
|
def stdin
|
64
68
|
(options || {}).fetch(:stdin, $stdin)
|
65
69
|
end
|
70
|
+
|
71
|
+
def prompt
|
72
|
+
(options || {}).fetch(:prompt, nil)
|
73
|
+
end
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
data/lib/capistrano/dsl.rb
CHANGED
data/lib/capistrano/i18n.rb
CHANGED
@@ -12,6 +12,8 @@ en = {
|
|
12
12
|
written_file: "create %{file}",
|
13
13
|
question: "Please enter %{key}: ",
|
14
14
|
question_default: "Please enter %{key} (%{default_value}): ",
|
15
|
+
question_prompt: "%{key}: ",
|
16
|
+
question_prompt_default: "%{key} (%{default_value}): ",
|
15
17
|
keeping_releases: "Keeping %{keep_releases} of %{releases} deployed releases on %{host}",
|
16
18
|
skip_cleanup: "Skipping cleanup of invalid releases on %{host}; unexpected foldername found (should be timestamp)",
|
17
19
|
wont_delete_current_release: "Current release was marked for being removed but it's going to be skipped on %{host}",
|
data/lib/capistrano/scm/git.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "capistrano/scm/plugin"
|
2
2
|
require "cgi"
|
3
|
+
require "securerandom"
|
3
4
|
require "shellwords"
|
4
5
|
require "uri"
|
5
6
|
|
@@ -7,10 +8,9 @@ class Capistrano::SCM::Git < Capistrano::SCM::Plugin
|
|
7
8
|
def set_defaults
|
8
9
|
set_if_empty :git_shallow_clone, false
|
9
10
|
set_if_empty :git_wrapper_path, lambda {
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
13
|
-
"#{fetch(:tmp_dir)}/git-ssh-#{suffix}.sh"
|
11
|
+
# Use a unique name that won't collide with other deployments, and
|
12
|
+
# that cannot be guessed by other processes that have access to /tmp.
|
13
|
+
"#{fetch(:tmp_dir)}/git-ssh-#{SecureRandom.hex(10)}.sh"
|
14
14
|
}
|
15
15
|
set_if_empty :git_environmental_variables, lambda {
|
16
16
|
{
|
@@ -60,6 +60,10 @@ class Capistrano::SCM::Git < Capistrano::SCM::Plugin
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def verify_commit
|
64
|
+
git :"verify-commit", fetch_revision
|
65
|
+
end
|
66
|
+
|
63
67
|
def archive_to_release_path
|
64
68
|
if (tree = fetch(:repo_tree))
|
65
69
|
tree = tree.slice %r#^/?(.*?)/?$#, 1
|
@@ -6,7 +6,7 @@ namespace :git do
|
|
6
6
|
task :wrapper do
|
7
7
|
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
8
8
|
execute :mkdir, "-p", File.dirname(fetch(:git_wrapper_path)).shellescape
|
9
|
-
upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), fetch(:git_wrapper_path)
|
9
|
+
upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/env ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), fetch(:git_wrapper_path)
|
10
10
|
execute :chmod, "700", fetch(:git_wrapper_path).shellescape
|
11
11
|
end
|
12
12
|
end
|
@@ -42,6 +42,7 @@ namespace :git do
|
|
42
42
|
within repo_path do
|
43
43
|
with fetch(:git_environmental_variables) do
|
44
44
|
git_plugin.update_mirror
|
45
|
+
git_plugin.verify_commit if fetch(:git_verify_commit)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
data/lib/capistrano/version.rb
CHANGED
@@ -6,6 +6,8 @@ module Capistrano
|
|
6
6
|
let(:question) { Question.new(key, default, stdin: stdin) }
|
7
7
|
let(:question_without_echo) { Question.new(key, default, echo: false, stdin: stdin) }
|
8
8
|
let(:question_without_default) { Question.new(key, nil, stdin: stdin) }
|
9
|
+
let(:question_prompt) { Question.new(key, default, stdin: stdin, prompt: "Your favorite branch") }
|
10
|
+
let(:question_prompt_without_default) { Question.new(key, nil, stdin: stdin, prompt: "Your favorite branch") }
|
9
11
|
let(:default) { :default }
|
10
12
|
let(:key) { :branch }
|
11
13
|
let(:stdin) { stub(tty?: true) }
|
@@ -43,6 +45,22 @@ module Capistrano
|
|
43
45
|
|
44
46
|
expect(question_without_default.call).to eq(branch)
|
45
47
|
end
|
48
|
+
|
49
|
+
it "uses prompt and returns the value" do
|
50
|
+
$stdout.expects(:print).with("Your favorite branch (default): ")
|
51
|
+
stdin.expects(:gets).returns(branch)
|
52
|
+
stdin.expects(:noecho).never
|
53
|
+
|
54
|
+
expect(question_prompt.call).to eq(branch)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "uses prompt and returns the value but has no default between parenthesis" do
|
58
|
+
$stdout.expects(:print).with("Your favorite branch: ")
|
59
|
+
stdin.expects(:gets).returns(branch)
|
60
|
+
stdin.expects(:noecho).never
|
61
|
+
|
62
|
+
expect(question_prompt_without_default.call).to eq(branch)
|
63
|
+
end
|
46
64
|
end
|
47
65
|
|
48
66
|
context "value is not entered" do
|
@@ -28,13 +28,10 @@ module Capistrano
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "#set_defaults" do
|
31
|
-
it "makes git_wrapper_path using
|
31
|
+
it "makes git_wrapper_path using a random hex value" do
|
32
32
|
env.set(:tmp_dir, "/tmp")
|
33
|
-
env.set(:application, "my_app")
|
34
|
-
env.set(:stage, "staging")
|
35
|
-
env.set(:local_user, "(Git Web User) via ShipIt")
|
36
33
|
subject.set_defaults
|
37
|
-
expect(env.fetch(:git_wrapper_path)).to
|
34
|
+
expect(env.fetch(:git_wrapper_path)).to match(%r{/tmp/git-ssh-\h{20}\.sh})
|
38
35
|
end
|
39
36
|
|
40
37
|
it "makes git_max_concurrent_connections" do
|
@@ -172,5 +169,16 @@ module Capistrano
|
|
172
169
|
expect(revision).to eq("81cec13b777ff46348693d327fc8e7832f79bf43")
|
173
170
|
end
|
174
171
|
end
|
172
|
+
|
173
|
+
describe "#verify_commit" do
|
174
|
+
it "should run git verify-commit" do
|
175
|
+
env.set(:branch, "branch")
|
176
|
+
|
177
|
+
backend.expects(:capture).with(:git, "rev-list --max-count=1 branch").returns("81cec13b777ff46348693d327fc8e7832f79bf43")
|
178
|
+
backend.expects(:execute).with(:git, :"verify-commit", "81cec13b777ff46348693d327fc8e7832f79bf43")
|
179
|
+
|
180
|
+
subject.verify_commit
|
181
|
+
end
|
182
|
+
end
|
175
183
|
end
|
176
184
|
end
|
data/spec/support/test_app.rb
CHANGED
@@ -185,12 +185,17 @@ module TestApp
|
|
185
185
|
FileUtils.mv(config_path, location)
|
186
186
|
end
|
187
187
|
|
188
|
-
def
|
189
|
-
"/tmp/git-ssh
|
188
|
+
def git_wrapper_path_glob
|
189
|
+
"/tmp/git-ssh-*.sh"
|
190
190
|
end
|
191
191
|
|
192
192
|
def with_clean_bundler_env(&block)
|
193
193
|
return yield unless defined?(Bundler)
|
194
|
-
|
194
|
+
|
195
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
196
|
+
Bundler.with_unbundled_env(&block)
|
197
|
+
else
|
198
|
+
Bundler.with_clean_env(&block)
|
199
|
+
end
|
195
200
|
end
|
196
201
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Clements
|
8
8
|
- Lee Hambley
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: airbrussh
|
@@ -262,7 +262,7 @@ metadata:
|
|
262
262
|
source_code_uri: https://github.com/capistrano/capistrano
|
263
263
|
homepage_uri: https://capistranorb.com/
|
264
264
|
documentation_uri: https://capistranorb.com/
|
265
|
-
post_install_message:
|
265
|
+
post_install_message:
|
266
266
|
rdoc_options: []
|
267
267
|
require_paths:
|
268
268
|
- lib
|
@@ -277,8 +277,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: '0'
|
279
279
|
requirements: []
|
280
|
-
rubygems_version: 3.
|
281
|
-
signing_key:
|
280
|
+
rubygems_version: 3.2.11
|
281
|
+
signing_key:
|
282
282
|
specification_version: 4
|
283
283
|
summary: Capistrano - Welcome to easy deployment with Ruby over SSH
|
284
284
|
test_files:
|