vanagon 0.15.36 → 0.17.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 (41) 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/lib/vanagon.rb +1 -1
  12. data/lib/vanagon/cli.rb +94 -0
  13. data/lib/vanagon/cli/build.rb +75 -0
  14. data/lib/vanagon/cli/build_host_info.rb +49 -0
  15. data/lib/vanagon/cli/build_requirements.rb +60 -0
  16. data/lib/vanagon/cli/inspect.rb +65 -0
  17. data/lib/vanagon/cli/render.rb +51 -0
  18. data/lib/vanagon/cli/ship.rb +52 -0
  19. data/lib/vanagon/cli/sign.rb +34 -0
  20. data/lib/vanagon/driver.rb +11 -7
  21. data/lib/vanagon/engine/always_be_scheduling.rb +271 -1
  22. data/lib/vanagon/engine/docker.rb +101 -14
  23. data/lib/vanagon/engine/pooler.rb +7 -3
  24. data/lib/vanagon/platform.rb +5 -3
  25. data/lib/vanagon/platform/deb.rb +1 -1
  26. data/lib/vanagon/platform/dsl.rb +11 -0
  27. data/lib/vanagon/platform/rpm.rb +1 -1
  28. data/lib/vanagon/platform/windows.rb +29 -2
  29. data/lib/vanagon/project.rb +23 -4
  30. data/lib/vanagon/project/dsl.rb +33 -0
  31. data/lib/vanagon/utilities.rb +30 -8
  32. data/resources/rpm/project.spec.erb +3 -0
  33. data/spec/lib/vanagon/cli_spec.rb +80 -0
  34. data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +113 -1
  35. data/spec/lib/vanagon/engine/docker_spec.rb +74 -16
  36. data/spec/lib/vanagon/engine/ec2_spec.rb +2 -0
  37. data/spec/lib/vanagon/engine/pooler_spec.rb +1 -1
  38. data/spec/spec_helper.rb +1 -0
  39. metadata +56 -33
  40. data/lib/vanagon/optparse.rb +0 -86
  41. data/spec/lib/vanagon/optparse_spec.rb +0 -64
@@ -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