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,26 +1,26 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Packager::PKG do
5
5
  let(:project) do
6
6
  Project.new.tap do |project|
7
- project.name('project-full-name')
8
- project.homepage('https://example.com')
9
- project.install_dir('/opt/project-full-name')
10
- project.build_version('1.2.3')
11
- project.build_iteration('2')
12
- project.maintainer('Chef Software')
7
+ project.name("project-full-name")
8
+ project.homepage("https://example.com")
9
+ project.install_dir("/opt/project-full-name")
10
+ project.build_version("1.2.3")
11
+ project.build_iteration("2")
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-full-name/root') }
19
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
20
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
18
+ let(:project_root) { File.join(tmp_path, "project-full-name/root") }
19
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
20
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
21
21
 
22
22
  before do
23
- subject.identifier('com.getchef.project-full-name')
23
+ subject.identifier("com.getchef.project-full-name")
24
24
 
25
25
  Config.project_root(project_root)
26
26
  Config.package_dir(package_dir)
@@ -30,43 +30,43 @@ module Omnibus
30
30
  create_directory("#{staging_dir}/Scripts")
31
31
  end
32
32
 
33
- describe 'DSL' do
34
- it 'exposes :identifier' do
33
+ describe "DSL" do
34
+ it "exposes :identifier" do
35
35
  expect(subject).to have_exposed_method(:identifier)
36
36
  end
37
37
 
38
- it 'exposes :signing_identity' do
38
+ it "exposes :signing_identity" do
39
39
  expect(subject).to have_exposed_method(:signing_identity)
40
40
  end
41
41
  end
42
42
 
43
43
  describe '#id' do
44
- it 'is :pkg' do
44
+ it "is :pkg" do
45
45
  expect(subject.id).to eq(:pkg)
46
46
  end
47
47
  end
48
48
 
49
49
  describe '#package_name' do
50
- it 'includes the name, version, and build iteration' do
51
- expect(subject.package_name).to eq('project-full-name-1.2.3-2.pkg')
50
+ it "includes the name, version, and build iteration" do
51
+ expect(subject.package_name).to eq("project-full-name-1.2.3-2.pkg")
52
52
  end
53
53
  end
54
54
 
55
55
  describe '#resources_dir' do
56
- it 'is nested inside the staging_dir' do
56
+ it "is nested inside the staging_dir" do
57
57
  expect(subject.resources_dir).to eq("#{staging_dir}/Resources")
58
58
  end
59
59
  end
60
60
 
61
61
  describe '#scripts_dir' do
62
- it 'is nested inside the staging_dir' do
62
+ it "is nested inside the staging_dir" do
63
63
  expect(subject.scripts_dir).to eq("#{staging_dir}/Scripts")
64
64
  end
65
65
  end
66
66
 
67
67
  describe '#write_scripts' do
68
- context 'when scripts are given' do
69
- let(:scripts) { %w( preinstall postinstall ) }
68
+ context "when scripts are given" do
69
+ let(:scripts) { %w{ preinstall postinstall } }
70
70
  before do
71
71
  scripts.each do |script_name|
72
72
  create_file("#{project_root}/package-scripts/project-full-name/#{script_name}") do
@@ -75,7 +75,7 @@ module Omnibus
75
75
  end
76
76
  end
77
77
 
78
- it 'writes the scripts into scripts staging dir' do
78
+ it "writes the scripts into scripts staging dir" do
79
79
  subject.write_scripts
80
80
 
81
81
  scripts.each do |script_name|
@@ -86,8 +86,8 @@ module Omnibus
86
86
  end
87
87
  end
88
88
 
89
- context 'when scripts with default omnibus naming are given' do
90
- let(:default_scripts) { %w( preinst postinst ) }
89
+ context "when scripts with default omnibus naming are given" do
90
+ let(:default_scripts) { %w{ preinst postinst } }
91
91
  before do
92
92
  default_scripts.each do |script_name|
93
93
  create_file("#{project_root}/package-scripts/project-full-name/#{script_name}") do
@@ -96,7 +96,7 @@ module Omnibus
96
96
  end
97
97
  end
98
98
 
99
- it 'writes the scripts into scripts staging dir' do
99
+ it "writes the scripts into scripts staging dir" do
100
100
  subject.write_scripts
101
101
 
102
102
  default_scripts.each do |script_name|
@@ -109,10 +109,9 @@ module Omnibus
109
109
  end
110
110
  end
111
111
 
112
-
113
112
  describe '#build_component_pkg' do
114
- it 'executes the pkgbuild command' do
115
- expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {10}/, '')
113
+ it "executes the pkgbuild command" do
114
+ expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {10}/, "")
116
115
  pkgbuild \\
117
116
  --identifier "com.getchef.project-full-name" \\
118
117
  --version "1.2.3" \\
@@ -127,25 +126,25 @@ module Omnibus
127
126
  end
128
127
 
129
128
  describe '#write_distribution_file' do
130
- it 'generates the file' do
129
+ it "generates the file" do
131
130
  subject.write_distribution_file
132
131
  expect("#{staging_dir}/Distribution").to be_a_file
133
132
  end
134
133
 
135
- it 'has the correct content' do
134
+ it "has the correct content" do
136
135
  subject.write_distribution_file
137
136
  contents = File.read("#{staging_dir}/Distribution")
138
137
 
139
138
  expect(contents).to include('<pkg-ref id="com.getchef.project-full-name"/>')
140
139
  expect(contents).to include('<line choice="com.getchef.project-full-name"/>')
141
- expect(contents).to include('project-full-name-core.pkg')
140
+ expect(contents).to include("project-full-name-core.pkg")
142
141
  end
143
142
  end
144
143
 
145
144
  describe '#build_product_pkg' do
146
- context 'when pkg signing is disabled' do
147
- it 'generates the distribution and runs productbuild' do
148
- expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/, '')
145
+ context "when pkg signing is disabled" do
146
+ it "generates the distribution and runs productbuild" do
147
+ expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/, "")
149
148
  productbuild \\
150
149
  --distribution "#{staging_dir}/Distribution" \\
151
150
  --resources "#{staging_dir}/Resources" \\
@@ -156,13 +155,13 @@ module Omnibus
156
155
  end
157
156
  end
158
157
 
159
- context 'when pkg signing is enabled' do
158
+ context "when pkg signing is enabled" do
160
159
  before do
161
- subject.signing_identity('My Special Identity')
160
+ subject.signing_identity("My Special Identity")
162
161
  end
163
162
 
164
- it 'includes the signing parameters in the product build command' do
165
- expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/, '')
163
+ it "includes the signing parameters in the product build command" do
164
+ expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/, "")
166
165
  productbuild \\
167
166
  --distribution "#{staging_dir}/Distribution" \\
168
167
  --resources "#{staging_dir}/Resources" \\
@@ -179,32 +178,32 @@ module Omnibus
179
178
  project.name('$Project#')
180
179
  end
181
180
 
182
- it 'uses com.example.PROJECT_NAME as the identifier' do
183
- expect(subject.safe_identifier).to eq('test.chefsoftware.pkg.project')
181
+ it "uses com.example.PROJECT_NAME as the identifier" do
182
+ expect(subject.safe_identifier).to eq("test.chefsoftware.pkg.project")
184
183
  end
185
184
  end
186
185
  end
187
186
 
188
187
  describe '#component_pkg' do
189
- it 'returns the project name with -core.pkg' do
190
- expect(subject.component_pkg).to eq('project-full-name-core.pkg')
188
+ it "returns the project name with -core.pkg" do
189
+ expect(subject.component_pkg).to eq("project-full-name-core.pkg")
191
190
  end
192
191
  end
193
192
 
194
193
  describe '#safe_base_package_name' do
195
194
  context 'when the project name is "safe"' do
196
- it 'returns the value without logging a message' do
197
- expect(subject.safe_base_package_name).to eq('project-full-name')
195
+ it "returns the value without logging a message" do
196
+ expect(subject.safe_base_package_name).to eq("project-full-name")
198
197
  expect(subject).to_not receive(:log)
199
198
  end
200
199
  end
201
200
 
202
- context 'when the project name has invalid characters' do
201
+ context "when the project name has invalid characters" do
203
202
  before { project.name("$Project123.for-realz_2") }
204
203
 
205
- it 'returns the value while logging a message' do
204
+ it "returns the value while logging a message" do
206
205
  output = capture_logging do
207
- expect(subject.safe_base_package_name).to eq('project123forrealz2')
206
+ expect(subject.safe_base_package_name).to eq("project123forrealz2")
208
207
  end
209
208
 
210
209
  expect(output).to include("The `name' component of Mac package names can only include")
@@ -214,18 +213,18 @@ module Omnibus
214
213
 
215
214
  describe '#safe_identifier' do
216
215
  context 'when Project#identifier is given' do
217
- before { subject.identifier('com.apple.project') }
216
+ before { subject.identifier("com.apple.project") }
218
217
 
219
- it 'is used' do
220
- expect(subject.safe_identifier).to eq('com.apple.project')
218
+ it "is used" do
219
+ expect(subject.safe_identifier).to eq("com.apple.project")
221
220
  end
222
221
  end
223
222
 
224
- context 'when no value in project is given' do
223
+ context "when no value in project is given" do
225
224
  before { subject.identifier(nil) }
226
225
 
227
- it 'is interpreted' do
228
- expect(subject.safe_identifier).to eq('test.chefsoftware.pkg.project-full-name')
226
+ it "is interpreted" do
227
+ expect(subject.safe_identifier).to eq("test.chefsoftware.pkg.project-full-name")
229
228
  end
230
229
  end
231
230
 
@@ -237,31 +236,31 @@ module Omnibus
237
236
  end
238
237
 
239
238
  it 'uses the "safe" values' do
240
- expect(subject.safe_identifier).to eq('test.thisissparta.pkg.project123forrealz2')
239
+ expect(subject.safe_identifier).to eq("test.thisissparta.pkg.project123forrealz2")
241
240
  end
242
241
  end
243
242
  end
244
243
 
245
244
  describe '#safe_build_iteration' do
246
- it 'returns the build iternation' do
245
+ it "returns the build iternation" do
247
246
  expect(subject.safe_build_iteration).to eq(project.build_iteration)
248
247
  end
249
248
  end
250
249
 
251
250
  describe '#safe_version' do
252
251
  context 'when the project build_version is "safe"' do
253
- it 'returns the value without logging a message' do
254
- expect(subject.safe_version).to eq('1.2.3')
252
+ it "returns the value without logging a message" do
253
+ expect(subject.safe_version).to eq("1.2.3")
255
254
  expect(subject).to_not receive(:log)
256
255
  end
257
256
  end
258
257
 
259
- context 'when the project build_version has invalid characters' do
258
+ context "when the project build_version has invalid characters" do
260
259
  before { project.build_version("1.2$alpha.##__2") }
261
260
 
262
- it 'returns the value while logging a message' do
261
+ it "returns the value while logging a message" do
263
262
  output = capture_logging do
264
- expect(subject.safe_version).to eq('1.2-alpha.-2')
263
+ expect(subject.safe_version).to eq("1.2-alpha.-2")
265
264
  end
266
265
 
267
266
  expect(output).to include("The `version' component of Mac package names can only include")