capistrano 3.11.0 → 3.16.0

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +0 -4
  3. data/.github/release-drafter.yml +17 -0
  4. data/.github/workflows/push.yml +12 -0
  5. data/.rubocop.yml +1 -0
  6. data/.travis.yml +10 -7
  7. data/CHANGELOG.md +1 -651
  8. data/Dangerfile +1 -1
  9. data/Gemfile +33 -1
  10. data/LICENSE.txt +1 -1
  11. data/README.md +2 -2
  12. data/RELEASING.md +3 -3
  13. data/Rakefile +5 -0
  14. data/capistrano.gemspec +8 -3
  15. data/features/deploy.feature +6 -0
  16. data/features/step_definitions/assertions.rb +1 -1
  17. data/features/step_definitions/setup.rb +6 -4
  18. data/features/support/vagrant_helpers.rb +6 -0
  19. data/lib/capistrano/configuration/question.rb +16 -4
  20. data/lib/capistrano/dsl.rb +1 -1
  21. data/lib/capistrano/i18n.rb +2 -0
  22. data/lib/capistrano/scm/git.rb +10 -4
  23. data/lib/capistrano/scm/tasks/git.rake +8 -7
  24. data/lib/capistrano/tasks/deploy.rake +3 -2
  25. data/lib/capistrano/templates/stage.rb.erb +1 -1
  26. data/lib/capistrano/version.rb +1 -1
  27. data/spec/integration/dsl_spec.rb +5 -3
  28. data/spec/lib/capistrano/application_spec.rb +16 -40
  29. data/spec/lib/capistrano/configuration/plugin_installer_spec.rb +1 -1
  30. data/spec/lib/capistrano/configuration/question_spec.rb +31 -13
  31. data/spec/lib/capistrano/configuration/scm_resolver_spec.rb +3 -2
  32. data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +1 -1
  33. data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +1 -1
  34. data/spec/lib/capistrano/doctor/servers_doctor_spec.rb +1 -1
  35. data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +1 -1
  36. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +6 -6
  37. data/spec/lib/capistrano/dsl_spec.rb +5 -5
  38. data/spec/lib/capistrano/plugin_spec.rb +2 -2
  39. data/spec/lib/capistrano/scm/git_spec.rb +27 -5
  40. data/spec/spec_helper.rb +13 -0
  41. data/spec/support/test_app.rb +8 -3
  42. metadata +15 -23
@@ -35,7 +35,7 @@ module Capistrano
35
35
  end
36
36
  end
37
37
 
38
- it "invokes in proper order if define after than before" do
38
+ it "invokes in proper order if define after than before", capture_io: true do
39
39
  task_enhancements.after("task", "after_task")
40
40
  task_enhancements.before("task", "before_task")
41
41
 
@@ -44,7 +44,7 @@ module Capistrano
44
44
  expect(order).to eq(%w(before_task task after_task))
45
45
  end
46
46
 
47
- it "invokes in proper order if define before than after" do
47
+ it "invokes in proper order if define before than after", capture_io: true do
48
48
  task_enhancements.before("task", "before_task")
49
49
  task_enhancements.after("task", "after_task")
50
50
 
@@ -53,7 +53,7 @@ module Capistrano
53
53
  expect(order).to eq(%w(before_task task after_task))
54
54
  end
55
55
 
56
- it "invokes in proper order when referring to as-yet undefined tasks" do
56
+ it "invokes in proper order when referring to as-yet undefined tasks", capture_io: true do
57
57
  task_enhancements.after("task", "not_loaded_task")
58
58
 
59
59
  Rake::Task.define_task("not_loaded_task") do
@@ -65,7 +65,7 @@ module Capistrano
65
65
  expect(order).to eq(%w(task not_loaded_task))
66
66
  end
67
67
 
68
- it "invokes in proper order and with arguments and block" do
68
+ it "invokes in proper order and with arguments and block", capture_io: true do
69
69
  task_enhancements.after("task", "after_task_custom", :order) do |_t, _args|
70
70
  order.push "after_task"
71
71
  end
@@ -79,7 +79,7 @@ module Capistrano
79
79
  expect(order).to eq(%w(before_task task after_task))
80
80
  end
81
81
 
82
- it "invokes using the correct namespace when defined within a namespace" do
82
+ it "invokes using the correct namespace when defined within a namespace", capture_io: true do
83
83
  Rake.application.in_namespace("namespace") do
84
84
  Rake::Task.define_task("task") do |t|
85
85
  order.push(t.name)
@@ -99,7 +99,7 @@ module Capistrano
99
99
  )
100
100
  end
101
101
 
102
- it "raises a sensible error if the task isn't found" do
102
+ it "raises a sensible error if the task isn't found", capture_io: true do
103
103
  task_enhancements.after("task", "non_existent_task")
104
104
  expect { Rake::Task["task"].invoke order }.to raise_error(ArgumentError, 'Task "non_existent_task" not found')
105
105
  end
@@ -60,7 +60,7 @@ module Capistrano
60
60
  end
61
61
  end
62
62
 
63
- it "prints helpful message to stderr" do
63
+ it "prints helpful message to stderr", capture_io: true do
64
64
  expect do
65
65
  expect do
66
66
  task.invoke
@@ -72,7 +72,7 @@ module Capistrano
72
72
 
73
73
  describe "#invoke" do
74
74
  context "reinvoking" do
75
- it "will not reenable invoking task" do
75
+ it "will not reenable invoking task", capture_io: true do
76
76
  counter = 0
77
77
 
78
78
  Rake::Task.define_task("A") do
@@ -85,7 +85,7 @@ module Capistrano
85
85
  end.to change { counter }.by(1)
86
86
  end
87
87
 
88
- it "will print a message on stderr" do
88
+ it "will print a message on stderr", capture_io: true do
89
89
  Rake::Task.define_task("B")
90
90
 
91
91
  expect do
@@ -98,7 +98,7 @@ module Capistrano
98
98
 
99
99
  describe "#invoke!" do
100
100
  context "reinvoking" do
101
- it "will reenable invoking task" do
101
+ it "will reenable invoking task", capture_io: true do
102
102
  counter = 0
103
103
 
104
104
  Rake::Task.define_task("C") do
@@ -111,7 +111,7 @@ module Capistrano
111
111
  end.to change { counter }.by(2)
112
112
  end
113
113
 
114
- it "will not print a message on stderr" do
114
+ it "will not print a message on stderr", capture_io: true do
115
115
  Rake::Task.define_task("D")
116
116
 
117
117
  expect do
@@ -62,14 +62,14 @@ module Capistrano
62
62
  dummy.expects(:set_defaults).never
63
63
  end
64
64
 
65
- it "calls set_defaults during load:defaults" do
65
+ it "calls set_defaults during load:defaults", capture_io: true do
66
66
  dummy = DummyPlugin.new
67
67
  dummy.expects(:set_defaults).once
68
68
  install_plugin(dummy)
69
69
  Rake::Task["load:defaults"].invoke
70
70
  end
71
71
 
72
- it "is able to load tasks from a .rake file" do
72
+ it "is able to load tasks from a .rake file", capture_io: true do
73
73
  install_plugin(ExternalTasksPlugin)
74
74
  Rake::Task["plugin_test"].invoke
75
75
  expect(fetch(:plugin_result)).to eq("hello")
@@ -28,13 +28,24 @@ 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})
35
+ end
36
+
37
+ it "makes git_max_concurrent_connections" do
38
+ subject.set_defaults
39
+ expect(env.fetch(:git_max_concurrent_connections)).to eq(10)
40
+ env.set(:git_max_concurrent_connections, 7)
41
+ expect(env.fetch(:git_max_concurrent_connections)).to eq(7)
42
+ end
43
+
44
+ it "makes git_wait_interval" do
45
+ subject.set_defaults
46
+ expect(env.fetch(:git_wait_interval)).to eq(0)
47
+ env.set(:git_wait_interval, 5)
48
+ expect(env.fetch(:git_wait_interval)).to eq(5)
38
49
  end
39
50
  end
40
51
 
@@ -158,5 +169,16 @@ module Capistrano
158
169
  expect(revision).to eq("81cec13b777ff46348693d327fc8e7832f79bf43")
159
170
  end
160
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
161
183
  end
162
184
  end
data/spec/spec_helper.rb CHANGED
@@ -13,4 +13,17 @@ RSpec.configure do |config|
13
13
  config.raise_errors_for_deprecations!
14
14
  config.mock_framework = :mocha
15
15
  config.order = "random"
16
+
17
+ config.around(:example, capture_io: true) do |example|
18
+ begin
19
+ Rake.application.options.trace_output = StringIO.new
20
+ $stdout = StringIO.new
21
+ $stderr = StringIO.new
22
+ example.run
23
+ ensure
24
+ Rake.application.options.trace_output = STDERR
25
+ $stdout = STDOUT
26
+ $stderr = STDERR
27
+ end
28
+ end
16
29
  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.11.0
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: 2018-06-03 00:00:00.000000000 Z
12
+ date: 2021-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrussh
@@ -67,20 +67,6 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: 1.9.0
70
- - !ruby/object:Gem::Dependency
71
- name: danger
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: mocha
86
72
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +122,8 @@ extra_rdoc_files: []
136
122
  files:
137
123
  - ".github/issue_template.md"
138
124
  - ".github/pull_request_template.md"
125
+ - ".github/release-drafter.yml"
126
+ - ".github/workflows/push.yml"
139
127
  - ".gitignore"
140
128
  - ".rubocop.yml"
141
129
  - ".travis.yml"
@@ -265,11 +253,16 @@ files:
265
253
  - spec/support/tasks/plugin.rake
266
254
  - spec/support/tasks/root.rake
267
255
  - spec/support/test_app.rb
268
- homepage: http://capistranorb.com/
256
+ homepage: https://capistranorb.com/
269
257
  licenses:
270
258
  - MIT
271
- metadata: {}
272
- post_install_message:
259
+ metadata:
260
+ bug_tracker_uri: https://github.com/capistrano/capistrano/issues
261
+ changelog_uri: https://github.com/capistrano/capistrano/releases
262
+ source_code_uri: https://github.com/capistrano/capistrano
263
+ homepage_uri: https://capistranorb.com/
264
+ documentation_uri: https://capistranorb.com/
265
+ post_install_message:
273
266
  rdoc_options: []
274
267
  require_paths:
275
268
  - lib
@@ -284,9 +277,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
277
  - !ruby/object:Gem::Version
285
278
  version: '0'
286
279
  requirements: []
287
- rubyforge_project:
288
- rubygems_version: 2.7.7
289
- signing_key:
280
+ rubygems_version: 3.2.11
281
+ signing_key:
290
282
  specification_version: 4
291
283
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH
292
284
  test_files: