vanagon 0.15.37 → 0.18.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -23
  3. data/bin/build +4 -25
  4. data/bin/build_host_info +4 -17
  5. data/bin/build_requirements +4 -31
  6. data/bin/inspect +4 -21
  7. data/bin/render +4 -22
  8. data/bin/ship +4 -28
  9. data/bin/sign +4 -11
  10. data/bin/vanagon +7 -0
  11. data/extras/completions/vanagon.bash +38 -0
  12. data/extras/completions/vanagon.zsh +41 -0
  13. data/lib/vanagon.rb +1 -1
  14. data/lib/vanagon/cli.rb +102 -0
  15. data/lib/vanagon/cli/build.rb +83 -0
  16. data/lib/vanagon/cli/build_host_info.rb +57 -0
  17. data/lib/vanagon/cli/build_requirements.rb +68 -0
  18. data/lib/vanagon/cli/completion.rb +43 -0
  19. data/lib/vanagon/cli/inspect.rb +73 -0
  20. data/lib/vanagon/cli/list.rb +75 -0
  21. data/lib/vanagon/cli/render.rb +59 -0
  22. data/lib/vanagon/cli/ship.rb +52 -0
  23. data/lib/vanagon/cli/sign.rb +34 -0
  24. data/lib/vanagon/driver.rb +34 -28
  25. data/lib/vanagon/engine/always_be_scheduling.rb +271 -1
  26. data/lib/vanagon/engine/docker.rb +101 -14
  27. data/lib/vanagon/engine/pooler.rb +7 -3
  28. data/lib/vanagon/platform.rb +5 -3
  29. data/lib/vanagon/platform/deb.rb +3 -1
  30. data/lib/vanagon/platform/dsl.rb +11 -0
  31. data/lib/vanagon/platform/rpm.rb +1 -1
  32. data/lib/vanagon/platform/windows.rb +29 -2
  33. data/lib/vanagon/project.rb +23 -4
  34. data/lib/vanagon/project/dsl.rb +33 -0
  35. data/lib/vanagon/utilities.rb +30 -8
  36. data/resources/osx/postinstall.erb +1 -1
  37. data/resources/solaris/10/postinstall.erb +1 -1
  38. data/spec/lib/vanagon/cli_spec.rb +226 -0
  39. data/spec/lib/vanagon/driver_spec.rb +1 -1
  40. data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +113 -1
  41. data/spec/lib/vanagon/engine/docker_spec.rb +74 -16
  42. data/spec/lib/vanagon/engine/ec2_spec.rb +2 -0
  43. data/spec/lib/vanagon/engine/pooler_spec.rb +1 -1
  44. data/spec/spec_helper.rb +1 -0
  45. metadata +57 -30
  46. data/lib/vanagon/optparse.rb +0 -86
  47. data/spec/lib/vanagon/optparse_spec.rb +0 -64
@@ -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.vcloud_name 'debian-6-i386'
9
+ plat.vmpooler_template 'debian-6-i386'
10
10
  end")
11
11
  plat._platform
12
12
  }
@@ -19,6 +19,7 @@ end
19
19
 
20
20
  require 'tmpdir'
21
21
  require 'vanagon'
22
+ require 'webmock/rspec'
22
23
 
23
24
  RSpec.configure do |c|
24
25
  c.before do
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.15.37
4
+ version: 0.18.0
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-05-06 00:00:00.000000000 Z
11
+ date: 2020-12-08 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
@@ -265,41 +292,41 @@ signing_key:
265
292
  specification_version: 3
266
293
  summary: All of your packages will fit into this van with this one simple trick.
267
294
  test_files:
295
+ - spec/lib/git/rev_list_spec.rb
268
296
  - spec/lib/makefile_spec.rb
269
- - spec/lib/vanagon/utilities/shell_utilities_spec.rb
270
- - spec/lib/vanagon/platform_spec.rb
271
- - spec/lib/vanagon/project_spec.rb
272
- - spec/lib/vanagon/component_spec.rb
273
- - spec/lib/vanagon/extensions/set/json_spec.rb
274
- - spec/lib/vanagon/extensions/string_spec.rb
275
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
276
- - spec/lib/vanagon/engine/ec2_spec.rb
277
- - spec/lib/vanagon/engine/hardware_spec.rb
297
+ - spec/lib/vanagon/environment_spec.rb
278
298
  - spec/lib/vanagon/engine/pooler_spec.rb
279
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
280
299
  - spec/lib/vanagon/engine/docker_spec.rb
300
+ - spec/lib/vanagon/engine/hardware_spec.rb
301
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
281
302
  - spec/lib/vanagon/engine/base_spec.rb
282
303
  - spec/lib/vanagon/engine/local_spec.rb
283
- - spec/lib/vanagon/environment_spec.rb
284
- - spec/lib/vanagon/utilities_spec.rb
285
- - spec/lib/vanagon/driver_spec.rb
286
- - spec/lib/vanagon/component/rules_spec.rb
287
- - spec/lib/vanagon/component/dsl_spec.rb
288
- - spec/lib/vanagon/component/source/rewrite_spec.rb
304
+ - spec/lib/vanagon/engine/ec2_spec.rb
305
+ - spec/lib/vanagon/extensions/string_spec.rb
306
+ - spec/lib/vanagon/extensions/set/json_spec.rb
307
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
308
+ - spec/lib/vanagon/project_spec.rb
309
+ - spec/lib/vanagon/common/pathname_spec.rb
310
+ - spec/lib/vanagon/common/user_spec.rb
289
311
  - spec/lib/vanagon/component/source/git_spec.rb
290
312
  - spec/lib/vanagon/component/source/http_spec.rb
291
313
  - spec/lib/vanagon/component/source/local_spec.rb
314
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
292
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
293
319
  - spec/lib/vanagon/project/dsl_spec.rb
294
- - spec/lib/vanagon/optparse_spec.rb
295
- - spec/lib/vanagon/common/user_spec.rb
296
- - spec/lib/vanagon/common/pathname_spec.rb
297
- - spec/lib/vanagon/platform/dsl_spec.rb
298
- - spec/lib/vanagon/platform/windows_spec.rb
299
- - spec/lib/vanagon/platform/solaris_10_spec.rb
300
- - spec/lib/vanagon/platform/deb_spec.rb
301
- - spec/lib/vanagon/platform/solaris_11_spec.rb
302
320
  - spec/lib/vanagon/platform/rpm/aix_spec.rb
303
- - spec/lib/vanagon/platform/osx_spec.rb
321
+ - spec/lib/vanagon/platform/deb_spec.rb
304
322
  - spec/lib/vanagon/platform/rpm_spec.rb
305
- - spec/lib/git/rev_list_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
@@ -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
@@ -1,64 +0,0 @@
1
- require 'vanagon/optparse'
2
-
3
- describe Vanagon::OptParse do
4
-
5
- describe "options that don't take a value" do
6
- [:skipcheck, :verbose].each do |flag|
7
- it "can create an option parser that accepts the #{flag} flag" do
8
- subject = described_class.new("test", [flag])
9
- expect(subject.parse!(["--#{flag}"])).to have_key(flag)
10
- end
11
- end
12
-
13
- describe "short options" do
14
- [["v", :verbose]].each do |short, long|
15
- it "maps the short option #{short} to #{long}" do
16
- subject = described_class.new("test", [long])
17
- expect(subject.parse!(["-#{short}"])).to include(long => true)
18
- end
19
- end
20
- end
21
- end
22
-
23
- describe "options that only allow limited values" do
24
- [[:preserve, ["always", "never", "on-failure"]]].each do |option, values|
25
- values.each do |value|
26
- it "can create a parser that accepts \"--#{option} #{value}\"" do
27
- subject = described_class.new("test", [option, value])
28
- expect(subject.parse!(["--#{option}", value])).to eq(option => value.to_sym)
29
- end
30
- end
31
- end
32
- [[:preserve, ["bad-argument"]]].each do |option, values|
33
- values.each do |value|
34
- it "rejects the bad argument \"--#{option} #{value}\"" do
35
- subject = described_class.new("test", [option, value])
36
- expect{subject.parse!(["--#{option}", value])}.to raise_error(OptionParser::InvalidArgument)
37
- end
38
- end
39
- end
40
- it "preserve defaults to :on-failure" do
41
- subject = described_class.new("test")
42
- expect(subject.parse!([])).to include(:preserve => :'on-failure')
43
- end
44
- end
45
-
46
-
47
- describe "options that take a value" do
48
- [:workdir, :configdir, :engine].each do |option|
49
- it "can create an option parser that accepts the #{option} option" do
50
- subject = described_class.new("test", [option])
51
- expect(subject.parse!(["--#{option}", "hello"])).to include(option => "hello")
52
- end
53
- end
54
-
55
- describe "short options" do
56
- [["w", :workdir], ["c", :configdir], ["e", :engine]].each do |short, long|
57
- it "maps the short option #{short} to #{long}" do
58
- subject = described_class.new("test", [long])
59
- expect(subject.parse!(["-#{short}", "hello"])).to include(long => "hello")
60
- end
61
- end
62
- end
63
- end
64
- end