capistrano 3.12.0 → 3.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bdccda71ba34b51e461d1f881566594d87811e392faaf5b24b0832f28e22afe
4
- data.tar.gz: 8846c459f2962435d7e5c2738004bc8f2fe19704746be6b1d4a2b5e2dcedfcca
3
+ metadata.gz: 3f0b8e22a26ba92d6cf7d062d7b1fd2571add774ff9522a8282080e25e0c885a
4
+ data.tar.gz: 822a124b873390bd677370e4194103c94e756e0422feb1de5f3bdd0553a85315
5
5
  SHA512:
6
- metadata.gz: 31c2370fd55c3add4f3d28b0c16baabc09bd6b011b3d2bda973a7a7b55066944a68e9d195782f1e74828f365a09457e5366a98e32e2f7fae1503c5f5c51a89ca
7
- data.tar.gz: ac0c93210f217c1fb48d15215a483cd7a0c7e26cacfe0d8ac8cb904acfc9f987ec2ceb0306e07a59bf5a2886fbefcadaa00a0010f9f9f46eb75160e39d8a3b20
6
+ metadata.gz: fa22266dc215f03041ba72b0b36a2dc88df951fea9426912c2aa34f8683daa622f0acffeb801768ed0cc82571eeebfd9bce11e0f6708b997f44d446d10d53ba4
7
+ data.tar.gz: 338e679cf1601854f6d5f2f692693550fbd7d46d94add967df47770f830926bf55c170e09b748076b330f53f305be1dec990139c49b8a0a4c43527e573d9a9da
@@ -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!
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.6.3
4
- - 2.5.5
5
- - 2.4.6
6
- - 2.3.8
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.3
20
- - rvm: 2.5.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.1
30
- if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
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
@@ -107,7 +107,7 @@ Add Capistrano to your project's Gemfile using `require: false`:
107
107
 
108
108
  ``` ruby
109
109
  group :development do
110
- gem "capistrano", "~> 3.12", require: false
110
+ gem "capistrano", "~> 3.14", require: false
111
111
  end
112
112
  ```
113
113
 
@@ -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.git_wrapper_path.shellescape}) == "700" ])
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
@@ -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
@@ -33,7 +33,7 @@ module Capistrano
33
33
  end
34
34
 
35
35
  def t(key, options={})
36
- I18n.t(key, options.merge(scope: :capistrano))
36
+ I18n.t(key, **options.merge(scope: :capistrano))
37
37
  end
38
38
 
39
39
  def scm
@@ -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}",
@@ -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
- # Try to avoid permissions issues when multiple users deploy the same app
11
- # by using different file names in the same dir for each deployer and stage.
12
- suffix = %i(application stage local_user).map { |key| fetch(key).to_s }.join("-")
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
  {
@@ -19,7 +19,7 @@ class Capistrano::SCM::Git < Capistrano::SCM::Plugin
19
19
  }
20
20
  }
21
21
  set_if_empty :git_max_concurrent_connections, 10
22
- set_if_empty :git_wait_interval, 3
22
+ set_if_empty :git_wait_interval, 0
23
23
  end
24
24
 
25
25
  def register_hooks
@@ -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,7 +42,7 @@
42
42
  # Global options
43
43
  # --------------
44
44
  # set :ssh_options, {
45
- # keys: %w(/home/rlisowski/.ssh/id_rsa),
45
+ # keys: %w(/home/user_name/.ssh/id_rsa),
46
46
  # forward_agent: false,
47
47
  # auth_methods: %w(password)
48
48
  # }
@@ -1,3 +1,3 @@
1
1
  module Capistrano
2
- VERSION = "3.12.0".freeze
2
+ VERSION = "3.15.0".freeze
3
3
  end
@@ -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 application, stage, and local_user" do
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 eq("/tmp/git-ssh-my_app-staging-(Git Web User) via ShipIt.sh")
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
@@ -46,7 +43,7 @@ module Capistrano
46
43
 
47
44
  it "makes git_wait_interval" do
48
45
  subject.set_defaults
49
- expect(env.fetch(:git_wait_interval)).to eq(3)
46
+ expect(env.fetch(:git_wait_interval)).to eq(0)
50
47
  env.set(:git_wait_interval, 5)
51
48
  expect(env.fetch(:git_wait_interval)).to eq(5)
52
49
  end
@@ -185,12 +185,17 @@ module TestApp
185
185
  FileUtils.mv(config_path, location)
186
186
  end
187
187
 
188
- def git_wrapper_path
189
- "/tmp/git-ssh-my_app_name-#{stage}-#{current_user}.sh"
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
- Bundler.with_clean_env(&block)
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.12.0
4
+ version: 3.15.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: 2020-02-11 00:00:00.000000000 Z
12
+ date: 2021-01-05 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.1.2
281
- signing_key:
280
+ rubygems_version: 3.2.4
281
+ signing_key:
282
282
  specification_version: 4
283
283
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH
284
284
  test_files: