capistrano 3.4.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -5
- data/.rubocop.yml +49 -0
- data/.travis.yml +5 -4
- data/CHANGELOG.md +72 -9
- data/CONTRIBUTING.md +61 -93
- data/DEVELOPMENT.md +122 -0
- data/Gemfile +2 -2
- data/LICENSE.txt +1 -1
- data/README.md +121 -43
- data/RELEASING.md +16 -0
- data/Rakefile +4 -1
- data/bin/cap +1 -1
- data/capistrano.gemspec +16 -21
- data/features/doctor.feature +11 -0
- data/features/step_definitions/assertions.rb +17 -17
- data/features/step_definitions/cap_commands.rb +0 -1
- data/features/step_definitions/setup.rb +12 -8
- data/features/support/env.rb +5 -5
- data/features/support/remote_command_helpers.rb +8 -6
- data/features/support/vagrant_helpers.rb +5 -4
- data/issue_template.md +21 -0
- data/lib/Capfile +5 -1
- data/lib/capistrano/all.rb +9 -10
- data/lib/capistrano/application.rb +36 -26
- data/lib/capistrano/configuration.rb +56 -41
- data/lib/capistrano/configuration/empty_filter.rb +9 -0
- data/lib/capistrano/configuration/filter.rb +18 -47
- data/lib/capistrano/configuration/host_filter.rb +30 -0
- data/lib/capistrano/configuration/null_filter.rb +9 -0
- data/lib/capistrano/configuration/plugin_installer.rb +33 -0
- data/lib/capistrano/configuration/question.rb +10 -7
- data/lib/capistrano/configuration/role_filter.rb +30 -0
- data/lib/capistrano/configuration/server.rb +22 -23
- data/lib/capistrano/configuration/servers.rb +6 -7
- data/lib/capistrano/configuration/variables.rb +136 -0
- data/lib/capistrano/defaults.rb +13 -3
- data/lib/capistrano/deploy.rb +1 -1
- data/lib/capistrano/doctor.rb +5 -0
- data/lib/capistrano/doctor/environment_doctor.rb +19 -0
- data/lib/capistrano/doctor/gems_doctor.rb +45 -0
- data/lib/capistrano/doctor/output_helpers.rb +79 -0
- data/lib/capistrano/doctor/variables_doctor.rb +66 -0
- data/lib/capistrano/dotfile.rb +1 -2
- data/lib/capistrano/dsl.rb +12 -14
- data/lib/capistrano/dsl/env.rb +11 -42
- data/lib/capistrano/dsl/paths.rb +12 -13
- data/lib/capistrano/dsl/stages.rb +2 -4
- data/lib/capistrano/dsl/task_enhancements.rb +5 -7
- data/lib/capistrano/framework.rb +1 -1
- data/lib/capistrano/git.rb +17 -9
- data/lib/capistrano/hg.rb +4 -4
- data/lib/capistrano/i18n.rb +24 -24
- data/lib/capistrano/immutable_task.rb +29 -0
- data/lib/capistrano/install.rb +1 -1
- data/lib/capistrano/plugin.rb +95 -0
- data/lib/capistrano/scm.rb +7 -20
- data/lib/capistrano/setup.rb +19 -5
- data/lib/capistrano/svn.rb +9 -5
- data/lib/capistrano/tasks/console.rake +4 -8
- data/lib/capistrano/tasks/deploy.rake +75 -62
- data/lib/capistrano/tasks/doctor.rake +19 -0
- data/lib/capistrano/tasks/framework.rake +13 -14
- data/lib/capistrano/tasks/git.rake +10 -11
- data/lib/capistrano/tasks/hg.rake +7 -7
- data/lib/capistrano/tasks/install.rake +14 -15
- data/lib/capistrano/tasks/svn.rake +7 -7
- data/lib/capistrano/templates/Capfile +3 -3
- data/lib/capistrano/templates/deploy.rb.erb +6 -5
- data/lib/capistrano/upload_task.rb +1 -1
- data/lib/capistrano/version.rb +1 -1
- data/lib/capistrano/version_validator.rb +4 -6
- data/spec/integration/dsl_spec.rb +286 -239
- data/spec/integration_spec_helper.rb +3 -5
- data/spec/lib/capistrano/application_spec.rb +22 -14
- data/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
- data/spec/lib/capistrano/configuration/filter_spec.rb +82 -84
- data/spec/lib/capistrano/configuration/host_filter_spec.rb +61 -0
- data/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
- data/spec/lib/capistrano/configuration/question_spec.rb +12 -16
- data/spec/lib/capistrano/configuration/role_filter_spec.rb +64 -0
- data/spec/lib/capistrano/configuration/server_spec.rb +102 -110
- data/spec/lib/capistrano/configuration/servers_spec.rb +124 -141
- data/spec/lib/capistrano/configuration_spec.rb +150 -61
- data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
- data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +61 -0
- data/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
- data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +79 -0
- data/spec/lib/capistrano/dsl/paths_spec.rb +58 -50
- data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +62 -32
- data/spec/lib/capistrano/dsl_spec.rb +6 -8
- data/spec/lib/capistrano/git_spec.rb +35 -7
- data/spec/lib/capistrano/hg_spec.rb +14 -5
- data/spec/lib/capistrano/immutable_task_spec.rb +31 -0
- data/spec/lib/capistrano/plugin_spec.rb +84 -0
- data/spec/lib/capistrano/scm_spec.rb +6 -7
- data/spec/lib/capistrano/svn_spec.rb +40 -14
- data/spec/lib/capistrano/upload_task_spec.rb +7 -7
- data/spec/lib/capistrano/version_validator_spec.rb +37 -45
- data/spec/lib/capistrano_spec.rb +2 -3
- data/spec/spec_helper.rb +8 -8
- data/spec/support/Vagrantfile +9 -10
- data/spec/support/tasks/database.rake +3 -3
- data/spec/support/tasks/fail.rake +4 -3
- data/spec/support/tasks/failed.rake +2 -2
- data/spec/support/tasks/plugin.rake +6 -0
- data/spec/support/tasks/root.rake +4 -4
- data/spec/support/test_app.rb +31 -30
- metadata +93 -14
@@ -1,7 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Capistrano
|
4
|
-
|
5
4
|
class DummyDSL
|
6
5
|
include DSL
|
7
6
|
end
|
@@ -12,10 +11,10 @@ module Capistrano
|
|
12
11
|
|
13
12
|
describe '#t' do
|
14
13
|
before do
|
15
|
-
I18n.expects(:t).with(:phrase,
|
14
|
+
I18n.expects(:t).with(:phrase, count: 2, scope: :capistrano)
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
17
|
+
it "delegates to I18n" do
|
19
18
|
dsl.t(:phrase, count: 2)
|
20
19
|
end
|
21
20
|
end
|
@@ -23,14 +22,14 @@ module Capistrano
|
|
23
22
|
describe '#stage_set?' do
|
24
23
|
subject { dsl.stage_set? }
|
25
24
|
|
26
|
-
context
|
25
|
+
context "stage is set" do
|
27
26
|
before do
|
28
27
|
dsl.set(:stage, :sandbox)
|
29
28
|
end
|
30
29
|
it { expect(subject).to be_truthy }
|
31
30
|
end
|
32
31
|
|
33
|
-
context
|
32
|
+
context "stage is not set" do
|
34
33
|
before do
|
35
34
|
dsl.set(:stage, nil)
|
36
35
|
end
|
@@ -39,12 +38,11 @@ module Capistrano
|
|
39
38
|
end
|
40
39
|
|
41
40
|
describe '#sudo' do
|
42
|
-
|
43
41
|
before do
|
44
42
|
dsl.expects(:execute).with(:sudo, :my, :command)
|
45
43
|
end
|
46
44
|
|
47
|
-
it
|
45
|
+
it "prepends sudo, delegates to execute" do
|
48
46
|
dsl.sudo(:my, :command)
|
49
47
|
end
|
50
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "capistrano/git"
|
4
4
|
|
5
5
|
module Capistrano
|
6
6
|
describe Git do
|
@@ -39,10 +39,20 @@ module Capistrano
|
|
39
39
|
|
40
40
|
describe "#clone" do
|
41
41
|
it "should run git clone" do
|
42
|
+
context.expects(:fetch).with(:git_shallow_clone).returns(nil)
|
42
43
|
context.expects(:repo_url).returns(:url)
|
43
44
|
context.expects(:repo_path).returns(:path)
|
45
|
+
context.expects(:execute).with(:git, :clone, "--mirror", :url, :path)
|
44
46
|
|
45
|
-
|
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)
|
46
56
|
|
47
57
|
subject.clone
|
48
58
|
end
|
@@ -50,7 +60,16 @@ module Capistrano
|
|
50
60
|
|
51
61
|
describe "#update" do
|
52
62
|
it "should run git update" do
|
53
|
-
context.expects(:
|
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)
|
54
73
|
|
55
74
|
subject.update
|
56
75
|
end
|
@@ -62,20 +81,29 @@ module Capistrano
|
|
62
81
|
context.expects(:fetch).with(:branch).returns(:branch)
|
63
82
|
context.expects(:release_path).returns(:path)
|
64
83
|
|
65
|
-
context.expects(:execute).with(:git, :archive, :branch,
|
84
|
+
context.expects(:execute).with(:git, :archive, :branch, "| tar -x -f - -C", :path)
|
66
85
|
|
67
86
|
subject.release
|
68
87
|
end
|
69
88
|
|
70
89
|
it "should run git archive with a subtree" do
|
71
|
-
context.expects(:fetch).with(:repo_tree).returns(
|
90
|
+
context.expects(:fetch).with(:repo_tree).returns("tree")
|
72
91
|
context.expects(:fetch).with(:branch).returns(:branch)
|
73
92
|
context.expects(:release_path).returns(:path)
|
74
93
|
|
75
|
-
context.expects(:execute).with(:git, :archive, :branch,
|
94
|
+
context.expects(:execute).with(:git, :archive, :branch, "tree", "| tar -x --strip-components 1 -f - -C", :path)
|
76
95
|
|
77
96
|
subject.release
|
78
97
|
end
|
79
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
|
80
108
|
end
|
81
109
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "capistrano/hg"
|
4
4
|
|
5
5
|
module Capistrano
|
6
6
|
describe Hg do
|
@@ -42,7 +42,7 @@ module Capistrano
|
|
42
42
|
context.expects(:repo_url).returns(:url)
|
43
43
|
context.expects(:repo_path).returns(:path)
|
44
44
|
|
45
|
-
context.expects(:execute).with(:hg, "clone",
|
45
|
+
context.expects(:execute).with(:hg, "clone", "--noupdate", :url, :path)
|
46
46
|
|
47
47
|
subject.clone
|
48
48
|
end
|
@@ -68,14 +68,23 @@ module Capistrano
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should run hg archive with a subtree" do
|
71
|
-
context.expects(:fetch).with(:repo_tree).returns(
|
71
|
+
context.expects(:fetch).with(:repo_tree).returns("tree")
|
72
72
|
context.expects(:fetch).with(:branch).returns(:branch)
|
73
73
|
context.expects(:release_path).returns(:path)
|
74
74
|
|
75
|
-
context.expects(:execute).with(:hg, "archive --type tgz -p . -I",
|
75
|
+
context.expects(:execute).with(:hg, "archive --type tgz -p . -I", "tree", "--rev", :branch, "| tar -x --strip-components 1 -f - -C", :path)
|
76
76
|
|
77
77
|
subject.release
|
78
78
|
end
|
79
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
|
80
89
|
end
|
81
90
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rake"
|
3
|
+
require "capistrano/immutable_task"
|
4
|
+
|
5
|
+
module Capistrano
|
6
|
+
describe ImmutableTask do
|
7
|
+
after do
|
8
|
+
# Ensure that any tasks we create in these tests don't pollute other tests
|
9
|
+
Rake::Task.clear
|
10
|
+
end
|
11
|
+
|
12
|
+
it "prints warning and raises when task is enhanced" do
|
13
|
+
extend(Rake::DSL)
|
14
|
+
|
15
|
+
load_defaults = Rake::Task.define_task("load:defaults")
|
16
|
+
load_defaults.extend(Capistrano::ImmutableTask)
|
17
|
+
|
18
|
+
$stderr.expects(:puts).with do |message|
|
19
|
+
message =~ /^WARNING: load:defaults has already been invoked/
|
20
|
+
end
|
21
|
+
|
22
|
+
expect do
|
23
|
+
namespace :load do
|
24
|
+
task :defaults do
|
25
|
+
# Never reached since load_defaults is frozen and can't be enhanced
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end.to raise_error(/frozen/i)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "capistrano/plugin"
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
describe Plugin do
|
6
|
+
include Rake::DSL
|
7
|
+
include Capistrano::DSL
|
8
|
+
|
9
|
+
class DummyPlugin < Capistrano::Plugin
|
10
|
+
def define_tasks
|
11
|
+
task :hello do
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def register_hooks
|
16
|
+
before "deploy:published", "hello"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class ExternalTasksPlugin < Capistrano::Plugin
|
21
|
+
def define_tasks
|
22
|
+
eval_rakefile(
|
23
|
+
File.expand_path("../../../support/tasks/plugin.rake", __FILE__)
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Called from plugin.rake to demonstrate that helper methods work
|
28
|
+
def hello
|
29
|
+
set :plugin_result, "hello"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
before do
|
34
|
+
# Define an example task to allow testing hooks
|
35
|
+
task "deploy:published"
|
36
|
+
end
|
37
|
+
|
38
|
+
after do
|
39
|
+
# Clean up any tasks or variables we created during the tests
|
40
|
+
Rake::Task.clear
|
41
|
+
Capistrano::Configuration.reset!
|
42
|
+
end
|
43
|
+
|
44
|
+
it "defines tasks when constructed" do
|
45
|
+
install_plugin(DummyPlugin)
|
46
|
+
expect(Rake::Task["hello"]).not_to be_nil
|
47
|
+
end
|
48
|
+
|
49
|
+
it "registers hooks when constructed" do
|
50
|
+
install_plugin(DummyPlugin)
|
51
|
+
expect(Rake::Task["deploy:published"].prerequisites).to include("hello")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "skips registering hooks if load_hooks: false" do
|
55
|
+
install_plugin(DummyPlugin, load_hooks: false)
|
56
|
+
expect(Rake::Task["deploy:published"].prerequisites).to be_empty
|
57
|
+
end
|
58
|
+
|
59
|
+
it "doesn't call set_defaults immediately" do
|
60
|
+
dummy = DummyPlugin.new
|
61
|
+
install_plugin(dummy)
|
62
|
+
dummy.expects(:set_defaults).never
|
63
|
+
end
|
64
|
+
|
65
|
+
it "calls set_defaults during load:defaults" do
|
66
|
+
dummy = DummyPlugin.new
|
67
|
+
dummy.expects(:set_defaults).once
|
68
|
+
install_plugin(dummy)
|
69
|
+
Rake::Task["load:defaults"].invoke
|
70
|
+
end
|
71
|
+
|
72
|
+
it "is able to load tasks from a .rake file" do
|
73
|
+
install_plugin(ExternalTasksPlugin)
|
74
|
+
Rake::Task["plugin_test"].invoke
|
75
|
+
expect(fetch(:plugin_result)).to eq("hello")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "exposes the SSHKit backend to subclasses" do
|
79
|
+
SSHKit::Backend.expects(:current).returns(:backend)
|
80
|
+
plugin = DummyPlugin.new
|
81
|
+
expect(plugin.send(:backend)).to eq(:backend)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "capistrano/scm"
|
4
4
|
|
5
5
|
module RaiseNotImplementedMacro
|
6
6
|
def raise_not_implemented_on(method)
|
7
7
|
it "should raise NotImplemented on #{method}" do
|
8
|
-
expect
|
8
|
+
expect do
|
9
9
|
subject.send(method)
|
10
|
-
|
10
|
+
end.to raise_error(NotImplementedError)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -63,8 +63,8 @@ module Capistrano
|
|
63
63
|
|
64
64
|
describe "#release_path" do
|
65
65
|
it "should return the release path according to the context" do
|
66
|
-
context.expects(:release_path).returns(
|
67
|
-
expect(subject.release_path).to eq(
|
66
|
+
context.expects(:release_path).returns("/path/to/nowhere")
|
67
|
+
expect(subject.release_path).to eq("/path/to/nowhere")
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -101,4 +101,3 @@ module Capistrano
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "capistrano/svn"
|
4
4
|
|
5
5
|
module Capistrano
|
6
6
|
describe Svn do
|
@@ -9,7 +9,10 @@ module Capistrano
|
|
9
9
|
|
10
10
|
describe "#svn" do
|
11
11
|
it "should call execute svn in the context, with arguments" do
|
12
|
-
context.expects(:execute).with(:svn, :init)
|
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)
|
13
16
|
subject.svn(:init)
|
14
17
|
end
|
15
18
|
end
|
@@ -20,7 +23,7 @@ module Capistrano
|
|
20
23
|
subject { Capistrano::Svn.new(context, Capistrano::Svn::DefaultStrategy) }
|
21
24
|
|
22
25
|
describe "#test" do
|
23
|
-
it "should call test for repo HEAD" do
|
26
|
+
it "should call test for repo HEAD" do
|
24
27
|
context.expects(:repo_path).returns("/path/to/repo")
|
25
28
|
context.expects(:test).with " [ -d /path/to/repo/.svn ] "
|
26
29
|
|
@@ -31,7 +34,9 @@ module Capistrano
|
|
31
34
|
describe "#check" do
|
32
35
|
it "should test the repo url" do
|
33
36
|
context.expects(:repo_url).returns(:url)
|
34
|
-
context.expects(:test).with(:svn, :info, :url).returns(true)
|
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")
|
35
40
|
|
36
41
|
subject.check
|
37
42
|
end
|
@@ -41,8 +46,11 @@ module Capistrano
|
|
41
46
|
it "should run svn checkout" do
|
42
47
|
context.expects(:repo_url).returns(:url)
|
43
48
|
context.expects(:repo_path).returns(:path)
|
44
|
-
|
45
|
-
context.expects(:
|
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")
|
46
54
|
|
47
55
|
subject.clone
|
48
56
|
end
|
@@ -50,29 +58,47 @@ module Capistrano
|
|
50
58
|
|
51
59
|
describe "#update" do
|
52
60
|
it "should run svn update" do
|
53
|
-
context.expects(:execute).with(:svn, :update)
|
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")
|
54
76
|
|
55
77
|
subject.update
|
56
78
|
end
|
57
79
|
end
|
58
80
|
|
59
81
|
describe "#release" do
|
60
|
-
it "should run svn export" do
|
82
|
+
it "should run svn export" do
|
61
83
|
context.expects(:release_path).returns(:path)
|
62
|
-
|
63
|
-
context.expects(:
|
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")
|
64
89
|
|
65
90
|
subject.release
|
66
91
|
end
|
67
92
|
end
|
68
93
|
|
69
94
|
describe "#fetch_revision" do
|
70
|
-
it "should
|
95
|
+
it "should capture svn version" do
|
71
96
|
context.expects(:repo_path).returns(:path)
|
72
97
|
|
73
|
-
context.expects(:capture).with(:svnversion, :path)
|
98
|
+
context.expects(:capture).with(:svnversion, :path).returns("12345")
|
74
99
|
|
75
|
-
subject.fetch_revision
|
100
|
+
revision = subject.fetch_revision
|
101
|
+
expect(revision).to eq("12345")
|
76
102
|
end
|
77
103
|
end
|
78
104
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Capistrano::UploadTask do
|
4
4
|
let(:app) { Rake.application = Rake::Application.new }
|
5
5
|
|
6
|
-
subject(:upload_task) { described_class.define_task(
|
6
|
+
subject(:upload_task) { described_class.define_task("path/file.yml") }
|
7
7
|
|
8
8
|
it { is_expected.to be_a(Rake::FileCreationTask) }
|
9
9
|
it { is_expected.to be_needed }
|
10
10
|
|
11
|
-
context
|
12
|
-
let(:normal_task) { Rake::Task.define_task(
|
11
|
+
context "inside namespace" do
|
12
|
+
let(:normal_task) { Rake::Task.define_task("path/other_file.yml") }
|
13
13
|
|
14
|
-
around { |ex| app.in_namespace(
|
14
|
+
around { |ex| app.in_namespace("namespace", &ex) }
|
15
15
|
|
16
|
-
it { expect(upload_task.name).to eq(
|
17
|
-
it { expect(upload_task.scope.path).to eq(
|
16
|
+
it { expect(upload_task.name).to eq("path/file.yml") }
|
17
|
+
it { expect(upload_task.scope.path).to eq("namespace") }
|
18
18
|
end
|
19
19
|
end
|