capistrano 3.6.0 → 3.7.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/issue_template.md +19 -0
  3. data/.github/pull_request_template.md +26 -0
  4. data/.gitignore +1 -0
  5. data/.travis.yml +10 -2
  6. data/CHANGELOG.md +63 -1
  7. data/DEVELOPMENT.md +7 -1
  8. data/Dangerfile +54 -0
  9. data/README.md +4 -5
  10. data/capistrano.gemspec +3 -2
  11. data/features/support/vagrant_helpers.rb +3 -5
  12. data/lib/capistrano/all.rb +1 -0
  13. data/lib/capistrano/configuration/host_filter.rb +1 -1
  14. data/lib/capistrano/configuration/plugin_installer.rb +20 -2
  15. data/lib/capistrano/configuration/role_filter.rb +1 -1
  16. data/lib/capistrano/configuration/scm_resolver.rb +144 -0
  17. data/lib/capistrano/configuration/validated_variables.rb +48 -13
  18. data/lib/capistrano/configuration/variables.rb +0 -8
  19. data/lib/capistrano/configuration.rb +30 -3
  20. data/lib/capistrano/defaults.rb +3 -1
  21. data/lib/capistrano/doctor/variables_doctor.rb +1 -1
  22. data/lib/capistrano/dsl/env.rb +2 -9
  23. data/lib/capistrano/dsl/paths.rb +1 -1
  24. data/lib/capistrano/dsl/task_enhancements.rb +0 -8
  25. data/lib/capistrano/dsl.rb +2 -1
  26. data/lib/capistrano/i18n.rb +1 -0
  27. data/lib/capistrano/scm/git.rb +73 -0
  28. data/lib/capistrano/scm/hg.rb +48 -0
  29. data/lib/capistrano/scm/plugin.rb +13 -0
  30. data/lib/capistrano/scm/svn.rb +47 -0
  31. data/lib/capistrano/{tasks → scm/tasks}/git.rake +9 -24
  32. data/lib/capistrano/{tasks → scm/tasks}/hg.rake +11 -10
  33. data/lib/capistrano/{tasks → scm/tasks}/svn.rake +11 -10
  34. data/lib/capistrano/setup.rb +1 -1
  35. data/lib/capistrano/tasks/deploy.rake +4 -5
  36. data/lib/capistrano/templates/Capfile +18 -7
  37. data/lib/capistrano/templates/deploy.rb.erb +7 -10
  38. data/lib/capistrano/templates/stage.rb.erb +8 -8
  39. data/lib/capistrano/version.rb +1 -1
  40. data/lib/capistrano/version_validator.rb +2 -5
  41. data/spec/lib/capistrano/configuration/host_filter_spec.rb +5 -0
  42. data/spec/lib/capistrano/configuration/plugin_installer_spec.rb +98 -0
  43. data/spec/lib/capistrano/configuration/role_filter_spec.rb +17 -1
  44. data/spec/lib/capistrano/configuration_spec.rb +61 -2
  45. data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +0 -7
  46. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +0 -15
  47. data/spec/lib/capistrano/scm/git_spec.rb +131 -0
  48. data/spec/lib/capistrano/scm/hg_spec.rb +104 -0
  49. data/spec/lib/capistrano/scm/svn_spec.rb +116 -0
  50. data/spec/lib/capistrano/scm_spec.rb +1 -1
  51. metadata +37 -19
  52. data/features/remote_file_task.feature +0 -14
  53. data/issue_template.md +0 -21
  54. data/lib/capistrano/git.rb +0 -54
  55. data/lib/capistrano/hg.rb +0 -43
  56. data/lib/capistrano/svn.rb +0 -42
  57. data/spec/lib/capistrano/git_spec.rb +0 -109
  58. data/spec/lib/capistrano/hg_spec.rb +0 -90
  59. data/spec/lib/capistrano/svn_spec.rb +0 -105
@@ -26,7 +26,7 @@ module BlindStrategy; end
26
26
 
27
27
  module Capistrano
28
28
  describe SCM do
29
- let(:context) { Class.new.new }
29
+ let(:context) { mock }
30
30
 
31
31
  describe "#initialize" do
32
32
  subject { Capistrano::SCM.new(context, DummyStrategy) }
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.6.0
4
+ version: 3.7.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-07-26 00:00:00.000000000 Z
12
+ date: 2016-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrussh
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: rspec
85
+ name: danger
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rubocop
114
128
  requirement: !ruby/object:Gem::Requirement
@@ -134,12 +148,15 @@ executables:
134
148
  extensions: []
135
149
  extra_rdoc_files: []
136
150
  files:
151
+ - ".github/issue_template.md"
152
+ - ".github/pull_request_template.md"
137
153
  - ".gitignore"
138
154
  - ".rubocop.yml"
139
155
  - ".travis.yml"
140
156
  - CHANGELOG.md
141
157
  - CONTRIBUTING.md
142
158
  - DEVELOPMENT.md
159
+ - Dangerfile
143
160
  - Gemfile
144
161
  - LICENSE.txt
145
162
  - README.md
@@ -154,7 +171,6 @@ files:
154
171
  - features/deploy_failure.feature
155
172
  - features/doctor.feature
156
173
  - features/installation.feature
157
- - features/remote_file_task.feature
158
174
  - features/sshconnect.feature
159
175
  - features/stage_failure.feature
160
176
  - features/step_definitions/assertions.rb
@@ -163,7 +179,6 @@ files:
163
179
  - features/support/env.rb
164
180
  - features/support/remote_command_helpers.rb
165
181
  - features/support/vagrant_helpers.rb
166
- - issue_template.md
167
182
  - lib/Capfile
168
183
  - lib/capistrano.rb
169
184
  - lib/capistrano/all.rb
@@ -176,6 +191,7 @@ files:
176
191
  - lib/capistrano/configuration/plugin_installer.rb
177
192
  - lib/capistrano/configuration/question.rb
178
193
  - lib/capistrano/configuration/role_filter.rb
194
+ - lib/capistrano/configuration/scm_resolver.rb
179
195
  - lib/capistrano/configuration/server.rb
180
196
  - lib/capistrano/configuration/servers.rb
181
197
  - lib/capistrano/configuration/validated_variables.rb
@@ -196,24 +212,25 @@ files:
196
212
  - lib/capistrano/dsl/stages.rb
197
213
  - lib/capistrano/dsl/task_enhancements.rb
198
214
  - lib/capistrano/framework.rb
199
- - lib/capistrano/git.rb
200
- - lib/capistrano/hg.rb
201
215
  - lib/capistrano/i18n.rb
202
216
  - lib/capistrano/immutable_task.rb
203
217
  - lib/capistrano/install.rb
204
218
  - lib/capistrano/plugin.rb
205
219
  - lib/capistrano/proc_helpers.rb
206
220
  - lib/capistrano/scm.rb
221
+ - lib/capistrano/scm/git.rb
222
+ - lib/capistrano/scm/hg.rb
223
+ - lib/capistrano/scm/plugin.rb
224
+ - lib/capistrano/scm/svn.rb
225
+ - lib/capistrano/scm/tasks/git.rake
226
+ - lib/capistrano/scm/tasks/hg.rake
227
+ - lib/capistrano/scm/tasks/svn.rake
207
228
  - lib/capistrano/setup.rb
208
- - lib/capistrano/svn.rb
209
229
  - lib/capistrano/tasks/console.rake
210
230
  - lib/capistrano/tasks/deploy.rake
211
231
  - lib/capistrano/tasks/doctor.rake
212
232
  - lib/capistrano/tasks/framework.rake
213
- - lib/capistrano/tasks/git.rake
214
- - lib/capistrano/tasks/hg.rake
215
233
  - lib/capistrano/tasks/install.rake
216
- - lib/capistrano/tasks/svn.rake
217
234
  - lib/capistrano/templates/Capfile
218
235
  - lib/capistrano/templates/deploy.rb.erb
219
236
  - lib/capistrano/templates/stage.rb.erb
@@ -227,6 +244,7 @@ files:
227
244
  - spec/lib/capistrano/configuration/filter_spec.rb
228
245
  - spec/lib/capistrano/configuration/host_filter_spec.rb
229
246
  - spec/lib/capistrano/configuration/null_filter_spec.rb
247
+ - spec/lib/capistrano/configuration/plugin_installer_spec.rb
230
248
  - spec/lib/capistrano/configuration/question_spec.rb
231
249
  - spec/lib/capistrano/configuration/role_filter_spec.rb
232
250
  - spec/lib/capistrano/configuration/server_spec.rb
@@ -240,12 +258,12 @@ files:
240
258
  - spec/lib/capistrano/dsl/paths_spec.rb
241
259
  - spec/lib/capistrano/dsl/task_enhancements_spec.rb
242
260
  - spec/lib/capistrano/dsl_spec.rb
243
- - spec/lib/capistrano/git_spec.rb
244
- - spec/lib/capistrano/hg_spec.rb
245
261
  - spec/lib/capistrano/immutable_task_spec.rb
246
262
  - spec/lib/capistrano/plugin_spec.rb
263
+ - spec/lib/capistrano/scm/git_spec.rb
264
+ - spec/lib/capistrano/scm/hg_spec.rb
265
+ - spec/lib/capistrano/scm/svn_spec.rb
247
266
  - spec/lib/capistrano/scm_spec.rb
248
- - spec/lib/capistrano/svn_spec.rb
249
267
  - spec/lib/capistrano/upload_task_spec.rb
250
268
  - spec/lib/capistrano/version_validator_spec.rb
251
269
  - spec/lib/capistrano_spec.rb
@@ -279,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
297
  version: '0'
280
298
  requirements: []
281
299
  rubyforge_project:
282
- rubygems_version: 2.6.6
300
+ rubygems_version: 2.6.8
283
301
  signing_key:
284
302
  specification_version: 4
285
303
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH
@@ -289,7 +307,6 @@ test_files:
289
307
  - features/deploy_failure.feature
290
308
  - features/doctor.feature
291
309
  - features/installation.feature
292
- - features/remote_file_task.feature
293
310
  - features/sshconnect.feature
294
311
  - features/stage_failure.feature
295
312
  - features/step_definitions/assertions.rb
@@ -305,6 +322,7 @@ test_files:
305
322
  - spec/lib/capistrano/configuration/filter_spec.rb
306
323
  - spec/lib/capistrano/configuration/host_filter_spec.rb
307
324
  - spec/lib/capistrano/configuration/null_filter_spec.rb
325
+ - spec/lib/capistrano/configuration/plugin_installer_spec.rb
308
326
  - spec/lib/capistrano/configuration/question_spec.rb
309
327
  - spec/lib/capistrano/configuration/role_filter_spec.rb
310
328
  - spec/lib/capistrano/configuration/server_spec.rb
@@ -318,12 +336,12 @@ test_files:
318
336
  - spec/lib/capistrano/dsl/paths_spec.rb
319
337
  - spec/lib/capistrano/dsl/task_enhancements_spec.rb
320
338
  - spec/lib/capistrano/dsl_spec.rb
321
- - spec/lib/capistrano/git_spec.rb
322
- - spec/lib/capistrano/hg_spec.rb
323
339
  - spec/lib/capistrano/immutable_task_spec.rb
324
340
  - spec/lib/capistrano/plugin_spec.rb
341
+ - spec/lib/capistrano/scm/git_spec.rb
342
+ - spec/lib/capistrano/scm/hg_spec.rb
343
+ - spec/lib/capistrano/scm/svn_spec.rb
325
344
  - spec/lib/capistrano/scm_spec.rb
326
- - spec/lib/capistrano/svn_spec.rb
327
345
  - spec/lib/capistrano/upload_task_spec.rb
328
346
  - spec/lib/capistrano/version_validator_spec.rb
329
347
  - spec/lib/capistrano_spec.rb
@@ -1,14 +0,0 @@
1
- Feature: Remote file task
2
-
3
- Background:
4
- Given a test app with the default configuration
5
- And a custom task to generate a file
6
- And servers with the roles app and web
7
-
8
- Scenario: Where the file does not exist
9
- When I run cap "deploy:check:linked_files"
10
- Then it creates the file with the remote_task prerequisite
11
-
12
- Scenario: Where the file already exists
13
- When I run cap "deploy:check:linked_files"
14
- Then it will not recreate the file
data/issue_template.md DELETED
@@ -1,21 +0,0 @@
1
- **Important:** GitHub issues are for feature requests or bug reports. The Capistrano team recommends you use [Stack Overflow](http://stackoverflow.com/questions/tagged/capistrano) for general questions. For more details, please see our [contribution policy](https://github.com/capistrano/capistrano/blob/master/CONTRIBUTING.md).
2
-
3
- ---
4
-
5
- #### Steps to reproduce
6
-
7
- 1. Lorem.
8
- 2. Ipsum..
9
- 3. Dolor...
10
-
11
- #### Expected behaviour
12
-
13
- Tell us what should happen
14
-
15
- #### Actual behaviour
16
-
17
- Tell us what happens instead
18
-
19
- #### Your configuration
20
-
21
- Paste Capistrano's `doctor` output here (`cap <stage> doctor`):
@@ -1,54 +0,0 @@
1
- load File.expand_path("../tasks/git.rake", __FILE__)
2
-
3
- require "capistrano/scm"
4
-
5
- class Capistrano::Git < Capistrano::SCM
6
- # execute git with argument in the context
7
- #
8
- def git(*args)
9
- args.unshift :git
10
- context.execute(*args)
11
- end
12
-
13
- # The Capistrano default strategy for git. You should want to use this.
14
- module DefaultStrategy
15
- def test
16
- test! " [ -f #{repo_path}/HEAD ] "
17
- end
18
-
19
- def check
20
- git :'ls-remote --heads', repo_url
21
- end
22
-
23
- def clone
24
- if (depth = fetch(:git_shallow_clone))
25
- git :clone, "--mirror", "--depth", depth, "--no-single-branch", repo_url, repo_path
26
- else
27
- git :clone, "--mirror", repo_url, repo_path
28
- end
29
- end
30
-
31
- def update
32
- # Note: Requires git version 1.9 or greater
33
- if (depth = fetch(:git_shallow_clone))
34
- git :fetch, "--depth", depth, "origin", fetch(:branch)
35
- else
36
- git :remote, :update, "--prune"
37
- end
38
- end
39
-
40
- def release
41
- if (tree = fetch(:repo_tree))
42
- tree = tree.slice %r#^/?(.*?)/?$#, 1
43
- components = tree.split("/").size
44
- git :archive, fetch(:branch), tree, "| tar -x --strip-components #{components} -f - -C", release_path
45
- else
46
- git :archive, fetch(:branch), "| tar -x -f - -C", release_path
47
- end
48
- end
49
-
50
- def fetch_revision
51
- context.capture(:git, "rev-list --max-count=1 #{fetch(:branch)}")
52
- end
53
- end
54
- end
data/lib/capistrano/hg.rb DELETED
@@ -1,43 +0,0 @@
1
- load File.expand_path("../tasks/hg.rake", __FILE__)
2
-
3
- require "capistrano/scm"
4
-
5
- class Capistrano::Hg < Capistrano::SCM
6
- # execute hg in context with arguments
7
- def hg(*args)
8
- args.unshift(:hg)
9
- context.execute(*args)
10
- end
11
-
12
- module DefaultStrategy
13
- def test
14
- test! " [ -d #{repo_path}/.hg ] "
15
- end
16
-
17
- def check
18
- hg "id", repo_url
19
- end
20
-
21
- def clone
22
- hg "clone", "--noupdate", repo_url, repo_path
23
- end
24
-
25
- def update
26
- hg "pull"
27
- end
28
-
29
- def release
30
- if (tree = fetch(:repo_tree))
31
- tree = tree.slice %r#^/?(.*?)/?$#, 1
32
- components = tree.split("/").size
33
- hg "archive --type tgz -p . -I", tree, "--rev", fetch(:branch), "| tar -x --strip-components #{components} -f - -C", release_path
34
- else
35
- hg "archive", release_path, "--rev", fetch(:branch)
36
- end
37
- end
38
-
39
- def fetch_revision
40
- context.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"")
41
- end
42
- end
43
- end
@@ -1,42 +0,0 @@
1
- load File.expand_path("../tasks/svn.rake", __FILE__)
2
-
3
- require "capistrano/scm"
4
-
5
- class Capistrano::Svn < Capistrano::SCM
6
- # execute svn in context with arguments
7
- def svn(*args)
8
- args.unshift(:svn)
9
- args.push "--username #{fetch(:svn_username)}" if fetch(:svn_username)
10
- args.push "--password #{fetch(:svn_password)}" if fetch(:svn_password)
11
- args.push "--revision #{fetch(:svn_revision)}" if fetch(:svn_revision)
12
- context.execute(*args)
13
- end
14
-
15
- module DefaultStrategy
16
- def test
17
- test! " [ -d #{repo_path}/.svn ] "
18
- end
19
-
20
- def check
21
- svn_username = fetch(:svn_username) ? "--username #{fetch(:svn_username)}" : ""
22
- svn_password = fetch(:svn_password) ? "--password #{fetch(:svn_password)}" : ""
23
- test! :svn, :info, repo_url, svn_username, svn_password
24
- end
25
-
26
- def clone
27
- svn :checkout, repo_url, repo_path
28
- end
29
-
30
- def update
31
- svn :update
32
- end
33
-
34
- def release
35
- svn :export, "--force", ".", release_path
36
- end
37
-
38
- def fetch_revision
39
- context.capture(:svnversion, repo_path)
40
- end
41
- end
42
- end
@@ -1,109 +0,0 @@
1
- require "spec_helper"
2
-
3
- require "capistrano/git"
4
-
5
- module Capistrano
6
- describe Git do
7
- let(:context) { Class.new.new }
8
- subject { Capistrano::Git.new(context, Capistrano::Git::DefaultStrategy) }
9
-
10
- describe "#git" do
11
- it "should call execute git in the context, with arguments" do
12
- context.expects(:execute).with(:git, :init)
13
- subject.git(:init)
14
- end
15
- end
16
- end
17
-
18
- describe Git::DefaultStrategy do
19
- let(:context) { Class.new.new }
20
- subject { Capistrano::Git.new(context, Capistrano::Git::DefaultStrategy) }
21
-
22
- describe "#test" do
23
- it "should call test for repo HEAD" do
24
- context.expects(:repo_path).returns("/path/to/repo")
25
- context.expects(:test).with " [ -f /path/to/repo/HEAD ] "
26
-
27
- subject.test
28
- end
29
- end
30
-
31
- describe "#check" do
32
- it "should test the repo url" do
33
- context.expects(:repo_url).returns(:url)
34
- context.expects(:execute).with(:git, :'ls-remote --heads', :url).returns(true)
35
-
36
- subject.check
37
- end
38
- end
39
-
40
- describe "#clone" do
41
- it "should run git clone" do
42
- context.expects(:fetch).with(:git_shallow_clone).returns(nil)
43
- context.expects(:repo_url).returns(:url)
44
- context.expects(:repo_path).returns(:path)
45
- context.expects(:execute).with(:git, :clone, "--mirror", :url, :path)
46
-
47
- subject.clone
48
- end
49
-
50
- it "should run git clone in shallow mode" do
51
- context.expects(:fetch).with(:git_shallow_clone).returns("1")
52
- context.expects(:repo_url).returns(:url)
53
- context.expects(:repo_path).returns(:path)
54
-
55
- context.expects(:execute).with(:git, :clone, "--mirror", "--depth", "1", "--no-single-branch", :url, :path)
56
-
57
- subject.clone
58
- end
59
- end
60
-
61
- describe "#update" do
62
- it "should run git update" do
63
- context.expects(:fetch).with(:git_shallow_clone).returns(nil)
64
- context.expects(:execute).with(:git, :remote, :update, "--prune")
65
-
66
- subject.update
67
- end
68
-
69
- it "should run git update in shallow mode" do
70
- context.expects(:fetch).with(:git_shallow_clone).returns("1")
71
- context.expects(:fetch).with(:branch).returns(:branch)
72
- context.expects(:execute).with(:git, :fetch, "--depth", "1", "origin", :branch)
73
-
74
- subject.update
75
- end
76
- end
77
-
78
- describe "#release" do
79
- it "should run git archive without a subtree" do
80
- context.expects(:fetch).with(:repo_tree).returns(nil)
81
- context.expects(:fetch).with(:branch).returns(:branch)
82
- context.expects(:release_path).returns(:path)
83
-
84
- context.expects(:execute).with(:git, :archive, :branch, "| tar -x -f - -C", :path)
85
-
86
- subject.release
87
- end
88
-
89
- it "should run git archive with a subtree" do
90
- context.expects(:fetch).with(:repo_tree).returns("tree")
91
- context.expects(:fetch).with(:branch).returns(:branch)
92
- context.expects(:release_path).returns(:path)
93
-
94
- context.expects(:execute).with(:git, :archive, :branch, "tree", "| tar -x --strip-components 1 -f - -C", :path)
95
-
96
- subject.release
97
- end
98
- end
99
-
100
- describe "#fetch_revision" do
101
- it "should capture git rev-list" do
102
- context.expects(:fetch).with(:branch).returns(:branch)
103
- context.expects(:capture).with(:git, "rev-list --max-count=1 branch").returns("81cec13b777ff46348693d327fc8e7832f79bf43")
104
- revision = subject.fetch_revision
105
- expect(revision).to eq("81cec13b777ff46348693d327fc8e7832f79bf43")
106
- end
107
- end
108
- end
109
- end
@@ -1,90 +0,0 @@
1
- require "spec_helper"
2
-
3
- require "capistrano/hg"
4
-
5
- module Capistrano
6
- describe Hg do
7
- let(:context) { Class.new.new }
8
- subject { Capistrano::Hg.new(context, Capistrano::Hg::DefaultStrategy) }
9
-
10
- describe "#hg" do
11
- it "should call execute hg in the context, with arguments" do
12
- context.expects(:execute).with(:hg, :init)
13
- subject.hg(:init)
14
- end
15
- end
16
- end
17
-
18
- describe Hg::DefaultStrategy do
19
- let(:context) { Class.new.new }
20
- subject { Capistrano::Hg.new(context, Capistrano::Hg::DefaultStrategy) }
21
-
22
- describe "#test" do
23
- it "should call test for repo HEAD" do
24
- context.expects(:repo_path).returns("/path/to/repo")
25
- context.expects(:test).with " [ -d /path/to/repo/.hg ] "
26
-
27
- subject.test
28
- end
29
- end
30
-
31
- describe "#check" do
32
- it "should test the repo url" do
33
- context.expects(:repo_url).returns(:url)
34
- context.expects(:execute).with(:hg, "id", :url)
35
-
36
- subject.check
37
- end
38
- end
39
-
40
- describe "#clone" do
41
- it "should run hg clone" do
42
- context.expects(:repo_url).returns(:url)
43
- context.expects(:repo_path).returns(:path)
44
-
45
- context.expects(:execute).with(:hg, "clone", "--noupdate", :url, :path)
46
-
47
- subject.clone
48
- end
49
- end
50
-
51
- describe "#update" do
52
- it "should run hg update" do
53
- context.expects(:execute).with(:hg, "pull")
54
-
55
- subject.update
56
- end
57
- end
58
-
59
- describe "#release" do
60
- it "should run hg archive without a subtree" do
61
- context.expects(:fetch).with(:repo_tree).returns(nil)
62
- context.expects(:fetch).with(:branch).returns(:branch)
63
- context.expects(:release_path).returns(:path)
64
-
65
- context.expects(:execute).with(:hg, "archive", :path, "--rev", :branch)
66
-
67
- subject.release
68
- end
69
-
70
- it "should run hg archive with a subtree" do
71
- context.expects(:fetch).with(:repo_tree).returns("tree")
72
- context.expects(:fetch).with(:branch).returns(:branch)
73
- context.expects(:release_path).returns(:path)
74
-
75
- context.expects(:execute).with(:hg, "archive --type tgz -p . -I", "tree", "--rev", :branch, "| tar -x --strip-components 1 -f - -C", :path)
76
-
77
- subject.release
78
- end
79
- end
80
-
81
- describe "#fetch_revision" do
82
- it "should capture hg log" do
83
- context.expects(:fetch).with(:branch).returns(:branch)
84
- context.expects(:capture).with(:hg, "log --rev branch --template \"{node}\n\"").returns("01abcde")
85
- revision = subject.fetch_revision
86
- expect(revision).to eq("01abcde")
87
- end
88
- end
89
- end
90
- end
@@ -1,105 +0,0 @@
1
- require "spec_helper"
2
-
3
- require "capistrano/svn"
4
-
5
- module Capistrano
6
- describe Svn do
7
- let(:context) { Class.new.new }
8
- subject { Capistrano::Svn.new(context, Capistrano::Svn::DefaultStrategy) }
9
-
10
- describe "#svn" do
11
- it "should call execute svn in the context, with arguments" do
12
- context.expects(:execute).with(:svn, :init, "--username someuser", "--password somepassword")
13
- context.expects(:fetch).twice.with(:svn_username).returns("someuser")
14
- context.expects(:fetch).twice.with(:svn_password).returns("somepassword")
15
- context.expects(:fetch).once.with(:svn_revision).returns(nil)
16
- subject.svn(:init)
17
- end
18
- end
19
- end
20
-
21
- describe Svn::DefaultStrategy do
22
- let(:context) { Class.new.new }
23
- subject { Capistrano::Svn.new(context, Capistrano::Svn::DefaultStrategy) }
24
-
25
- describe "#test" do
26
- it "should call test for repo HEAD" do
27
- context.expects(:repo_path).returns("/path/to/repo")
28
- context.expects(:test).with " [ -d /path/to/repo/.svn ] "
29
-
30
- subject.test
31
- end
32
- end
33
-
34
- describe "#check" do
35
- it "should test the repo url" do
36
- context.expects(:repo_url).returns(:url)
37
- context.expects(:test).with(:svn, :info, :url, "--username someuser", "--password somepassword").returns(true)
38
- context.expects(:fetch).twice.with(:svn_username).returns("someuser")
39
- context.expects(:fetch).twice.with(:svn_password).returns("somepassword")
40
-
41
- subject.check
42
- end
43
- end
44
-
45
- describe "#clone" do
46
- it "should run svn checkout" do
47
- context.expects(:repo_url).returns(:url)
48
- context.expects(:repo_path).returns(:path)
49
- context.expects(:fetch).twice.with(:svn_username).returns("someuser")
50
- context.expects(:fetch).twice.with(:svn_password).returns("somepassword")
51
- context.expects(:fetch).once.with(:svn_revision).returns(nil)
52
-
53
- context.expects(:execute).with(:svn, :checkout, :url, :path, "--username someuser", "--password somepassword")
54
-
55
- subject.clone
56
- end
57
- end
58
-
59
- describe "#update" do
60
- it "should run svn update" do
61
- context.expects(:execute).with(:svn, :update, "--username someuser", "--password somepassword")
62
- context.expects(:fetch).twice.with(:svn_username).returns("someuser")
63
- context.expects(:fetch).twice.with(:svn_password).returns("somepassword")
64
- context.expects(:fetch).once.with(:svn_revision).returns(nil)
65
-
66
- subject.update
67
- end
68
- end
69
-
70
- describe "#update_specific_revision" do
71
- it "should run svn update and update to a specific revision" do
72
- context.expects(:execute).with(:svn, :update, "--username someuser", "--password somepassword", "--revision 12345")
73
- context.expects(:fetch).twice.with(:svn_username).returns("someuser")
74
- context.expects(:fetch).twice.with(:svn_password).returns("somepassword")
75
- context.expects(:fetch).twice.with(:svn_revision).returns("12345")
76
-
77
- subject.update
78
- end
79
- end
80
-
81
- describe "#release" do
82
- it "should run svn export" do
83
- context.expects(:release_path).returns(:path)
84
- context.expects(:fetch).twice.with(:svn_username).returns("someuser")
85
- context.expects(:fetch).twice.with(:svn_password).returns("somepassword")
86
- context.expects(:fetch).once.with(:svn_revision).returns(nil)
87
-
88
- context.expects(:execute).with(:svn, :export, "--force", ".", :path, "--username someuser", "--password somepassword")
89
-
90
- subject.release
91
- end
92
- end
93
-
94
- describe "#fetch_revision" do
95
- it "should capture svn version" do
96
- context.expects(:repo_path).returns(:path)
97
-
98
- context.expects(:capture).with(:svnversion, :path).returns("12345")
99
-
100
- revision = subject.fetch_revision
101
- expect(revision).to eq("12345")
102
- end
103
- end
104
- end
105
- end