capistrano 3.5.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -1
  3. data/CHANGELOG.md +55 -10
  4. data/README.md +3 -3
  5. data/RELEASING.md +1 -0
  6. data/UPGRADING-3.7.md +97 -0
  7. data/capistrano.gemspec +1 -1
  8. data/features/deploy.feature +1 -0
  9. data/features/stage_failure.feature +9 -0
  10. data/features/step_definitions/assertions.rb +5 -0
  11. data/features/step_definitions/setup.rb +4 -0
  12. data/lib/capistrano/application.rb +5 -10
  13. data/lib/capistrano/configuration.rb +8 -7
  14. data/lib/capistrano/configuration/filter.rb +4 -5
  15. data/lib/capistrano/configuration/host_filter.rb +1 -1
  16. data/lib/capistrano/configuration/plugin_installer.rb +1 -1
  17. data/lib/capistrano/configuration/server.rb +8 -2
  18. data/lib/capistrano/configuration/validated_variables.rb +75 -0
  19. data/lib/capistrano/configuration/variables.rb +7 -23
  20. data/lib/capistrano/defaults.rb +10 -0
  21. data/lib/capistrano/doctor.rb +1 -0
  22. data/lib/capistrano/doctor/gems_doctor.rb +1 -1
  23. data/lib/capistrano/doctor/servers_doctor.rb +105 -0
  24. data/lib/capistrano/doctor/variables_doctor.rb +6 -7
  25. data/lib/capistrano/dsl.rb +28 -4
  26. data/lib/capistrano/dsl/paths.rb +1 -1
  27. data/lib/capistrano/dsl/stages.rb +15 -1
  28. data/lib/capistrano/dsl/task_enhancements.rb +6 -1
  29. data/lib/capistrano/i18n.rb +2 -0
  30. data/lib/capistrano/proc_helpers.rb +13 -0
  31. data/lib/capistrano/tasks/deploy.rake +9 -1
  32. data/lib/capistrano/tasks/doctor.rake +6 -1
  33. data/lib/capistrano/tasks/git.rake +11 -4
  34. data/lib/capistrano/templates/deploy.rb.erb +2 -15
  35. data/lib/capistrano/version.rb +1 -1
  36. data/spec/lib/capistrano/configuration/empty_filter_spec.rb +1 -1
  37. data/spec/lib/capistrano/configuration/filter_spec.rb +8 -8
  38. data/spec/lib/capistrano/configuration/host_filter_spec.rb +1 -1
  39. data/spec/lib/capistrano/configuration/null_filter_spec.rb +1 -1
  40. data/spec/lib/capistrano/configuration/question_spec.rb +1 -1
  41. data/spec/lib/capistrano/configuration/role_filter_spec.rb +1 -1
  42. data/spec/lib/capistrano/configuration/server_spec.rb +3 -2
  43. data/spec/lib/capistrano/configuration_spec.rb +16 -3
  44. data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +6 -0
  45. data/spec/lib/capistrano/doctor/servers_doctor_spec.rb +86 -0
  46. data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +9 -0
  47. data/spec/lib/capistrano/dsl/paths_spec.rb +9 -9
  48. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +5 -0
  49. data/spec/lib/capistrano/dsl_spec.rb +37 -3
  50. data/spec/lib/capistrano/version_validator_spec.rb +2 -2
  51. data/spec/support/test_app.rb +10 -0
  52. metadata +12 -4
@@ -98,6 +98,11 @@ module Capistrano
98
98
  ["namespace:before_task", "namespace:task", "namespace:after_task"]
99
99
  )
100
100
  end
101
+
102
+ it "raises a sensible error if the task isn't found" do
103
+ task_enhancements.after("task", "non_existent_task")
104
+ expect { Rake::Task["task"].invoke order }.to raise_error(ArgumentError, 'Task "non_existent_task" not found')
105
+ end
101
106
  end
102
107
 
103
108
  describe "remote_file" do
@@ -9,7 +9,7 @@ module Capistrano
9
9
  describe DSL do
10
10
  let(:dsl) { DummyDSL.new }
11
11
 
12
- describe '#t' do
12
+ describe "#t" do
13
13
  before do
14
14
  I18n.expects(:t).with(:phrase, count: 2, scope: :capistrano)
15
15
  end
@@ -19,7 +19,7 @@ module Capistrano
19
19
  end
20
20
  end
21
21
 
22
- describe '#stage_set?' do
22
+ describe "#stage_set?" do
23
23
  subject { dsl.stage_set? }
24
24
 
25
25
  context "stage is set" do
@@ -37,7 +37,7 @@ module Capistrano
37
37
  end
38
38
  end
39
39
 
40
- describe '#sudo' do
40
+ describe "#sudo" do
41
41
  before do
42
42
  dsl.expects(:execute).with(:sudo, :my, :command)
43
43
  end
@@ -46,5 +46,39 @@ module Capistrano
46
46
  dsl.sudo(:my, :command)
47
47
  end
48
48
  end
49
+
50
+ describe "#execute" do
51
+ context "use outside of on scope" do
52
+ after do
53
+ task.clear
54
+ Rake::Task.clear
55
+ end
56
+
57
+ let(:task) do
58
+ Rake::Task.define_task("execute_outside_scope") do
59
+ dsl.execute "whoami"
60
+ end
61
+ end
62
+
63
+ it "prints helpful message to stderr" do
64
+ expect do
65
+ expect do
66
+ task.invoke
67
+ end.to output(/^.*Warning: `execute' should be wrapped in an `on' scope/).to_stderr
68
+ end.to raise_error(NoMethodError)
69
+ end
70
+ end
71
+ end
72
+
73
+ describe "#invoke" do
74
+ it "will print a message on stderr, when reinvoking task" do
75
+ Rake::Task.define_task("some_task")
76
+
77
+ dsl.invoke("some_task")
78
+ expect do
79
+ dsl.invoke("some_task")
80
+ end.to output(/.*Capistrano tasks may only be invoked once.*/).to_stderr
81
+ end
82
+ end
49
83
  end
50
84
  end
@@ -5,13 +5,13 @@ module Capistrano
5
5
  let(:validator) { VersionValidator.new(version) }
6
6
  let(:version) { stub }
7
7
 
8
- describe '#new' do
8
+ describe "#new" do
9
9
  it "takes a version" do
10
10
  expect(validator)
11
11
  end
12
12
  end
13
13
 
14
- describe '#verify' do
14
+ describe "#verify" do
15
15
  let(:current_version) { "3.0.1" }
16
16
 
17
17
  subject { validator.verify }
@@ -61,6 +61,12 @@ module TestApp
61
61
  end
62
62
  end
63
63
 
64
+ def write_local_stage_file(filename, config=nil)
65
+ File.open(test_app_path.join("config/deploy/#{filename}"), "w") do |file|
66
+ file.write(config) if config
67
+ end
68
+ end
69
+
64
70
  def append_to_deploy_file(config)
65
71
  File.open(test_stage_path, "a") do |file|
66
72
  file.write config + "\n"
@@ -175,4 +181,8 @@ module TestApp
175
181
  FileUtils.mkdir_p(location)
176
182
  FileUtils.mv(config_path, location)
177
183
  end
184
+
185
+ def git_wrapper_path
186
+ "/tmp/git-ssh-my_app_name-#{stage}-#{current_user}.sh"
187
+ end
178
188
  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: 3.5.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Clements
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-25 00:00:00.000000000 Z
12
+ date: 2016-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrussh
@@ -145,6 +145,7 @@ files:
145
145
  - README.md
146
146
  - RELEASING.md
147
147
  - Rakefile
148
+ - UPGRADING-3.7.md
148
149
  - bin/cap
149
150
  - bin/capify
150
151
  - capistrano.gemspec
@@ -155,6 +156,7 @@ files:
155
156
  - features/installation.feature
156
157
  - features/remote_file_task.feature
157
158
  - features/sshconnect.feature
159
+ - features/stage_failure.feature
158
160
  - features/step_definitions/assertions.rb
159
161
  - features/step_definitions/cap_commands.rb
160
162
  - features/step_definitions/setup.rb
@@ -176,6 +178,7 @@ files:
176
178
  - lib/capistrano/configuration/role_filter.rb
177
179
  - lib/capistrano/configuration/server.rb
178
180
  - lib/capistrano/configuration/servers.rb
181
+ - lib/capistrano/configuration/validated_variables.rb
179
182
  - lib/capistrano/configuration/variables.rb
180
183
  - lib/capistrano/console.rb
181
184
  - lib/capistrano/defaults.rb
@@ -184,6 +187,7 @@ files:
184
187
  - lib/capistrano/doctor/environment_doctor.rb
185
188
  - lib/capistrano/doctor/gems_doctor.rb
186
189
  - lib/capistrano/doctor/output_helpers.rb
190
+ - lib/capistrano/doctor/servers_doctor.rb
187
191
  - lib/capistrano/doctor/variables_doctor.rb
188
192
  - lib/capistrano/dotfile.rb
189
193
  - lib/capistrano/dsl.rb
@@ -198,6 +202,7 @@ files:
198
202
  - lib/capistrano/immutable_task.rb
199
203
  - lib/capistrano/install.rb
200
204
  - lib/capistrano/plugin.rb
205
+ - lib/capistrano/proc_helpers.rb
201
206
  - lib/capistrano/scm.rb
202
207
  - lib/capistrano/setup.rb
203
208
  - lib/capistrano/svn.rb
@@ -230,6 +235,7 @@ files:
230
235
  - spec/lib/capistrano/doctor/environment_doctor_spec.rb
231
236
  - spec/lib/capistrano/doctor/gems_doctor_spec.rb
232
237
  - spec/lib/capistrano/doctor/output_helpers_spec.rb
238
+ - spec/lib/capistrano/doctor/servers_doctor_spec.rb
233
239
  - spec/lib/capistrano/doctor/variables_doctor_spec.rb
234
240
  - spec/lib/capistrano/dsl/paths_spec.rb
235
241
  - spec/lib/capistrano/dsl/task_enhancements_spec.rb
@@ -265,7 +271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
271
  requirements:
266
272
  - - ">="
267
273
  - !ruby/object:Gem::Version
268
- version: 1.9.3
274
+ version: '2.0'
269
275
  required_rubygems_version: !ruby/object:Gem::Requirement
270
276
  requirements:
271
277
  - - ">="
@@ -273,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
279
  version: '0'
274
280
  requirements: []
275
281
  rubyforge_project:
276
- rubygems_version: 2.6.3
282
+ rubygems_version: 2.6.6
277
283
  signing_key:
278
284
  specification_version: 4
279
285
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH
@@ -285,6 +291,7 @@ test_files:
285
291
  - features/installation.feature
286
292
  - features/remote_file_task.feature
287
293
  - features/sshconnect.feature
294
+ - features/stage_failure.feature
288
295
  - features/step_definitions/assertions.rb
289
296
  - features/step_definitions/cap_commands.rb
290
297
  - features/step_definitions/setup.rb
@@ -306,6 +313,7 @@ test_files:
306
313
  - spec/lib/capistrano/doctor/environment_doctor_spec.rb
307
314
  - spec/lib/capistrano/doctor/gems_doctor_spec.rb
308
315
  - spec/lib/capistrano/doctor/output_helpers_spec.rb
316
+ - spec/lib/capistrano/doctor/servers_doctor_spec.rb
309
317
  - spec/lib/capistrano/doctor/variables_doctor_spec.rb
310
318
  - spec/lib/capistrano/dsl/paths_spec.rb
311
319
  - spec/lib/capistrano/dsl/task_enhancements_spec.rb