vanagon 0.15.38 → 0.18.1
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.
- checksums.yaml +4 -4
- data/README.md +48 -23
- data/bin/build +4 -25
- data/bin/build_host_info +4 -17
- data/bin/build_requirements +4 -31
- data/bin/inspect +4 -21
- data/bin/render +4 -22
- data/bin/ship +4 -28
- data/bin/sign +4 -11
- data/bin/vanagon +7 -0
- data/extras/completions/vanagon.bash +38 -0
- data/extras/completions/vanagon.zsh +41 -0
- data/lib/vanagon.rb +1 -1
- data/lib/vanagon/cli.rb +102 -0
- data/lib/vanagon/cli/build.rb +83 -0
- data/lib/vanagon/cli/build_host_info.rb +57 -0
- data/lib/vanagon/cli/build_requirements.rb +68 -0
- data/lib/vanagon/cli/completion.rb +43 -0
- data/lib/vanagon/cli/inspect.rb +73 -0
- data/lib/vanagon/cli/list.rb +75 -0
- data/lib/vanagon/cli/render.rb +59 -0
- data/lib/vanagon/cli/ship.rb +52 -0
- data/lib/vanagon/cli/sign.rb +34 -0
- data/lib/vanagon/driver.rb +35 -27
- data/lib/vanagon/engine/always_be_scheduling.rb +271 -1
- data/lib/vanagon/engine/docker.rb +101 -14
- data/lib/vanagon/engine/pooler.rb +7 -3
- data/lib/vanagon/platform.rb +3 -0
- data/lib/vanagon/platform/deb.rb +2 -0
- data/lib/vanagon/platform/dsl.rb +11 -0
- data/lib/vanagon/utilities.rb +30 -8
- data/resources/osx/postinstall.erb +1 -1
- data/resources/solaris/10/postinstall.erb +1 -1
- data/spec/lib/vanagon/cli_spec.rb +226 -0
- data/spec/lib/vanagon/driver_spec.rb +1 -1
- data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +113 -1
- data/spec/lib/vanagon/engine/docker_spec.rb +74 -16
- data/spec/lib/vanagon/engine/ec2_spec.rb +2 -0
- data/spec/lib/vanagon/engine/pooler_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +61 -34
- data/lib/vanagon/optparse.rb +0 -86
- data/spec/lib/vanagon/optparse_spec.rb +0 -64
@@ -50,7 +50,7 @@ describe 'Vanagon::Driver' do
|
|
50
50
|
info = create_driver(redhat).build_host_info
|
51
51
|
|
52
52
|
expect(info).to match({ 'name' => 'centos-7-x86_64',
|
53
|
-
'engine' => '
|
53
|
+
'engine' => 'always_be_scheduling' })
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'returns the vmpooler template with an explicit engine' do
|
@@ -2,6 +2,7 @@ require 'vanagon/engine/always_be_scheduling'
|
|
2
2
|
require 'vanagon/driver'
|
3
3
|
require 'vanagon/platform'
|
4
4
|
require 'logger'
|
5
|
+
require 'spec_helper'
|
5
6
|
|
6
7
|
class Vanagon
|
7
8
|
class Driver
|
@@ -45,6 +46,8 @@ describe 'Vanagon::Engine::AlwaysBeScheduling' do
|
|
45
46
|
end")
|
46
47
|
plat._platform
|
47
48
|
}
|
49
|
+
let(:pooler_token_file) { File.expand_path('~/.vanagon-token') }
|
50
|
+
let(:floaty_config) { File.expand_path('~/.vmfloaty.yml') }
|
48
51
|
|
49
52
|
describe '#validate_platform' do
|
50
53
|
it 'returns true if the platform has the required attributes' do
|
@@ -81,4 +84,113 @@ describe 'Vanagon::Engine::AlwaysBeScheduling' do
|
|
81
84
|
.to eq('always_be_scheduling')
|
82
85
|
end
|
83
86
|
end
|
84
|
-
|
87
|
+
|
88
|
+
describe '#read_vanagon_token' do
|
89
|
+
it 'takes the first line for abs token, second line is optional' do
|
90
|
+
token_value = 'decade'
|
91
|
+
allow(File).to receive(:exist?)
|
92
|
+
.with(pooler_token_file)
|
93
|
+
.and_return(true)
|
94
|
+
|
95
|
+
allow(File).to receive(:read)
|
96
|
+
.with(pooler_token_file)
|
97
|
+
.and_return(token_value)
|
98
|
+
|
99
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
100
|
+
expect(abs_service.token).to eq('decade')
|
101
|
+
expect(abs_service.token_vmpooler).to eq(nil)
|
102
|
+
end
|
103
|
+
it 'takes the second line as vmpooler token' do
|
104
|
+
token_value = "decade\nanddaycade"
|
105
|
+
allow(File).to receive(:exist?)
|
106
|
+
.with(pooler_token_file)
|
107
|
+
.and_return(true)
|
108
|
+
|
109
|
+
allow(File).to receive(:read)
|
110
|
+
.with(pooler_token_file)
|
111
|
+
.and_return(token_value)
|
112
|
+
|
113
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
114
|
+
expect(abs_service.token).to eq('decade')
|
115
|
+
expect(abs_service.token_vmpooler).to eq('anddaycade')
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '#read_vmfloaty_token' do
|
120
|
+
before :each do
|
121
|
+
allow(File).to receive(:exist?)
|
122
|
+
.with(pooler_token_file)
|
123
|
+
.and_return(false)
|
124
|
+
|
125
|
+
allow(File).to receive(:exist?)
|
126
|
+
.with(floaty_config)
|
127
|
+
.and_return(true)
|
128
|
+
end
|
129
|
+
token_value = 'decade'
|
130
|
+
it %(reads a token from '~/.vmfloaty.yml at the top level') do
|
131
|
+
allow(YAML).to receive(:load_file)
|
132
|
+
.with(floaty_config)
|
133
|
+
.and_return({'token' => token_value})
|
134
|
+
|
135
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
136
|
+
expect(abs_service.token).to eq(token_value)
|
137
|
+
expect(abs_service.token_vmpooler).to eq(nil)
|
138
|
+
end
|
139
|
+
it %(reads a token from '~/.vmfloaty.yml in the abs service') do
|
140
|
+
allow(YAML).to receive(:load_file)
|
141
|
+
.with(floaty_config)
|
142
|
+
.and_return({'services' =>
|
143
|
+
{'MYabs' => {'type'=>'abs', 'token'=>token_value, 'url'=>'foo'}}
|
144
|
+
})
|
145
|
+
|
146
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
147
|
+
expect(abs_service.token).to eq(token_value)
|
148
|
+
expect(abs_service.token_vmpooler).to eq(nil)
|
149
|
+
end
|
150
|
+
it %(reads a token from '~/.vmfloaty.yml in the abs service and includes the vmpooler token') do
|
151
|
+
vmp_token_value = 'deecade'
|
152
|
+
allow(YAML).to receive(:load_file)
|
153
|
+
.with(floaty_config)
|
154
|
+
.and_return({'services' =>
|
155
|
+
{'MYabs' => {'type'=>'abs', 'token'=>token_value, 'url'=>'foo', 'vmpooler_fallback' => 'myvmp'},
|
156
|
+
'myvmp' => {'token'=>vmp_token_value, 'url'=>'bar'}}
|
157
|
+
})
|
158
|
+
|
159
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
160
|
+
expect(abs_service.token).to eq(token_value)
|
161
|
+
expect(abs_service.token_vmpooler).to eq(vmp_token_value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
describe '#select_target_from' do
|
165
|
+
it 'runs successfully' do
|
166
|
+
hostname = 'faint-whirlwind.puppet.com'
|
167
|
+
stub_request(:post, "https://foobar/request").
|
168
|
+
to_return({status: 202, body: "", headers: {}},{status: 200, body: '[{"hostname":"'+hostname+'","type":"aix-6.1-ppc","engine":"nspooler"}]', headers: {}})
|
169
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
170
|
+
abs_service.select_target_from("https://foobar")
|
171
|
+
expect(abs_service.target).to eq(hostname)
|
172
|
+
end
|
173
|
+
it 'returns a warning if the first request is not a 202' do
|
174
|
+
hostname = 'fainter-whirlwind.puppet.com'
|
175
|
+
stub_request(:post, "https://foobar/request").
|
176
|
+
to_return({status: 404, body: "", headers: {}},{status: 200, body: '[{"hostname":"'+hostname+'","type":"aix-6.1-ppc","engine":"nspooler"}]', headers: {}})
|
177
|
+
allow_any_instance_of(Object).to receive(:warn)
|
178
|
+
expect_any_instance_of(Object).to receive(:warn).with("failed to request ABS with code 404")
|
179
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
180
|
+
pooler = abs_service.select_target_from("https://foobar")
|
181
|
+
expect(pooler).to eq('')
|
182
|
+
end
|
183
|
+
it 'returns a warning and retries until request is a 200' do
|
184
|
+
hostname = 'faintest-whirlwind.puppet.com'
|
185
|
+
stub_request(:post, "https://foobar/request").
|
186
|
+
to_return({status: 202, body: "", headers: {}},
|
187
|
+
{status: 503, body: "", headers: {}},
|
188
|
+
{status: 200, body: '[{"hostname":"'+hostname+'","type":"aix-6.1-ppc","engine":"nspooler"}]', headers: {}})
|
189
|
+
allow_any_instance_of(Object).to receive(:warn)
|
190
|
+
expect_any_instance_of(Object).to receive(:warn).with(/Waiting 1 seconds to check if ABS request has been filled/)
|
191
|
+
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
192
|
+
abs_service.select_target_from("https://foobar")
|
193
|
+
expect(abs_service.target).to eq(hostname)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -1,21 +1,36 @@
|
|
1
1
|
require 'vanagon/engine/docker'
|
2
2
|
require 'vanagon/platform'
|
3
3
|
|
4
|
-
describe
|
5
|
-
let (:platform_with_docker_image)
|
6
|
-
plat = Vanagon::Platform::DSL.new('debian-
|
7
|
-
plat.instance_eval(
|
8
|
-
|
9
|
-
|
4
|
+
describe Vanagon::Engine::Docker do
|
5
|
+
let (:platform_with_docker_image) do
|
6
|
+
plat = Vanagon::Platform::DSL.new('debian-10-amd64')
|
7
|
+
plat.instance_eval(<<~EOF)
|
8
|
+
platform 'debian-10-amd64' do |plat|
|
9
|
+
plat.docker_image 'debian:10-slim'
|
10
|
+
end
|
11
|
+
EOF
|
10
12
|
plat._platform
|
11
|
-
|
13
|
+
end
|
12
14
|
|
13
|
-
let (:platform_without_docker_image)
|
14
|
-
plat = Vanagon::Platform::DSL.new('debian-
|
15
|
-
plat.instance_eval(
|
16
|
-
|
15
|
+
let (:platform_without_docker_image) do
|
16
|
+
plat = Vanagon::Platform::DSL.new('debian-10-amd64')
|
17
|
+
plat.instance_eval(<<~EOF)
|
18
|
+
platform 'debian-10-amd64' do |plat|
|
19
|
+
end
|
20
|
+
EOF
|
21
|
+
plat._platform
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:platform_with_docker_exec) do
|
25
|
+
plat = Vanagon::Platform::DSL.new('debian-10-amd64')
|
26
|
+
plat.instance_eval(<<~EOF)
|
27
|
+
platform 'debian-10-amd64' do |plat|
|
28
|
+
plat.docker_image 'debian:10-slim'
|
29
|
+
plat.use_docker_exec true
|
30
|
+
end
|
31
|
+
EOF
|
17
32
|
plat._platform
|
18
|
-
|
33
|
+
end
|
19
34
|
|
20
35
|
describe '#initialize' do
|
21
36
|
it 'fails without docker installed' do
|
@@ -23,24 +38,67 @@ describe 'Vanagon::Engine::Docker' do
|
|
23
38
|
expect(FileTest).to receive(:executable?).with(File.join(path_elem, 'docker')).and_return(false)
|
24
39
|
end
|
25
40
|
|
26
|
-
expect {
|
41
|
+
expect { described_class.new(platform_with_docker_image) }.to raise_error(RuntimeError)
|
27
42
|
end
|
28
43
|
end
|
29
44
|
|
30
45
|
describe "#validate_platform" do
|
31
46
|
it 'raises an error if the platform is missing a required attribute' do
|
32
47
|
expect(Vanagon::Utilities).to receive(:find_program_on_path).with('docker').and_return('/usr/bin/docker')
|
33
|
-
expect {
|
48
|
+
expect { described_class.new(platform_without_docker_image).validate_platform }.to raise_error(Vanagon::Error)
|
34
49
|
end
|
35
50
|
|
36
51
|
it 'returns true if the platform has the required attributes' do
|
37
52
|
expect(Vanagon::Utilities).to receive(:find_program_on_path).with('docker').and_return('/usr/bin/docker')
|
38
|
-
expect(
|
53
|
+
expect(described_class.new(platform_with_docker_image).validate_platform).to be(true)
|
39
54
|
end
|
40
55
|
end
|
41
56
|
|
42
57
|
it 'returns "docker" name' do
|
43
58
|
expect(Vanagon::Utilities).to receive(:find_program_on_path).with('docker').and_return('/usr/bin/docker')
|
44
|
-
expect(
|
59
|
+
expect(described_class.new(platform_with_docker_image).name).to eq('docker')
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#dispatch' do
|
63
|
+
context 'when platform has use_docker_exec set' do
|
64
|
+
subject { described_class.new(platform_with_docker_exec) }
|
65
|
+
|
66
|
+
it 'uses docker exec' do
|
67
|
+
expect(Vanagon::Utilities).to receive(:remote_ssh_command).never
|
68
|
+
expect(subject).to receive(:docker_exec)
|
69
|
+
|
70
|
+
subject.dispatch('true', true)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#ship_workdir' do
|
76
|
+
context 'when platform has use_docker_exec set' do
|
77
|
+
subject { described_class.new(platform_with_docker_exec) }
|
78
|
+
|
79
|
+
it 'uses docker cp' do
|
80
|
+
expect(Vanagon::Utilities).to receive(:rsync_to).never
|
81
|
+
expect(subject).to receive(:docker_cp_globs_to)
|
82
|
+
|
83
|
+
subject.ship_workdir('foo/')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#retrieve_built_artifact' do
|
89
|
+
context 'when platform has use_docker_exec set' do
|
90
|
+
subject { described_class.new(platform_with_docker_exec) }
|
91
|
+
|
92
|
+
before(:each) do
|
93
|
+
allow(FileUtils).to receive(:mkdir_p)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'uses docker cp' do
|
97
|
+
expect(Vanagon::Utilities).to receive(:rsync_from).never
|
98
|
+
expect(subject).to receive(:docker_cp_globs_from)
|
99
|
+
|
100
|
+
subject.retrieve_built_artifact('output/*', false)
|
101
|
+
end
|
102
|
+
end
|
45
103
|
end
|
46
104
|
end
|
@@ -27,6 +27,8 @@ if defined? ::Aws
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'returns "ec2" name' do
|
30
|
+
stub_request(:get, "http://169.254.169.254/latest/meta-data/iam/security-credentials/").
|
31
|
+
to_return(status: 200, body: "", headers: {})
|
30
32
|
expect(Vanagon::Engine::Ec2.new(platform_ec2).name).to eq('ec2')
|
31
33
|
end
|
32
34
|
end
|
@@ -6,7 +6,7 @@ describe 'Vanagon::Engine::Pooler' do
|
|
6
6
|
let (:platform_with_vcloud_name) {
|
7
7
|
plat = Vanagon::Platform::DSL.new('debian-6-i386')
|
8
8
|
plat.instance_eval("platform 'debian-6-i386' do |plat|
|
9
|
-
plat.
|
9
|
+
plat.vmpooler_template 'debian-6-i386'
|
10
10
|
end")
|
11
11
|
plat._platform
|
12
12
|
}
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanagon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: docopt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: git
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,6 +84,7 @@ description: Vanagon is a tool to build a single package out of a project, which
|
|
70
84
|
itself contain one or more components.
|
71
85
|
email: info@puppet.com
|
72
86
|
executables:
|
87
|
+
- vanagon
|
73
88
|
- build
|
74
89
|
- inspect
|
75
90
|
- ship
|
@@ -91,10 +106,23 @@ files:
|
|
91
106
|
- bin/repo
|
92
107
|
- bin/ship
|
93
108
|
- bin/sign
|
109
|
+
- bin/vanagon
|
110
|
+
- extras/completions/vanagon.bash
|
111
|
+
- extras/completions/vanagon.zsh
|
94
112
|
- lib/git/basic_submodules.rb
|
95
113
|
- lib/git/rev_list.rb
|
96
114
|
- lib/makefile.rb
|
97
115
|
- lib/vanagon.rb
|
116
|
+
- lib/vanagon/cli.rb
|
117
|
+
- lib/vanagon/cli/build.rb
|
118
|
+
- lib/vanagon/cli/build_host_info.rb
|
119
|
+
- lib/vanagon/cli/build_requirements.rb
|
120
|
+
- lib/vanagon/cli/completion.rb
|
121
|
+
- lib/vanagon/cli/inspect.rb
|
122
|
+
- lib/vanagon/cli/list.rb
|
123
|
+
- lib/vanagon/cli/render.rb
|
124
|
+
- lib/vanagon/cli/ship.rb
|
125
|
+
- lib/vanagon/cli/sign.rb
|
98
126
|
- lib/vanagon/common.rb
|
99
127
|
- lib/vanagon/common/pathname.rb
|
100
128
|
- lib/vanagon/common/user.rb
|
@@ -120,7 +148,6 @@ files:
|
|
120
148
|
- lib/vanagon/extensions/ostruct/json.rb
|
121
149
|
- lib/vanagon/extensions/set/json.rb
|
122
150
|
- lib/vanagon/extensions/string.rb
|
123
|
-
- lib/vanagon/optparse.rb
|
124
151
|
- lib/vanagon/patch.rb
|
125
152
|
- lib/vanagon/platform.rb
|
126
153
|
- lib/vanagon/platform/deb.rb
|
@@ -204,6 +231,7 @@ files:
|
|
204
231
|
- spec/fixtures/wix/resources/windows/wix/ui/ui-sample-1.wxs
|
205
232
|
- spec/lib/git/rev_list_spec.rb
|
206
233
|
- spec/lib/makefile_spec.rb
|
234
|
+
- spec/lib/vanagon/cli_spec.rb
|
207
235
|
- spec/lib/vanagon/common/pathname_spec.rb
|
208
236
|
- spec/lib/vanagon/common/user_spec.rb
|
209
237
|
- spec/lib/vanagon/component/dsl_spec.rb
|
@@ -226,7 +254,6 @@ files:
|
|
226
254
|
- spec/lib/vanagon/extensions/ostruct/json_spec.rb
|
227
255
|
- spec/lib/vanagon/extensions/set/json_spec.rb
|
228
256
|
- spec/lib/vanagon/extensions/string_spec.rb
|
229
|
-
- spec/lib/vanagon/optparse_spec.rb
|
230
257
|
- spec/lib/vanagon/platform/deb_spec.rb
|
231
258
|
- spec/lib/vanagon/platform/dsl_spec.rb
|
232
259
|
- spec/lib/vanagon/platform/osx_spec.rb
|
@@ -266,40 +293,40 @@ specification_version: 3
|
|
266
293
|
summary: All of your packages will fit into this van with this one simple trick.
|
267
294
|
test_files:
|
268
295
|
- spec/lib/git/rev_list_spec.rb
|
269
|
-
- spec/lib/
|
270
|
-
- spec/lib/vanagon/
|
271
|
-
- spec/lib/vanagon/
|
272
|
-
- spec/lib/vanagon/utilities_spec.rb
|
273
|
-
- spec/lib/vanagon/platform/solaris_10_spec.rb
|
274
|
-
- spec/lib/vanagon/platform/rpm_spec.rb
|
275
|
-
- spec/lib/vanagon/platform/solaris_11_spec.rb
|
276
|
-
- spec/lib/vanagon/platform/dsl_spec.rb
|
277
|
-
- spec/lib/vanagon/platform/deb_spec.rb
|
278
|
-
- spec/lib/vanagon/platform/windows_spec.rb
|
279
|
-
- spec/lib/vanagon/platform/osx_spec.rb
|
280
|
-
- spec/lib/vanagon/platform/rpm/aix_spec.rb
|
281
|
-
- spec/lib/vanagon/component/source_spec.rb
|
282
|
-
- spec/lib/vanagon/component/dsl_spec.rb
|
283
|
-
- spec/lib/vanagon/component/rules_spec.rb
|
284
|
-
- spec/lib/vanagon/component/source/http_spec.rb
|
285
|
-
- spec/lib/vanagon/component/source/local_spec.rb
|
286
|
-
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
287
|
-
- spec/lib/vanagon/component/source/git_spec.rb
|
296
|
+
- spec/lib/makefile_spec.rb
|
297
|
+
- spec/lib/vanagon/environment_spec.rb
|
298
|
+
- spec/lib/vanagon/engine/pooler_spec.rb
|
288
299
|
- spec/lib/vanagon/engine/docker_spec.rb
|
289
300
|
- spec/lib/vanagon/engine/hardware_spec.rb
|
290
|
-
- spec/lib/vanagon/engine/
|
301
|
+
- spec/lib/vanagon/engine/always_be_scheduling_spec.rb
|
291
302
|
- spec/lib/vanagon/engine/base_spec.rb
|
292
303
|
- spec/lib/vanagon/engine/local_spec.rb
|
293
|
-
- spec/lib/vanagon/engine/
|
294
|
-
- spec/lib/vanagon/engine/always_be_scheduling_spec.rb
|
295
|
-
- spec/lib/vanagon/platform_spec.rb
|
296
|
-
- spec/lib/vanagon/project/dsl_spec.rb
|
297
|
-
- spec/lib/vanagon/optparse_spec.rb
|
298
|
-
- spec/lib/vanagon/component_spec.rb
|
299
|
-
- spec/lib/vanagon/extensions/ostruct/json_spec.rb
|
304
|
+
- spec/lib/vanagon/engine/ec2_spec.rb
|
300
305
|
- spec/lib/vanagon/extensions/string_spec.rb
|
301
306
|
- spec/lib/vanagon/extensions/set/json_spec.rb
|
302
|
-
- spec/lib/vanagon/
|
307
|
+
- spec/lib/vanagon/extensions/ostruct/json_spec.rb
|
308
|
+
- spec/lib/vanagon/project_spec.rb
|
303
309
|
- spec/lib/vanagon/common/pathname_spec.rb
|
304
|
-
- spec/lib/vanagon/
|
305
|
-
- spec/lib/
|
310
|
+
- spec/lib/vanagon/common/user_spec.rb
|
311
|
+
- spec/lib/vanagon/component/source/git_spec.rb
|
312
|
+
- spec/lib/vanagon/component/source/http_spec.rb
|
313
|
+
- spec/lib/vanagon/component/source/local_spec.rb
|
314
|
+
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
315
|
+
- spec/lib/vanagon/component/source_spec.rb
|
316
|
+
- spec/lib/vanagon/component/rules_spec.rb
|
317
|
+
- spec/lib/vanagon/component/dsl_spec.rb
|
318
|
+
- spec/lib/vanagon/component_spec.rb
|
319
|
+
- spec/lib/vanagon/project/dsl_spec.rb
|
320
|
+
- spec/lib/vanagon/platform/rpm/aix_spec.rb
|
321
|
+
- spec/lib/vanagon/platform/deb_spec.rb
|
322
|
+
- spec/lib/vanagon/platform/rpm_spec.rb
|
323
|
+
- spec/lib/vanagon/platform/solaris_10_spec.rb
|
324
|
+
- spec/lib/vanagon/platform/osx_spec.rb
|
325
|
+
- spec/lib/vanagon/platform/windows_spec.rb
|
326
|
+
- spec/lib/vanagon/platform/solaris_11_spec.rb
|
327
|
+
- spec/lib/vanagon/platform/dsl_spec.rb
|
328
|
+
- spec/lib/vanagon/cli_spec.rb
|
329
|
+
- spec/lib/vanagon/platform_spec.rb
|
330
|
+
- spec/lib/vanagon/utilities/shell_utilities_spec.rb
|
331
|
+
- spec/lib/vanagon/utilities_spec.rb
|
332
|
+
- spec/lib/vanagon/driver_spec.rb
|
data/lib/vanagon/optparse.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
class Vanagon
|
4
|
-
class OptParse
|
5
|
-
def initialize(banner, symbols = []) # rubocop:disable Metrics/AbcSize
|
6
|
-
## symbols array kept for backward compatibility but ignored
|
7
|
-
|
8
|
-
@options = Hash.new
|
9
|
-
@options[:preserve] = :'on-failure'
|
10
|
-
|
11
|
-
@option_parser = OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
|
12
|
-
opts.banner = banner
|
13
|
-
opts.separator ""
|
14
|
-
opts.separator "Options:"
|
15
|
-
|
16
|
-
opts.on("-h",
|
17
|
-
"--help",
|
18
|
-
"Display help") do
|
19
|
-
$stdout.puts opts
|
20
|
-
exit 1
|
21
|
-
end
|
22
|
-
|
23
|
-
opts.on("-v",
|
24
|
-
"--verbose",
|
25
|
-
"Verbose output (does nothing)") do |verbose|
|
26
|
-
@options[:verbose] = verbose
|
27
|
-
end
|
28
|
-
|
29
|
-
opts.on("-w DIRECTORY",
|
30
|
-
"--workdir DIRECTORY",
|
31
|
-
"Working directory on the local host (defaults to calling mktemp)") do |workdir|
|
32
|
-
@options[:workdir] = workdir
|
33
|
-
end
|
34
|
-
|
35
|
-
opts.on("-r DIRECTORY",
|
36
|
-
"--remote-workdir DIRECTORY",
|
37
|
-
"Working directory on the remote host (defaults to calling mktemp)") do |remote|
|
38
|
-
@options[:"remote-workdir"] = remote
|
39
|
-
end
|
40
|
-
|
41
|
-
opts.on("-c DIRECTORY",
|
42
|
-
"--configdir DIRECTORY",
|
43
|
-
"Configuration directory (defaults to $CWD/configs)") do |configuration_directory|
|
44
|
-
@options[:configdir] = configuration_directory
|
45
|
-
end
|
46
|
-
|
47
|
-
opts.on("-e ENGINE",
|
48
|
-
"--engine ENGINE",
|
49
|
-
"Custom engine to use [base, local, docker, pooler] (defaults to \"pooler\")") do |engine|
|
50
|
-
@options[:engine] = engine
|
51
|
-
end
|
52
|
-
|
53
|
-
opts.on("--skipcheck",
|
54
|
-
"Skip the \"check\" stage when building components") do |skipcheck|
|
55
|
-
@options[:skipcheck] = skipcheck
|
56
|
-
end
|
57
|
-
|
58
|
-
opts.on("-p [RULE]",
|
59
|
-
"--preserve [RULE]",
|
60
|
-
["never", "on-failure", "always"],
|
61
|
-
"Rule for VM preservation. [never, on-failure, always]") do |rule|
|
62
|
-
if rule.nil?
|
63
|
-
@options[:preserve] = :always
|
64
|
-
else
|
65
|
-
@options[:preserve] = rule.to_sym
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
opts.on("--only-build COMPONENT,COMPONENT,...",
|
70
|
-
Array,
|
71
|
-
"Only build listed COMPONENTs") do |components|
|
72
|
-
@options[:only_build] = components
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def parse!(args)
|
78
|
-
@option_parser.parse!(args)
|
79
|
-
@options
|
80
|
-
end
|
81
|
-
|
82
|
-
def to_s
|
83
|
-
@optparse.to_s
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|