capistrano 3.2.1 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -3
- data/CHANGELOG.md +92 -2
- data/Gemfile +1 -5
- data/README.md +84 -3
- data/Rakefile +5 -1
- data/capistrano.gemspec +5 -1
- data/features/configuration.feature +9 -7
- data/features/deploy.feature +9 -8
- data/features/step_definitions/assertions.rb +15 -17
- data/features/step_definitions/cap_commands.rb +1 -1
- data/features/step_definitions/setup.rb +11 -7
- data/features/support/env.rb +8 -9
- data/features/support/remote_command_helpers.rb +2 -3
- data/features/support/vagrant_helpers.rb +35 -0
- data/lib/capistrano/all.rb +2 -1
- data/lib/capistrano/application.rb +52 -7
- data/lib/capistrano/configuration.rb +39 -10
- data/lib/capistrano/configuration/filter.rb +56 -0
- data/lib/capistrano/configuration/question.rb +23 -11
- data/lib/capistrano/configuration/server.rb +14 -5
- data/lib/capistrano/configuration/servers.rb +12 -29
- data/lib/capistrano/defaults.rb +11 -9
- data/lib/capistrano/deploy.rb +1 -0
- data/lib/capistrano/dsl.rb +13 -2
- data/lib/capistrano/dsl/env.rb +6 -2
- data/lib/capistrano/dsl/task_enhancements.rb +5 -3
- data/lib/capistrano/git.rb +8 -2
- data/lib/capistrano/hg.rb +7 -1
- data/lib/capistrano/svn.rb +2 -2
- data/lib/capistrano/tasks/deploy.rake +12 -10
- data/lib/capistrano/tasks/git.rake +1 -1
- data/lib/capistrano/tasks/install.rake +17 -14
- data/lib/capistrano/templates/Capfile +6 -4
- data/lib/capistrano/templates/deploy.rb.erb +5 -15
- data/lib/capistrano/upload_task.rb +9 -0
- data/lib/capistrano/version.rb +1 -1
- data/spec/integration/dsl_spec.rb +129 -10
- data/spec/lib/capistrano/application_spec.rb +24 -6
- data/spec/lib/capistrano/configuration/filter_spec.rb +105 -0
- data/spec/lib/capistrano/configuration/question_spec.rb +18 -12
- data/spec/lib/capistrano/configuration/server_spec.rb +19 -19
- data/spec/lib/capistrano/configuration/servers_spec.rb +101 -20
- data/spec/lib/capistrano/configuration_spec.rb +24 -3
- data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +88 -0
- data/spec/lib/capistrano/dsl_spec.rb +2 -13
- data/spec/lib/capistrano/git_spec.rb +15 -4
- data/spec/lib/capistrano/hg_spec.rb +13 -2
- data/spec/lib/capistrano/scm_spec.rb +3 -3
- data/spec/lib/capistrano/svn_spec.rb +11 -1
- data/spec/lib/capistrano/upload_task_spec.rb +19 -0
- data/spec/lib/capistrano/version_validator_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -1
- data/spec/support/Vagrantfile +1 -1
- data/spec/support/test_app.rb +2 -0
- metadata +45 -26
- data/lib/capistrano/configuration/servers/host_filter.rb +0 -82
- data/lib/capistrano/configuration/servers/role_filter.rb +0 -86
- data/spec/lib/capistrano/configuration/servers/host_filter_spec.rb +0 -84
- data/spec/lib/capistrano/configuration/servers/role_filter_spec.rb +0 -140
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Capistrano
|
4
|
-
class Configuration
|
5
|
-
class Servers
|
6
|
-
|
7
|
-
describe HostFilter do
|
8
|
-
let(:host_filter) { HostFilter.new(available) }
|
9
|
-
let(:available) { [ Server.new('server1'), Server.new('server2'), Server.new('server3') ] }
|
10
|
-
|
11
|
-
describe '#new' do
|
12
|
-
it 'takes one array of hostnames' do
|
13
|
-
expect(host_filter)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '.for' do
|
18
|
-
|
19
|
-
subject { HostFilter.for(available) }
|
20
|
-
|
21
|
-
context 'without env vars' do
|
22
|
-
it 'returns all available hosts' do
|
23
|
-
expect(subject).to eq available
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with ENV vars' do
|
28
|
-
before do
|
29
|
-
ENV.stubs(:[]).with('HOSTS').returns('server1,server2')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns all required hosts defined in HOSTS' do
|
33
|
-
expect(subject).to eq [Server.new('server1'), Server.new('server2')]
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'with configuration filters' do
|
38
|
-
before do
|
39
|
-
Configuration.env.set(:filter, hosts: %w{server1 server2})
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'returns all required hosts defined in the filter' do
|
43
|
-
expect(subject).to eq [Server.new('server1'), Server.new('server2')]
|
44
|
-
end
|
45
|
-
|
46
|
-
after do
|
47
|
-
Configuration.env.delete(:filter)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'with a single configuration filter' do
|
52
|
-
before do
|
53
|
-
Configuration.env.set(:filter, hosts: 'server3')
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'returns all required hosts defined in the filter' do
|
57
|
-
expect(subject).to eq [Server.new('server3')]
|
58
|
-
end
|
59
|
-
|
60
|
-
after do
|
61
|
-
Configuration.env.delete(:filter)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'with configuration filters and ENV vars' do
|
66
|
-
before do
|
67
|
-
Configuration.env.set(:filter, hosts: 'server1')
|
68
|
-
ENV.stubs(:[]).with('HOSTS').returns('server3')
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'returns all required hosts defined in the filter' do
|
72
|
-
expect(subject).to eq [Server.new('server1'), Server.new('server3')]
|
73
|
-
end
|
74
|
-
|
75
|
-
after do
|
76
|
-
Configuration.env.delete(:filter)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,140 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Capistrano
|
4
|
-
class Configuration
|
5
|
-
class Servers
|
6
|
-
|
7
|
-
describe RoleFilter do
|
8
|
-
let(:role_filter) { RoleFilter.new(required, available) }
|
9
|
-
let(:required) { [] }
|
10
|
-
let(:available) { [:web, :app, :db] }
|
11
|
-
|
12
|
-
describe '#new' do
|
13
|
-
it 'takes two arrays of role names' do
|
14
|
-
expect(role_filter)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '.for' do
|
19
|
-
|
20
|
-
subject { RoleFilter.for(required, available) }
|
21
|
-
|
22
|
-
context 'without env vars' do
|
23
|
-
context ':all required' do
|
24
|
-
let(:required) { [:all] }
|
25
|
-
|
26
|
-
it 'returns all available names' do
|
27
|
-
expect(subject).to eq available
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'role names required' do
|
32
|
-
let(:required) { [:web, :app] }
|
33
|
-
it 'returns all required names' do
|
34
|
-
expect(subject).to eq required
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'with ENV vars' do
|
40
|
-
before do
|
41
|
-
ENV.stubs(:[]).with('ROLES').returns('app,web')
|
42
|
-
end
|
43
|
-
|
44
|
-
context ':all required' do
|
45
|
-
let(:required) { [:all] }
|
46
|
-
|
47
|
-
it 'returns available names defined in ROLES' do
|
48
|
-
expect(subject).to eq [:app, :web]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'role names required' do
|
53
|
-
let(:required) { [:web, :db] }
|
54
|
-
it 'returns all required names defined in ROLES' do
|
55
|
-
expect(subject).to eq [:web]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'with configuration filters' do
|
61
|
-
before do
|
62
|
-
Configuration.env.set(:filter, roles: %w{app web})
|
63
|
-
end
|
64
|
-
|
65
|
-
context ':all required' do
|
66
|
-
let(:required) { [:all] }
|
67
|
-
|
68
|
-
it 'returns available names defined in the filter' do
|
69
|
-
expect(subject).to eq [:app, :web]
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'role names required' do
|
74
|
-
let(:required) { [:web, :db] }
|
75
|
-
it 'returns all required names defined in the filter' do
|
76
|
-
expect(subject).to eq [:web]
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
after do
|
81
|
-
Configuration.env.delete(:filter)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'with a single configuration filter' do
|
86
|
-
before do
|
87
|
-
Configuration.env.set(:filter, roles: 'web')
|
88
|
-
end
|
89
|
-
|
90
|
-
context ':all required' do
|
91
|
-
let(:required) { [:all] }
|
92
|
-
|
93
|
-
it 'returns available names defined in the filter' do
|
94
|
-
expect(subject).to eq [:web]
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context 'role names required' do
|
99
|
-
let(:required) { [:web, :db] }
|
100
|
-
it 'returns all required names defined in the filter' do
|
101
|
-
expect(subject).to eq [:web]
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
after do
|
106
|
-
Configuration.env.delete(:filter)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'with configuration filters and ENV vars' do
|
111
|
-
before do
|
112
|
-
Configuration.env.set(:filter, roles: %w{app})
|
113
|
-
ENV.stubs(:[]).with('ROLES').returns('web')
|
114
|
-
end
|
115
|
-
|
116
|
-
context ':all required' do
|
117
|
-
let(:required) { [:all] }
|
118
|
-
|
119
|
-
it 'returns available names defined in the filter' do
|
120
|
-
expect(subject).to eq [:web, :app]
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
context 'role names required' do
|
125
|
-
let(:required) { [:web, :db] }
|
126
|
-
it 'returns all required names defined in the filter' do
|
127
|
-
expect(subject).to eq [:web]
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
after do
|
132
|
-
Configuration.env.delete(:filter)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|