omnibus 5.4.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +8 -5
  5. data/README.md +3 -1
  6. data/Rakefile +20 -13
  7. data/appveyor.yml +4 -3
  8. data/bin/omnibus +3 -3
  9. data/features/commands/manifest.feature +19 -5
  10. data/features/step_definitions/generator_steps.rb +5 -6
  11. data/features/support/env.rb +4 -4
  12. data/lib/omnibus/build_version.rb +14 -14
  13. data/lib/omnibus/build_version_dsl.rb +3 -3
  14. data/lib/omnibus/builder.rb +50 -61
  15. data/lib/omnibus/changelog.rb +2 -2
  16. data/lib/omnibus/changelog_printer.rb +4 -4
  17. data/lib/omnibus/cleaner.rb +4 -4
  18. data/lib/omnibus/cli/base.rb +15 -15
  19. data/lib/omnibus/cli/cache.rb +13 -13
  20. data/lib/omnibus/cli/changelog.rb +8 -9
  21. data/lib/omnibus/cli/publish.rb +12 -13
  22. data/lib/omnibus/cli.rb +26 -27
  23. data/lib/omnibus/compressor.rb +6 -6
  24. data/lib/omnibus/compressors/base.rb +7 -2
  25. data/lib/omnibus/compressors/dmg.rb +12 -12
  26. data/lib/omnibus/compressors/null.rb +1 -1
  27. data/lib/omnibus/compressors/tgz.rb +8 -8
  28. data/lib/omnibus/config.rb +37 -26
  29. data/lib/omnibus/core_extensions/open_uri.rb +3 -3
  30. data/lib/omnibus/core_extensions.rb +1 -1
  31. data/lib/omnibus/digestable.rb +5 -4
  32. data/lib/omnibus/download_helpers.rb +7 -6
  33. data/lib/omnibus/exceptions.rb +29 -13
  34. data/lib/omnibus/fetcher.rb +0 -1
  35. data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
  36. data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
  37. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  38. data/lib/omnibus/file_syncer.rb +3 -3
  39. data/lib/omnibus/generator.rb +60 -47
  40. data/lib/omnibus/git_cache.rb +33 -22
  41. data/lib/omnibus/git_repository.rb +5 -5
  42. data/lib/omnibus/health_check.rb +122 -119
  43. data/lib/omnibus/instrumentation.rb +1 -1
  44. data/lib/omnibus/licensing.rb +348 -60
  45. data/lib/omnibus/logger.rb +12 -9
  46. data/lib/omnibus/logging.rb +1 -1
  47. data/lib/omnibus/manifest.rb +4 -4
  48. data/lib/omnibus/manifest_diff.rb +6 -7
  49. data/lib/omnibus/manifest_entry.rb +1 -1
  50. data/lib/omnibus/metadata.rb +36 -36
  51. data/lib/omnibus/ohai.rb +6 -7
  52. data/lib/omnibus/package.rb +1 -1
  53. data/lib/omnibus/packager.rb +37 -28
  54. data/lib/omnibus/packagers/appx.rb +86 -0
  55. data/lib/omnibus/packagers/base.rb +21 -18
  56. data/lib/omnibus/packagers/bff.rb +22 -24
  57. data/lib/omnibus/packagers/deb.rb +20 -20
  58. data/lib/omnibus/packagers/ips.rb +18 -17
  59. data/lib/omnibus/packagers/makeself.rb +7 -7
  60. data/lib/omnibus/packagers/msi.rb +38 -193
  61. data/lib/omnibus/packagers/pkg.rb +16 -16
  62. data/lib/omnibus/packagers/rpm.rb +53 -54
  63. data/lib/omnibus/packagers/solaris.rb +14 -14
  64. data/lib/omnibus/packagers/windows_base.rb +192 -0
  65. data/lib/omnibus/project.rb +45 -43
  66. data/lib/omnibus/publisher.rb +3 -3
  67. data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
  68. data/lib/omnibus/publishers/s3_publisher.rb +7 -7
  69. data/lib/omnibus/reports.rb +10 -10
  70. data/lib/omnibus/s3_cache.rb +7 -7
  71. data/lib/omnibus/s3_helpers.rb +8 -7
  72. data/lib/omnibus/semantic_version.rb +1 -1
  73. data/lib/omnibus/software.rb +131 -81
  74. data/lib/omnibus/sugarable.rb +10 -10
  75. data/lib/omnibus/templating.rb +5 -5
  76. data/lib/omnibus/thread_pool.rb +1 -1
  77. data/lib/omnibus/util.rb +5 -5
  78. data/lib/omnibus/version.rb +1 -1
  79. data/lib/omnibus.rb +65 -65
  80. data/omnibus.gemspec +34 -32
  81. data/resources/appx/AppxManifest.xml.erb +18 -0
  82. data/resources/appx/assets/clear.png +0 -0
  83. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
  84. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
  85. data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
  86. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
  87. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
  88. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
  89. data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
  90. data/spec/functional/builder_spec.rb +149 -150
  91. data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
  92. data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
  93. data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
  94. data/spec/functional/file_syncer_spec.rb +74 -74
  95. data/spec/functional/licensing_spec.rb +344 -35
  96. data/spec/functional/templating_spec.rb +17 -17
  97. data/spec/spec_helper.rb +20 -20
  98. data/spec/support/examples.rb +21 -15
  99. data/spec/support/file_helpers.rb +1 -1
  100. data/spec/support/git_helpers.rb +37 -37
  101. data/spec/support/matchers.rb +3 -3
  102. data/spec/support/ohai_helpers.rb +4 -4
  103. data/spec/support/path_helpers.rb +2 -2
  104. data/spec/support/shell_helpers.rb +2 -2
  105. data/spec/unit/build_version_dsl_spec.rb +5 -5
  106. data/spec/unit/build_version_spec.rb +63 -63
  107. data/spec/unit/builder_spec.rb +86 -70
  108. data/spec/unit/changelog_spec.rb +4 -4
  109. data/spec/unit/changelogprinter_spec.rb +130 -0
  110. data/spec/unit/cleanroom_spec.rb +11 -11
  111. data/spec/unit/compressor_spec.rb +16 -16
  112. data/spec/unit/compressors/base_spec.rb +6 -6
  113. data/spec/unit/compressors/dmg_spec.rb +76 -76
  114. data/spec/unit/compressors/null_spec.rb +4 -4
  115. data/spec/unit/compressors/tgz_spec.rb +20 -20
  116. data/spec/unit/config_spec.rb +44 -43
  117. data/spec/unit/digestable_spec.rb +13 -13
  118. data/spec/unit/fetcher_spec.rb +11 -12
  119. data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
  120. data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
  121. data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
  122. data/spec/unit/generator_spec.rb +38 -38
  123. data/spec/unit/git_cache_spec.rb +56 -54
  124. data/spec/unit/git_repository_spec.rb +2 -2
  125. data/spec/unit/health_check_spec.rb +40 -40
  126. data/spec/unit/library_spec.rb +35 -35
  127. data/spec/unit/manifest_diff_spec.rb +10 -11
  128. data/spec/unit/manifest_spec.rb +17 -17
  129. data/spec/unit/metadata_spec.rb +152 -152
  130. data/spec/unit/ohai_spec.rb +5 -5
  131. data/spec/unit/omnibus_spec.rb +31 -31
  132. data/spec/unit/package_spec.rb +20 -20
  133. data/spec/unit/packager_spec.rb +48 -42
  134. data/spec/unit/packagers/appx_spec.rb +165 -0
  135. data/spec/unit/packagers/base_spec.rb +34 -34
  136. data/spec/unit/packagers/bff_spec.rb +60 -60
  137. data/spec/unit/packagers/deb_spec.rb +71 -71
  138. data/spec/unit/packagers/ips_spec.rb +45 -45
  139. data/spec/unit/packagers/makeself_spec.rb +22 -22
  140. data/spec/unit/packagers/msi_spec.rb +141 -147
  141. data/spec/unit/packagers/pkg_spec.rb +59 -60
  142. data/spec/unit/packagers/rpm_spec.rb +125 -126
  143. data/spec/unit/packagers/solaris_spec.rb +52 -52
  144. data/spec/unit/project_spec.rb +137 -135
  145. data/spec/unit/publisher_spec.rb +70 -70
  146. data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
  147. data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
  148. data/spec/unit/s3_cacher_spec.rb +34 -34
  149. data/spec/unit/s3_helpers_spec.rb +6 -6
  150. data/spec/unit/semantic_version_spec.rb +2 -2
  151. data/spec/unit/software_spec.rb +346 -384
  152. data/spec/unit/sugarable_spec.rb +10 -10
  153. data/spec/unit/util_spec.rb +60 -60
  154. metadata +54 -6
  155. data/.rubocop.yml +0 -48
@@ -1,29 +1,29 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Packager::Solaris do
5
5
  let(:project) do
6
6
  Project.new.tap do |project|
7
- project.name('project')
8
- project.homepage('https://example.com')
9
- project.install_dir('/opt/project')
10
- project.build_version('1.2.3')
11
- project.build_iteration('1')
12
- project.maintainer('Chef Software')
7
+ project.name("project")
8
+ project.homepage("https://example.com")
9
+ project.install_dir("/opt/project")
10
+ project.build_version("1.2.3")
11
+ project.build_iteration("1")
12
+ project.maintainer("Chef Software")
13
13
  end
14
14
  end
15
15
 
16
16
  subject { described_class.new(project) }
17
17
 
18
- let(:project_root) { File.join(tmp_path, 'project/root') }
19
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
20
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
21
- let(:architecture) { 'i86pc' }
18
+ let(:project_root) { File.join(tmp_path, "project/root") }
19
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
20
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
21
+ let(:architecture) { "i86pc" }
22
22
 
23
23
  before do
24
24
  # This is here to allow this unit test to run on windows.
25
25
  allow(File).to receive(:expand_path).and_wrap_original do |m, *args|
26
- m.call(*args).sub(/^[A-Za-z]:/, '')
26
+ m.call(*args).sub(/^[A-Za-z]:/, "")
27
27
  end
28
28
  Config.project_root(project_root)
29
29
  Config.package_dir(package_dir)
@@ -31,44 +31,44 @@ module Omnibus
31
31
  allow(subject).to receive(:staging_dir).and_return(staging_dir)
32
32
  create_directory(staging_dir)
33
33
 
34
- stub_ohai(platform: 'solaris2', version: '5.11') do |data|
35
- data['kernel']['machine'] = architecture
34
+ stub_ohai(platform: "solaris2", version: "5.11") do |data|
35
+ data["kernel"]["machine"] = architecture
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#id' do
40
- it 'is :solaris' do
40
+ it "is :solaris" do
41
41
  expect(subject.id).to eq(:solaris)
42
42
  end
43
43
  end
44
44
 
45
45
  describe '#package_name' do
46
- it 'includes the name, version, iteration and architecture' do
47
- expect(subject.package_name).to eq('project-1.2.3-1.i386.solaris')
46
+ it "includes the name, version, iteration and architecture" do
47
+ expect(subject.package_name).to eq("project-1.2.3-1.i386.solaris")
48
48
  end
49
49
  end
50
50
 
51
51
  describe '#pkgmk_version' do
52
- it 'includes the version and iteration' do
53
- expect(subject.pkgmk_version).to eq('1.2.3-1')
52
+ it "includes the version and iteration" do
53
+ expect(subject.pkgmk_version).to eq("1.2.3-1")
54
54
  end
55
55
  end
56
56
 
57
57
  describe '#install_dirname' do
58
- it 'returns the parent directory' do
59
- expect(subject.install_dirname).to eq('/opt')
58
+ it "returns the parent directory" do
59
+ expect(subject.install_dirname).to eq("/opt")
60
60
  end
61
61
  end
62
62
 
63
63
  describe '#install_basename' do
64
- it 'name of the install directory' do
65
- expect(subject.install_basename).to eq('project')
64
+ it "name of the install directory" do
65
+ expect(subject.install_basename).to eq("project")
66
66
  end
67
67
  end
68
68
 
69
69
  describe '#write_scripts' do
70
- context 'when scripts are given' do
71
- let(:scripts) { %w( postinstall postremove ) }
70
+ context "when scripts are given" do
71
+ let(:scripts) { %w{ postinstall postremove } }
72
72
  before do
73
73
  scripts.each do |script_name|
74
74
  create_file("#{project_root}/package-scripts/project/#{script_name}") do
@@ -77,7 +77,7 @@ module Omnibus
77
77
  end
78
78
  end
79
79
 
80
- it 'writes the scripts into scripts staging dir' do
80
+ it "writes the scripts into scripts staging dir" do
81
81
  subject.write_scripts
82
82
 
83
83
  scripts.each do |script_name|
@@ -88,8 +88,8 @@ module Omnibus
88
88
  end
89
89
  end
90
90
 
91
- context 'when scripts with default omnibus naming are given' do
92
- let(:default_scripts) { %w( postinst postrm ) }
91
+ context "when scripts with default omnibus naming are given" do
92
+ let(:default_scripts) { %w{ postinst postrm } }
93
93
  before do
94
94
  default_scripts.each do |script_name|
95
95
  create_file("#{project_root}/package-scripts/project/#{script_name}") do
@@ -98,7 +98,7 @@ module Omnibus
98
98
  end
99
99
  end
100
100
 
101
- it 'writes the scripts into scripts staging dir' do
101
+ it "writes the scripts into scripts staging dir" do
102
102
  subject.write_scripts
103
103
 
104
104
  default_scripts.each do |script_name|
@@ -112,7 +112,7 @@ module Omnibus
112
112
  end
113
113
 
114
114
  describe '#write_prototype_file' do
115
- let(:prototype_file) { File.join(staging_dir, 'Prototype') }
115
+ let(:prototype_file) { File.join(staging_dir, "Prototype") }
116
116
 
117
117
  before do
118
118
  allow(subject).to receive(:shellout!)
@@ -124,12 +124,12 @@ module Omnibus
124
124
  end
125
125
  end
126
126
 
127
- it 'creates the prototype file' do
127
+ it "creates the prototype file" do
128
128
  subject.write_prototype_file
129
129
  contents = File.read(prototype_file)
130
130
 
131
131
  expect(contents).to include(
132
- <<-EOH.gsub(/^ {12}/, '')
132
+ <<-EOH.gsub(/^ {12}/, "")
133
133
  i pkginfo
134
134
  i postinstall
135
135
  i postremove
@@ -137,7 +137,7 @@ module Omnibus
137
137
  )
138
138
  end
139
139
 
140
- it 'uses the correct commands' do
140
+ it "uses the correct commands" do
141
141
  expect(subject).to receive(:shellout!)
142
142
  .with("cd /opt && find project -print > #{File.join(staging_dir, 'files')}")
143
143
  expect(subject).to receive(:shellout!)
@@ -147,16 +147,16 @@ module Omnibus
147
147
  subject.write_prototype_file
148
148
  end
149
149
 
150
- it 'strips out the file with spaces from files.clean' do
150
+ it "strips out the file with spaces from files.clean" do
151
151
  subject.write_prototype_file
152
- contents = File.read(File.join(staging_dir, 'files.clean'))
152
+ contents = File.read(File.join(staging_dir, "files.clean"))
153
153
  expect(contents).not_to include("a file with spaces")
154
154
  expect(contents).to include("/foo/bar/baz")
155
155
  end
156
156
  end
157
157
 
158
158
  describe '#create_solaris_file' do
159
- it 'uses the correct commands' do
159
+ it "uses the correct commands" do
160
160
  expect(subject).to receive(:shellout!)
161
161
  .with("pkgmk -o -r /opt -d #{staging_dir} -f #{File.join(staging_dir, 'Prototype')}")
162
162
  expect(subject).to receive(:shellout!)
@@ -169,16 +169,16 @@ module Omnibus
169
169
  end
170
170
 
171
171
  describe '#write_pkginfo_file' do
172
- let(:pkginfo_file) { File.join(staging_dir, 'pkginfo') }
172
+ let(:pkginfo_file) { File.join(staging_dir, "pkginfo") }
173
173
  let(:hostname) { Socket.gethostname }
174
174
  let(:now) { Time.now }
175
175
 
176
- it 'generates the file' do
176
+ it "generates the file" do
177
177
  subject.write_pkginfo_file
178
178
  expect(pkginfo_file).to be_a_file
179
179
  end
180
180
 
181
- it 'has the correct content' do
181
+ it "has the correct content" do
182
182
  allow(Time).to receive(:now).and_return(now)
183
183
  subject.write_pkginfo_file
184
184
  contents = File.read(pkginfo_file)
@@ -205,7 +205,7 @@ module Omnibus
205
205
  allow(Dir).to receive(:chdir) { |_, &b| b.call }
206
206
  end
207
207
 
208
- it 'uses the correct commands' do
208
+ it "uses the correct commands" do
209
209
  expect(subject).to receive(:shellout!)
210
210
  .with("pkgmk -o -r /opt -d #{staging_dir} -f #{File.join(staging_dir, 'Prototype')}")
211
211
  expect(subject).to receive(:shellout!)
@@ -218,27 +218,27 @@ module Omnibus
218
218
  end
219
219
 
220
220
  describe '#safe_architecture' do
221
- context 'the architecture is Intel-based' do
222
- let(:architecture) { 'i86pc' }
221
+ context "the architecture is Intel-based" do
222
+ let(:architecture) { "i86pc" }
223
223
 
224
- it 'returns `i386`' do
225
- expect(subject.safe_architecture).to eq('i386')
224
+ it "returns `i386`" do
225
+ expect(subject.safe_architecture).to eq("i386")
226
226
  end
227
227
  end
228
228
 
229
- context 'the architecture is SPARC-based' do
230
- let(:architecture) { 'sun4v' }
229
+ context "the architecture is SPARC-based" do
230
+ let(:architecture) { "sun4v" }
231
231
 
232
- it 'returns `sparc`' do
233
- expect(subject.safe_architecture).to eq('sparc')
232
+ it "returns `sparc`" do
233
+ expect(subject.safe_architecture).to eq("sparc")
234
234
  end
235
235
  end
236
236
 
237
- context 'anything else' do
238
- let(:architecture) { 'FOO' }
237
+ context "anything else" do
238
+ let(:architecture) { "FOO" }
239
239
 
240
- it 'returns the value from Ohai' do
241
- expect(subject.safe_architecture).to eq('FOO')
240
+ it "returns the value from Ohai" do
241
+ expect(subject.safe_architecture).to eq("FOO")
242
242
  end
243
243
  end
244
244
  end