capistrano 3.2.1 → 3.3.3

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -3
  3. data/CHANGELOG.md +92 -2
  4. data/Gemfile +1 -5
  5. data/README.md +84 -3
  6. data/Rakefile +5 -1
  7. data/capistrano.gemspec +5 -1
  8. data/features/configuration.feature +9 -7
  9. data/features/deploy.feature +9 -8
  10. data/features/step_definitions/assertions.rb +15 -17
  11. data/features/step_definitions/cap_commands.rb +1 -1
  12. data/features/step_definitions/setup.rb +11 -7
  13. data/features/support/env.rb +8 -9
  14. data/features/support/remote_command_helpers.rb +2 -3
  15. data/features/support/vagrant_helpers.rb +35 -0
  16. data/lib/capistrano/all.rb +2 -1
  17. data/lib/capistrano/application.rb +52 -7
  18. data/lib/capistrano/configuration.rb +39 -10
  19. data/lib/capistrano/configuration/filter.rb +56 -0
  20. data/lib/capistrano/configuration/question.rb +23 -11
  21. data/lib/capistrano/configuration/server.rb +14 -5
  22. data/lib/capistrano/configuration/servers.rb +12 -29
  23. data/lib/capistrano/defaults.rb +11 -9
  24. data/lib/capistrano/deploy.rb +1 -0
  25. data/lib/capistrano/dsl.rb +13 -2
  26. data/lib/capistrano/dsl/env.rb +6 -2
  27. data/lib/capistrano/dsl/task_enhancements.rb +5 -3
  28. data/lib/capistrano/git.rb +8 -2
  29. data/lib/capistrano/hg.rb +7 -1
  30. data/lib/capistrano/svn.rb +2 -2
  31. data/lib/capistrano/tasks/deploy.rake +12 -10
  32. data/lib/capistrano/tasks/git.rake +1 -1
  33. data/lib/capistrano/tasks/install.rake +17 -14
  34. data/lib/capistrano/templates/Capfile +6 -4
  35. data/lib/capistrano/templates/deploy.rb.erb +5 -15
  36. data/lib/capistrano/upload_task.rb +9 -0
  37. data/lib/capistrano/version.rb +1 -1
  38. data/spec/integration/dsl_spec.rb +129 -10
  39. data/spec/lib/capistrano/application_spec.rb +24 -6
  40. data/spec/lib/capistrano/configuration/filter_spec.rb +105 -0
  41. data/spec/lib/capistrano/configuration/question_spec.rb +18 -12
  42. data/spec/lib/capistrano/configuration/server_spec.rb +19 -19
  43. data/spec/lib/capistrano/configuration/servers_spec.rb +101 -20
  44. data/spec/lib/capistrano/configuration_spec.rb +24 -3
  45. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +88 -0
  46. data/spec/lib/capistrano/dsl_spec.rb +2 -13
  47. data/spec/lib/capistrano/git_spec.rb +15 -4
  48. data/spec/lib/capistrano/hg_spec.rb +13 -2
  49. data/spec/lib/capistrano/scm_spec.rb +3 -3
  50. data/spec/lib/capistrano/svn_spec.rb +11 -1
  51. data/spec/lib/capistrano/upload_task_spec.rb +19 -0
  52. data/spec/lib/capistrano/version_validator_spec.rb +4 -4
  53. data/spec/spec_helper.rb +2 -1
  54. data/spec/support/Vagrantfile +1 -1
  55. data/spec/support/test_app.rb +2 -0
  56. metadata +45 -26
  57. data/lib/capistrano/configuration/servers/host_filter.rb +0 -82
  58. data/lib/capistrano/configuration/servers/role_filter.rb +0 -86
  59. data/spec/lib/capistrano/configuration/servers/host_filter_spec.rb +0 -84
  60. data/spec/lib/capistrano/configuration/servers/role_filter_spec.rb +0 -140
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Capistrano::UploadTask do
4
+ let(:app) { Rake.application = Rake::Application.new }
5
+
6
+ subject(:upload_task) { described_class.define_task('path/file.yml') }
7
+
8
+ it { is_expected.to be_a(Rake::FileCreationTask) }
9
+ it { is_expected.to be_needed }
10
+
11
+ context 'inside namespace' do
12
+ let(:normal_task) { Rake::Task.define_task('path/other_file.yml') }
13
+
14
+ around { |ex| app.in_namespace('namespace', &ex) }
15
+
16
+ it { expect(upload_task.name).to eq('path/file.yml') }
17
+ it { expect(upload_task.scope.path).to eq('namespace') }
18
+ end
19
+ end
@@ -24,7 +24,7 @@ module Capistrano
24
24
  context 'with exact version' do
25
25
  context 'valid' do
26
26
  let(:version) { '3.0.1' }
27
- it { should be_true }
27
+ it { expect(subject).to be_truthy }
28
28
  end
29
29
 
30
30
  context 'invalid - lower' do
@@ -48,7 +48,7 @@ module Capistrano
48
48
  context 'with optimistic versioning' do
49
49
  context 'valid' do
50
50
  let(:version) { '>= 3.0.0' }
51
- it { should be_true }
51
+ it { expect(subject).to be_truthy }
52
52
  end
53
53
 
54
54
  context 'invalid - lower' do
@@ -66,7 +66,7 @@ module Capistrano
66
66
  context '2 decimal places' do
67
67
  context 'valid' do
68
68
  let(:version) { '~> 3.0.0' }
69
- it { should be_true }
69
+ it { expect(subject).to be_truthy }
70
70
  end
71
71
 
72
72
  context 'invalid' do
@@ -83,7 +83,7 @@ module Capistrano
83
83
 
84
84
  context 'valid' do
85
85
  let(:version) { '~> 3.1' }
86
- it { should be_true }
86
+ it { expect(subject).to be_truthy }
87
87
  end
88
88
 
89
89
  context 'invalid' do
@@ -3,13 +3,14 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'capistrano/all'
4
4
  require 'rspec'
5
5
  require 'mocha/api'
6
+ require 'time'
6
7
 
7
8
  # Requires supporting files with custom matchers and macros, etc,
8
9
  # in ./support/ and its subdirectories.
9
10
  Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each {|f| require f}
10
11
 
11
12
  RSpec.configure do |config|
12
- config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.raise_errors_for_deprecations!
13
14
  config.mock_framework = :mocha
14
15
  config.order = 'random'
15
16
  end
@@ -6,7 +6,7 @@ Vagrant::Config.run do |config|
6
6
  config.vm.box = 'precise64'
7
7
  config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
8
8
  config.vm.forward_port 22, "222#{i}".to_i
9
- config.vm.provision :shell, inline: 'yes | sudo apt-get install git-core'
9
+ config.vm.provision :shell, inline: 'sudo apt-get -y install git-core'
10
10
  end
11
11
  end
12
12
 
@@ -1,4 +1,6 @@
1
1
  require 'fileutils'
2
+ require 'pathname'
3
+
2
4
  module TestApp
3
5
  extend self
4
6
 
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.2.1
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Clements
@@ -9,76 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-22 00:00:00.000000000 Z
12
+ date: 2014-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sshkit
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: capistrano-stats
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.3
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 1.0.3
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: rake
30
44
  requirement: !ruby/object:Gem::Requirement
31
45
  requirements:
32
- - - '>='
46
+ - - ">="
33
47
  - !ruby/object:Gem::Version
34
48
  version: 10.0.0
35
49
  type: :runtime
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - '>='
53
+ - - ">="
40
54
  - !ruby/object:Gem::Version
41
55
  version: 10.0.0
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: i18n
44
58
  requirement: !ruby/object:Gem::Requirement
45
59
  requirements:
46
- - - '>='
60
+ - - ">="
47
61
  - !ruby/object:Gem::Version
48
62
  version: '0'
49
63
  type: :runtime
50
64
  prerelease: false
51
65
  version_requirements: !ruby/object:Gem::Requirement
52
66
  requirements:
53
- - - '>='
67
+ - - ">="
54
68
  - !ruby/object:Gem::Version
55
69
  version: '0'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: rspec
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - '>='
74
+ - - ">="
61
75
  - !ruby/object:Gem::Version
62
76
  version: '0'
63
77
  type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - '>='
81
+ - - ">="
68
82
  - !ruby/object:Gem::Version
69
83
  version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: mocha
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - '>='
88
+ - - ">="
75
89
  - !ruby/object:Gem::Version
76
90
  version: '0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - '>='
95
+ - - ">="
82
96
  - !ruby/object:Gem::Version
83
97
  version: '0'
84
98
  description: Capistrano is a utility and framework for executing commands in parallel
@@ -92,8 +106,8 @@ executables:
92
106
  extensions: []
93
107
  extra_rdoc_files: []
94
108
  files:
95
- - .gitignore
96
- - .travis.yml
109
+ - ".gitignore"
110
+ - ".travis.yml"
97
111
  - CHANGELOG.md
98
112
  - CONTRIBUTING.md
99
113
  - Gemfile
@@ -113,16 +127,16 @@ files:
113
127
  - features/step_definitions/setup.rb
114
128
  - features/support/env.rb
115
129
  - features/support/remote_command_helpers.rb
130
+ - features/support/vagrant_helpers.rb
116
131
  - lib/Capfile
117
132
  - lib/capistrano.rb
118
133
  - lib/capistrano/all.rb
119
134
  - lib/capistrano/application.rb
120
135
  - lib/capistrano/configuration.rb
136
+ - lib/capistrano/configuration/filter.rb
121
137
  - lib/capistrano/configuration/question.rb
122
138
  - lib/capistrano/configuration/server.rb
123
139
  - lib/capistrano/configuration/servers.rb
124
- - lib/capistrano/configuration/servers/host_filter.rb
125
- - lib/capistrano/configuration/servers/role_filter.rb
126
140
  - lib/capistrano/console.rb
127
141
  - lib/capistrano/defaults.rb
128
142
  - lib/capistrano/deploy.rb
@@ -150,23 +164,25 @@ files:
150
164
  - lib/capistrano/templates/Capfile
151
165
  - lib/capistrano/templates/deploy.rb.erb
152
166
  - lib/capistrano/templates/stage.rb.erb
167
+ - lib/capistrano/upload_task.rb
153
168
  - lib/capistrano/version.rb
154
169
  - lib/capistrano/version_validator.rb
155
170
  - spec/integration/dsl_spec.rb
156
171
  - spec/integration_spec_helper.rb
157
172
  - spec/lib/capistrano/application_spec.rb
173
+ - spec/lib/capistrano/configuration/filter_spec.rb
158
174
  - spec/lib/capistrano/configuration/question_spec.rb
159
175
  - spec/lib/capistrano/configuration/server_spec.rb
160
- - spec/lib/capistrano/configuration/servers/host_filter_spec.rb
161
- - spec/lib/capistrano/configuration/servers/role_filter_spec.rb
162
176
  - spec/lib/capistrano/configuration/servers_spec.rb
163
177
  - spec/lib/capistrano/configuration_spec.rb
164
178
  - spec/lib/capistrano/dsl/paths_spec.rb
179
+ - spec/lib/capistrano/dsl/task_enhancements_spec.rb
165
180
  - spec/lib/capistrano/dsl_spec.rb
166
181
  - spec/lib/capistrano/git_spec.rb
167
182
  - spec/lib/capistrano/hg_spec.rb
168
183
  - spec/lib/capistrano/scm_spec.rb
169
184
  - spec/lib/capistrano/svn_spec.rb
185
+ - spec/lib/capistrano/upload_task_spec.rb
170
186
  - spec/lib/capistrano/version_validator_spec.rb
171
187
  - spec/lib/capistrano_spec.rb
172
188
  - spec/spec_helper.rb
@@ -182,25 +198,27 @@ licenses:
182
198
  - MIT
183
199
  metadata: {}
184
200
  post_install_message: |
185
- Capistrano 3.1 has some breaking changes, like `deploy:restart` callback should be added manually to your deploy.rb. Please, check the CHANGELOG: http://goo.gl/SxB0lr
201
+ Capistrano 3.1 has some breaking changes. Please check the CHANGELOG: http://goo.gl/SxB0lr
186
202
 
187
203
  If you're upgrading Capistrano from 2.x, we recommend to read the upgrade guide: http://goo.gl/4536kB
204
+
205
+ The `deploy:restart` hook for passenger applications is now in a separate gem called capistrano-passenger. Just add it to your Gemfile and require it in your Capfile.
188
206
  rdoc_options: []
189
207
  require_paths:
190
208
  - lib
191
209
  required_ruby_version: !ruby/object:Gem::Requirement
192
210
  requirements:
193
- - - '>='
211
+ - - ">="
194
212
  - !ruby/object:Gem::Version
195
- version: '0'
213
+ version: 1.9.3
196
214
  required_rubygems_version: !ruby/object:Gem::Requirement
197
215
  requirements:
198
- - - '>='
216
+ - - ">="
199
217
  - !ruby/object:Gem::Version
200
218
  version: '0'
201
219
  requirements: []
202
220
  rubyforge_project:
203
- rubygems_version: 2.0.3
221
+ rubygems_version: 2.2.2
204
222
  signing_key:
205
223
  specification_version: 4
206
224
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH
@@ -215,21 +233,23 @@ test_files:
215
233
  - features/step_definitions/setup.rb
216
234
  - features/support/env.rb
217
235
  - features/support/remote_command_helpers.rb
236
+ - features/support/vagrant_helpers.rb
218
237
  - spec/integration/dsl_spec.rb
219
238
  - spec/integration_spec_helper.rb
220
239
  - spec/lib/capistrano/application_spec.rb
240
+ - spec/lib/capistrano/configuration/filter_spec.rb
221
241
  - spec/lib/capistrano/configuration/question_spec.rb
222
242
  - spec/lib/capistrano/configuration/server_spec.rb
223
- - spec/lib/capistrano/configuration/servers/host_filter_spec.rb
224
- - spec/lib/capistrano/configuration/servers/role_filter_spec.rb
225
243
  - spec/lib/capistrano/configuration/servers_spec.rb
226
244
  - spec/lib/capistrano/configuration_spec.rb
227
245
  - spec/lib/capistrano/dsl/paths_spec.rb
246
+ - spec/lib/capistrano/dsl/task_enhancements_spec.rb
228
247
  - spec/lib/capistrano/dsl_spec.rb
229
248
  - spec/lib/capistrano/git_spec.rb
230
249
  - spec/lib/capistrano/hg_spec.rb
231
250
  - spec/lib/capistrano/scm_spec.rb
232
251
  - spec/lib/capistrano/svn_spec.rb
252
+ - spec/lib/capistrano/upload_task_spec.rb
233
253
  - spec/lib/capistrano/version_validator_spec.rb
234
254
  - spec/lib/capistrano_spec.rb
235
255
  - spec/spec_helper.rb
@@ -240,4 +260,3 @@ test_files:
240
260
  - spec/support/tasks/fail.rake
241
261
  - spec/support/tasks/failed.rake
242
262
  - spec/support/test_app.rb
243
- has_rdoc:
@@ -1,82 +0,0 @@
1
- module Capistrano
2
- class Configuration
3
- class Servers
4
- class HostFilter
5
-
6
- def initialize(available)
7
- @available = available
8
- end
9
-
10
- def self.for(available)
11
- new(available).hosts
12
- end
13
-
14
- def hosts
15
- if host_filter.any?
16
- @available.select { |server| host_filter.include? server.hostname }
17
- else
18
- @available
19
- end
20
- end
21
-
22
- private
23
-
24
- def filter
25
- if host_filter.any?
26
- host_filter
27
- else
28
- @available
29
- end
30
- end
31
-
32
- def host_filter
33
- env_filter | configuration_filter
34
- end
35
-
36
- def configuration_filter
37
- ConfigurationFilter.new.hosts
38
- end
39
-
40
- def env_filter
41
- EnvFilter.new.hosts
42
- end
43
-
44
- class ConfigurationFilter
45
-
46
- def hosts
47
- if filter
48
- Array(filter.fetch(:hosts, []))
49
- else
50
- []
51
- end
52
- end
53
-
54
- def config
55
- Configuration.env
56
- end
57
-
58
- def filter
59
- config.fetch(:filter) || config.fetch(:select)
60
- end
61
- end
62
-
63
-
64
- class EnvFilter
65
-
66
- def hosts
67
- if filter
68
- filter.split(',')
69
- else
70
- []
71
- end
72
- end
73
-
74
- def filter
75
- ENV['HOSTS']
76
- end
77
- end
78
-
79
- end
80
- end
81
- end
82
- end
@@ -1,86 +0,0 @@
1
- module Capistrano
2
- class Configuration
3
- class Servers
4
- class RoleFilter
5
-
6
- def initialize(required, available)
7
- @required, @available = required, available
8
- end
9
-
10
- def self.for(required, available)
11
- new(required, available).roles
12
- end
13
-
14
- def roles
15
- if required.include?(:all)
16
- available
17
- else
18
- required.select { |name| available.include? name }
19
- end
20
- end
21
-
22
- private
23
-
24
- def required
25
- Array(@required).flat_map(&:to_sym)
26
- end
27
-
28
- def available
29
- if role_filter.any?
30
- role_filter
31
- else
32
- @available
33
- end
34
- end
35
-
36
- def role_filter
37
- env_filter | configuration_filter
38
- end
39
-
40
- def configuration_filter
41
- ConfigurationFilter.new.roles
42
- end
43
-
44
- def env_filter
45
- EnvFilter.new.roles
46
- end
47
-
48
- class ConfigurationFilter
49
-
50
- def roles
51
- if filter
52
- Array(filter.fetch(:roles, [])).map(&:to_sym)
53
- else
54
- []
55
- end
56
- end
57
-
58
- def config
59
- Configuration.env
60
- end
61
-
62
- def filter
63
- config.fetch(:filter) || config.fetch(:select)
64
- end
65
- end
66
-
67
-
68
- class EnvFilter
69
-
70
- def roles
71
- if filter
72
- filter.split(',').map(&:to_sym)
73
- else
74
- []
75
- end
76
- end
77
-
78
- def filter
79
- ENV['ROLES']
80
- end
81
- end
82
-
83
- end
84
- end
85
- end
86
- end