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,15 +1,15 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Packager::DEB 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('2')
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("2")
12
+ project.maintainer("Chef Software")
13
13
  project.license(project_license) if project_license
14
14
  end
15
15
  end
@@ -17,9 +17,9 @@ module Omnibus
17
17
  subject { described_class.new(project) }
18
18
 
19
19
  let(:project_license) { nil }
20
- let(:project_root) { File.join(tmp_path, 'project/root') }
21
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
22
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
20
+ let(:project_root) { File.join(tmp_path, "project/root") }
21
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
22
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
23
23
 
24
24
  before do
25
25
  Config.project_root(project_root)
@@ -31,87 +31,87 @@ module Omnibus
31
31
  end
32
32
 
33
33
  describe '#vendor' do
34
- it 'is a DSL method' do
34
+ it "is a DSL method" do
35
35
  expect(subject).to have_exposed_method(:vendor)
36
36
  end
37
37
 
38
- it 'has a default value' do
39
- expect(subject.vendor).to eq('Omnibus <omnibus@getchef.com>')
38
+ it "has a default value" do
39
+ expect(subject.vendor).to eq("Omnibus <omnibus@getchef.com>")
40
40
  end
41
41
 
42
- it 'must be a string' do
42
+ it "must be a string" do
43
43
  expect { subject.vendor(Object.new) }.to raise_error(InvalidValue)
44
44
  end
45
45
  end
46
46
 
47
47
  describe '#license' do
48
- it 'is a DSL method' do
48
+ it "is a DSL method" do
49
49
  expect(subject).to have_exposed_method(:license)
50
50
  end
51
51
 
52
- it 'has a default value' do
53
- expect(subject.license).to eq('Unspecified')
52
+ it "has a default value" do
53
+ expect(subject.license).to eq("Unspecified")
54
54
  end
55
55
 
56
- it 'must be a string' do
56
+ it "must be a string" do
57
57
  expect { subject.license(Object.new) }.to raise_error(InvalidValue)
58
58
  end
59
59
 
60
- context 'with project license' do
61
- let(:project_license) { 'custom-license' }
60
+ context "with project license" do
61
+ let(:project_license) { "custom-license" }
62
62
 
63
- it 'uses project license' do
64
- expect(subject.license).to eq('custom-license')
63
+ it "uses project license" do
64
+ expect(subject.license).to eq("custom-license")
65
65
  end
66
66
  end
67
67
  end
68
68
 
69
69
  describe '#priority' do
70
- it 'is a DSL method' do
70
+ it "is a DSL method" do
71
71
  expect(subject).to have_exposed_method(:priority)
72
72
  end
73
73
 
74
- it 'has a default value' do
75
- expect(subject.priority).to eq('extra')
74
+ it "has a default value" do
75
+ expect(subject.priority).to eq("extra")
76
76
  end
77
77
 
78
- it 'must be a string' do
78
+ it "must be a string" do
79
79
  expect { subject.priority(Object.new) }.to raise_error(InvalidValue)
80
80
  end
81
81
  end
82
82
 
83
83
  describe '#section' do
84
- it 'is a DSL method' do
84
+ it "is a DSL method" do
85
85
  expect(subject).to have_exposed_method(:section)
86
86
  end
87
87
 
88
- it 'has a default value' do
89
- expect(subject.section).to eq('misc')
88
+ it "has a default value" do
89
+ expect(subject.section).to eq("misc")
90
90
  end
91
91
 
92
- it 'must be a string' do
92
+ it "must be a string" do
93
93
  expect { subject.section(Object.new) }.to raise_error(InvalidValue)
94
94
  end
95
95
  end
96
96
 
97
97
  describe '#id' do
98
- it 'is :deb' do
98
+ it "is :deb" do
99
99
  expect(subject.id).to eq(:deb)
100
100
  end
101
101
  end
102
102
 
103
103
  describe '#package_name' do
104
104
  before do
105
- allow(subject).to receive(:safe_architecture).and_return('amd64')
105
+ allow(subject).to receive(:safe_architecture).and_return("amd64")
106
106
  end
107
107
 
108
- it 'includes the name, version, and build iteration' do
109
- expect(subject.package_name).to eq('project_1.2.3-2_amd64.deb')
108
+ it "includes the name, version, and build iteration" do
109
+ expect(subject.package_name).to eq("project_1.2.3-2_amd64.deb")
110
110
  end
111
111
  end
112
112
 
113
113
  describe '#debian_dir' do
114
- it 'is nested inside the staging_dir' do
114
+ it "is nested inside the staging_dir" do
115
115
  expect(subject.debian_dir).to eq("#{staging_dir}/DEBIAN")
116
116
  end
117
117
  end
@@ -121,12 +121,12 @@ module Omnibus
121
121
  allow(subject).to receive(:safe_architecture).and_return("amd64")
122
122
  end
123
123
 
124
- it 'generates the file' do
124
+ it "generates the file" do
125
125
  subject.write_control_file
126
126
  expect("#{staging_dir}/DEBIAN/control").to be_a_file
127
127
  end
128
128
 
129
- it 'has the correct content' do
129
+ it "has the correct content" do
130
130
  subject.write_control_file
131
131
  contents = File.read("#{staging_dir}/DEBIAN/control")
132
132
 
@@ -146,25 +146,25 @@ module Omnibus
146
146
 
147
147
  describe '#write_conffiles_file' do
148
148
  before do
149
- project.config_file('/opt/project/file1')
150
- project.config_file('/opt/project/file2')
149
+ project.config_file("/opt/project/file1")
150
+ project.config_file("/opt/project/file2")
151
151
  end
152
152
 
153
- context 'when there are no files' do
153
+ context "when there are no files" do
154
154
  before { project.config_files.clear }
155
155
 
156
- it 'does not render the file' do
156
+ it "does not render the file" do
157
157
  subject.write_conffiles_file
158
158
  expect("#{staging_dir}/DEBIAN/conffiles").to_not be_a_file
159
159
  end
160
160
  end
161
161
 
162
- it 'generates the file' do
162
+ it "generates the file" do
163
163
  subject.write_conffiles_file
164
164
  expect("#{staging_dir}/DEBIAN/conffiles").to be_a_file
165
165
  end
166
166
 
167
- it 'has the correct content' do
167
+ it "has the correct content" do
168
168
  subject.write_conffiles_file
169
169
  contents = File.read("#{staging_dir}/DEBIAN/conffiles")
170
170
 
@@ -181,7 +181,7 @@ module Omnibus
181
181
  create_file("#{project_root}/package-scripts/project/postrm") { "postrm" }
182
182
  end
183
183
 
184
- it 'copies the scripts into the DEBIAN dir with permissions = 100755', :not_supported_on_windows do
184
+ it "copies the scripts into the DEBIAN dir with permissions = 100755", :not_supported_on_windows do
185
185
  subject.write_scripts
186
186
 
187
187
  expect("#{staging_dir}/DEBIAN/preinst").to be_a_file
@@ -189,13 +189,13 @@ module Omnibus
189
189
  expect("#{staging_dir}/DEBIAN/prerm").to be_a_file
190
190
  expect("#{staging_dir}/DEBIAN/postrm").to be_a_file
191
191
 
192
- expect("#{staging_dir}/DEBIAN/preinst").to have_permissions '100755'
193
- expect("#{staging_dir}/DEBIAN/postinst").to have_permissions '100755'
194
- expect("#{staging_dir}/DEBIAN/prerm").to have_permissions '100755'
195
- expect("#{staging_dir}/DEBIAN/postrm").to have_permissions '100755'
192
+ expect("#{staging_dir}/DEBIAN/preinst").to have_permissions "100755"
193
+ expect("#{staging_dir}/DEBIAN/postinst").to have_permissions "100755"
194
+ expect("#{staging_dir}/DEBIAN/prerm").to have_permissions "100755"
195
+ expect("#{staging_dir}/DEBIAN/postrm").to have_permissions "100755"
196
196
  end
197
197
 
198
- it 'logs a message' do
198
+ it "logs a message" do
199
199
  output = capture_logging do
200
200
  subject.write_scripts
201
201
  end
@@ -216,12 +216,12 @@ module Omnibus
216
216
  create_file("#{staging_dir}/DEBIAN/postrm") { "postrm" }
217
217
  end
218
218
 
219
- it 'generates the file' do
219
+ it "generates the file" do
220
220
  subject.write_md5_sums
221
221
  expect("#{staging_dir}/DEBIAN/md5sums").to be_a_file
222
222
  end
223
223
 
224
- it 'has the correct content' do
224
+ it "has the correct content" do
225
225
  subject.write_md5_sums
226
226
  contents = File.read("#{staging_dir}/DEBIAN/md5sums")
227
227
 
@@ -241,18 +241,18 @@ module Omnibus
241
241
  allow(subject).to receive(:safe_architecture).and_return("amd64")
242
242
  end
243
243
 
244
- it 'logs a message' do
244
+ it "logs a message" do
245
245
  output = capture_logging { subject.create_deb_file }
246
- expect(output).to include('Creating .deb file')
246
+ expect(output).to include("Creating .deb file")
247
247
  end
248
248
 
249
- it 'executes the command using `fakeroot`' do
249
+ it "executes the command using `fakeroot`" do
250
250
  expect(subject).to receive(:shellout!)
251
251
  .with(/\Afakeroot/)
252
252
  subject.create_deb_file
253
253
  end
254
254
 
255
- it 'uses the correct command' do
255
+ it "uses the correct command" do
256
256
  expect(subject).to receive(:shellout!)
257
257
  .with(/dpkg-deb -z9 -Zgzip -D --build/)
258
258
  subject.create_deb_file
@@ -267,25 +267,25 @@ module Omnibus
267
267
  create_file("#{staging_dir}/file2") { "2" * 20_000 }
268
268
  end
269
269
 
270
- it 'stats all the files in the install_dir' do
270
+ it "stats all the files in the install_dir" do
271
271
  expect(subject.package_size).to eq(29)
272
272
  end
273
273
  end
274
274
 
275
275
  describe '#safe_base_package_name' do
276
276
  context 'when the project name is "safe"' do
277
- it 'returns the value without logging a message' do
278
- expect(subject.safe_base_package_name).to eq('project')
277
+ it "returns the value without logging a message" do
278
+ expect(subject.safe_base_package_name).to eq("project")
279
279
  expect(subject).to_not receive(:log)
280
280
  end
281
281
  end
282
282
 
283
- context 'when the project name has invalid characters' do
283
+ context "when the project name has invalid characters" do
284
284
  before { project.name("Pro$ject123.for-realz_2") }
285
285
 
286
- it 'returns the value while logging a message' do
286
+ it "returns the value while logging a message" do
287
287
  output = capture_logging do
288
- expect(subject.safe_base_package_name).to eq('pro-ject123.for-realz-2')
288
+ expect(subject.safe_base_package_name).to eq("pro-ject123.for-realz-2")
289
289
  end
290
290
 
291
291
  expect(output).to include("The `name' component of Debian package names can only include")
@@ -294,37 +294,37 @@ module Omnibus
294
294
  end
295
295
 
296
296
  describe '#safe_build_iteration' do
297
- it 'returns the build iteration' do
297
+ it "returns the build iteration" do
298
298
  expect(subject.safe_build_iteration).to eq(project.build_iteration)
299
299
  end
300
300
  end
301
301
 
302
302
  describe '#safe_version' do
303
303
  context 'when the project build_version is "safe"' do
304
- it 'returns the value without logging a message' do
305
- expect(subject.safe_version).to eq('1.2.3')
304
+ it "returns the value without logging a message" do
305
+ expect(subject.safe_version).to eq("1.2.3")
306
306
  expect(subject).to_not receive(:log)
307
307
  end
308
308
  end
309
309
 
310
- context 'when the project build_version has dashes' do
311
- before { project.build_version('1.2-rc.1') }
310
+ context "when the project build_version has dashes" do
311
+ before { project.build_version("1.2-rc.1") }
312
312
 
313
- it 'returns the value while logging a message' do
313
+ it "returns the value while logging a message" do
314
314
  output = capture_logging do
315
- expect(subject.safe_version).to eq('1.2~rc.1')
315
+ expect(subject.safe_version).to eq("1.2~rc.1")
316
316
  end
317
317
 
318
318
  expect(output).to include("Dashes hold special significance in the Debian package versions.")
319
319
  end
320
320
  end
321
321
 
322
- context 'when the project build_version has invalid characters' do
322
+ context "when the project build_version has invalid characters" do
323
323
  before { project.build_version("1.2$alpha.~##__2") }
324
324
 
325
- it 'returns the value while logging a message' do
325
+ it "returns the value while logging a message" do
326
326
  output = capture_logging do
327
- expect(subject.safe_version).to eq('1.2_alpha.~_2')
327
+ expect(subject.safe_version).to eq("1.2_alpha.~_2")
328
328
  end
329
329
 
330
330
  expect(output).to include("The `version' component of Debian package names can only include")
@@ -1,27 +1,27 @@
1
- require 'spec_helper'
2
- require 'pry'
1
+ require "spec_helper"
2
+ require "pry"
3
3
 
4
4
  module Omnibus
5
5
  describe Packager::IPS do
6
6
  let(:project) do
7
7
  Project.new.tap do |project|
8
- project.name('project')
9
- project.homepage('https://example.com')
10
- project.install_dir('/opt/project')
11
- project.build_version('1.2.3')
12
- project.build_iteration('2')
13
- project.maintainer('Chef Software')
8
+ project.name("project")
9
+ project.homepage("https://example.com")
10
+ project.install_dir("/opt/project")
11
+ project.build_version("1.2.3")
12
+ project.build_iteration("2")
13
+ project.maintainer("Chef Software")
14
14
  end
15
15
  end
16
16
 
17
17
  subject { described_class.new(project) }
18
18
 
19
- let(:project_root) { File.join(tmp_path, 'project/root') }
20
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
21
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
22
- let(:source_dir) { File.join(staging_dir, 'proto_install')}
23
- let(:repo_dir) { File.join(staging_dir, 'publish/repo')}
24
- let(:architecture) { 'i86pc' }
19
+ let(:project_root) { File.join(tmp_path, "project/root") }
20
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
21
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
22
+ let(:source_dir) { File.join(staging_dir, "proto_install") }
23
+ let(:repo_dir) { File.join(staging_dir, "publish/repo") }
24
+ let(:architecture) { "i86pc" }
25
25
  let(:shellout) { double("Mixlib::ShellOut", :run_command => true, :error! => nil) }
26
26
 
27
27
  before do
@@ -34,18 +34,18 @@ module Omnibus
34
34
  create_directory(source_dir)
35
35
  create_directory(repo_dir)
36
36
 
37
- stub_ohai(platform: 'solaris2', version: '5.11') do |data|
38
- data['kernel']['machine'] = architecture
37
+ stub_ohai(platform: "solaris2", version: "5.11") do |data|
38
+ data["kernel"]["machine"] = architecture
39
39
  end
40
40
  end
41
41
 
42
42
  describe '#publisher_prefix' do
43
- it 'is a DSL method' do
43
+ it "is a DSL method" do
44
44
  expect(subject).to have_exposed_method(:publisher_prefix)
45
45
  end
46
46
 
47
- it 'has a default value' do
48
- expect(subject.publisher_prefix).to eq('Omnibus')
47
+ it "has a default value" do
48
+ expect(subject.publisher_prefix).to eq("Omnibus")
49
49
  end
50
50
  end
51
51
 
@@ -54,55 +54,55 @@ module Omnibus
54
54
  end
55
55
 
56
56
  describe '#package_name' do
57
- it 'should create correct package name' do
58
- expect(subject.package_name).to eq('project.p5p')
57
+ it "should create correct package name" do
58
+ expect(subject.package_name).to eq("project-1.2.3-2.i386.p5p")
59
59
  end
60
60
  end
61
61
 
62
62
  describe '#fmri_package_name' do
63
- it 'should create correct fmri package name' do
64
- expect(subject.fmri_package_name).to eq ('project@1.2.3,5.11-2')
63
+ it "should create correct fmri package name" do
64
+ expect(subject.fmri_package_name).to eq ("project@1.2.3,5.11-2")
65
65
  end
66
66
  end
67
67
 
68
68
  describe '#pkg_metadata_file' do
69
- it 'is created inside the staging_dir' do
69
+ it "is created inside the staging_dir" do
70
70
  expect(subject.pkg_metadata_file).to eq("#{subject.staging_dir}/gen.manifestfile")
71
71
  end
72
72
  end
73
73
 
74
74
  describe '#pkg_manifest_file' do
75
- it 'is created inside the staging_dir' do
75
+ it "is created inside the staging_dir" do
76
76
  expect(subject.pkg_manifest_file).to eq("#{subject.staging_dir}/#{subject.safe_base_package_name}.p5m")
77
77
  end
78
78
  end
79
79
 
80
80
  describe '#repo_dir' do
81
- it 'is created inside the staging_dir' do
81
+ it "is created inside the staging_dir" do
82
82
  expect(subject.repo_dir).to eq("#{subject.staging_dir}/publish/repo")
83
83
  end
84
84
  end
85
85
 
86
86
  describe '#source_dir' do
87
- it 'is created inside the staging_dir' do
87
+ it "is created inside the staging_dir" do
88
88
  expect(subject.source_dir).to eq("#{subject.staging_dir}/proto_install")
89
89
  end
90
90
  end
91
91
 
92
92
  describe '#safe_base_package_name' do
93
93
  context 'when the project name is "safe"' do
94
- it 'returns the value without logging a message' do
95
- expect(subject.safe_base_package_name).to eq('project')
94
+ it "returns the value without logging a message" do
95
+ expect(subject.safe_base_package_name).to eq("project")
96
96
  expect(subject).to_not receive(:log)
97
97
  end
98
98
  end
99
99
 
100
- context 'when the project name has invalid characters' do
100
+ context "when the project name has invalid characters" do
101
101
  before { project.name("Pro$ject123.for-realz_2") }
102
102
 
103
- it 'returns the value while logging a message' do
103
+ it "returns the value while logging a message" do
104
104
  output = capture_logging do
105
- expect(subject.safe_base_package_name).to eq('pro-ject123.for-realz-2')
105
+ expect(subject.safe_base_package_name).to eq("pro-ject123.for-realz-2")
106
106
  end
107
107
 
108
108
  expect(output).to include("The `name' component of IPS package names can only include")
@@ -111,27 +111,27 @@ module Omnibus
111
111
  end
112
112
 
113
113
  describe '#safe_architecture' do
114
- context 'the architecture is Intel-based' do
115
- let(:architecture) { 'i86pc' }
114
+ context "the architecture is Intel-based" do
115
+ let(:architecture) { "i86pc" }
116
116
 
117
- it 'returns `i386`' do
118
- expect(subject.safe_architecture).to eq('i386')
117
+ it "returns `i386`" do
118
+ expect(subject.safe_architecture).to eq("i386")
119
119
  end
120
120
  end
121
121
 
122
- context 'the architecture is SPARC-based' do
123
- let(:architecture) { 'sun4v' }
122
+ context "the architecture is SPARC-based" do
123
+ let(:architecture) { "sun4v" }
124
124
 
125
- it 'returns `sparc`' do
126
- expect(subject.safe_architecture).to eq('sparc')
125
+ it "returns `sparc`" do
126
+ expect(subject.safe_architecture).to eq("sparc")
127
127
  end
128
128
  end
129
129
 
130
- context 'anything else' do
131
- let(:architecture) { 'FOO' }
130
+ context "anything else" do
131
+ let(:architecture) { "FOO" }
132
132
 
133
- it 'returns the value from Ohai' do
134
- expect(subject.safe_architecture).to eq('FOO')
133
+ it "returns the value from Ohai" do
134
+ expect(subject.safe_architecture).to eq("FOO")
135
135
  end
136
136
  end
137
137
  end
@@ -211,7 +211,7 @@ module Omnibus
211
211
  describe "#export_pkg_archive_file" do
212
212
  it "uses the correct commands" do
213
213
  expect(subject).to receive(:shellout!)
214
- .with("pkgrecv -s #{staging_dir}/publish/repo -a -d #{package_dir}/project.p5p project")
214
+ .with("pkgrecv -s #{staging_dir}/publish/repo -a -d #{package_dir}/project-1.2.3-2.i386.p5p project")
215
215
 
216
216
  expect(shellout).to receive(:stdout)
217
217
  subject.export_pkg_archive_file
@@ -1,23 +1,23 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Packager::Makeself 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('2')
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("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/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/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
23
  Config.project_root(project_root)
@@ -28,37 +28,37 @@ module Omnibus
28
28
  end
29
29
 
30
30
  describe '#id' do
31
- it 'is :makeself' do
31
+ it "is :makeself" do
32
32
  expect(subject.id).to eq(:makeself)
33
33
  end
34
34
  end
35
35
 
36
36
  describe '#package_name' do
37
37
  before do
38
- allow(subject).to receive(:safe_architecture).and_return('x86_64')
38
+ allow(subject).to receive(:safe_architecture).and_return("x86_64")
39
39
  end
40
40
 
41
- it 'includes the name, version, and build iteration' do
42
- expect(subject.package_name).to eq('project-1.2.3_2.x86_64.sh')
41
+ it "includes the name, version, and build iteration" do
42
+ expect(subject.package_name).to eq("project-1.2.3_2.x86_64.sh")
43
43
  end
44
44
  end
45
45
 
46
46
  describe '#write_makeselfinst' do
47
- it 'generates the executable file', :not_supported_on_windows do
47
+ it "generates the executable file", :not_supported_on_windows do
48
48
  subject.write_makeselfinst
49
49
  expect("#{staging_dir}/makeselfinst").to be_an_executable
50
50
  end
51
51
 
52
- it 'has the correct content' do
52
+ it "has the correct content" do
53
53
  subject.write_makeselfinst
54
54
  contents = File.read("#{staging_dir}/makeselfinst")
55
55
 
56
- expect(contents).to include('INSTALL_DIR=/opt/project')
56
+ expect(contents).to include("INSTALL_DIR=/opt/project")
57
57
  end
58
58
  end
59
59
 
60
60
  describe '#write_scripts' do
61
- let(:default_scripts) { %w( postinst ) }
61
+ let(:default_scripts) { %w{ postinst } }
62
62
  before do
63
63
  default_scripts.each do |script_name|
64
64
  create_file("#{project_root}/package-scripts/project/#{script_name}") do
@@ -67,7 +67,7 @@ module Omnibus
67
67
  end
68
68
  end
69
69
 
70
- it 'writes the scripts into the staging dir' do
70
+ it "writes the scripts into the staging dir" do
71
71
  subject.write_scripts
72
72
 
73
73
  default_scripts.each do |script_name|
@@ -85,12 +85,12 @@ module Omnibus
85
85
  allow(Dir).to receive(:chdir) { |_, &b| b.call }
86
86
  end
87
87
 
88
- it 'logs a message' do
88
+ it "logs a message" do
89
89
  output = capture_logging { subject.create_makeself_package }
90
- expect(output).to include('Creating makeself package')
90
+ expect(output).to include("Creating makeself package")
91
91
  end
92
92
 
93
- it 'uses the correct command' do
93
+ it "uses the correct command" do
94
94
  expect(subject).to receive(:shellout!)
95
95
  .with(/makeself\.sh/)
96
96
  subject.create_makeself_package