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,16 +1,16 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Packager::RPM 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')
13
- project.replace('old-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")
13
+ project.replace("old-project")
14
14
  project.license(project_license) if project_license
15
15
  end
16
16
  end
@@ -18,10 +18,10 @@ module Omnibus
18
18
  subject { described_class.new(project) }
19
19
 
20
20
  let(:project_license) { nil }
21
- let(:project_root) { File.join(tmp_path, 'project/root') }
22
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
23
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
24
- let(:architecture) { 'x86_64' }
21
+ let(:project_root) { File.join(tmp_path, "project/root") }
22
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
23
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
24
+ let(:architecture) { "x86_64" }
25
25
 
26
26
  before do
27
27
  Config.project_root(project_root)
@@ -35,143 +35,142 @@ module Omnibus
35
35
  create_directory("#{staging_dir}/SOURCES")
36
36
  create_directory("#{staging_dir}/SPECS")
37
37
 
38
- stub_ohai(platform: 'redhat', version: '6.5') do |data|
39
- data['kernel']['machine'] = architecture
38
+ stub_ohai(platform: "redhat", version: "6.5") do |data|
39
+ data["kernel"]["machine"] = architecture
40
40
  end
41
41
  end
42
42
 
43
43
  describe '#signing_passphrase' do
44
- it 'is a DSL method' do
44
+ it "is a DSL method" do
45
45
  expect(subject).to have_exposed_method(:signing_passphrase)
46
46
  end
47
47
 
48
- it 'has a no default value' do
48
+ it "has a no default value" do
49
49
  expect(subject.signing_passphrase).to be(nil)
50
50
  end
51
51
  end
52
52
 
53
-
54
53
  describe '#vendor' do
55
- it 'is a DSL method' do
54
+ it "is a DSL method" do
56
55
  expect(subject).to have_exposed_method(:vendor)
57
56
  end
58
57
 
59
- it 'has a default value' do
60
- expect(subject.vendor).to eq('Omnibus <omnibus@getchef.com>')
58
+ it "has a default value" do
59
+ expect(subject.vendor).to eq("Omnibus <omnibus@getchef.com>")
61
60
  end
62
61
 
63
- it 'must be a string' do
62
+ it "must be a string" do
64
63
  expect { subject.vendor(Object.new) }.to raise_error(InvalidValue)
65
64
  end
66
65
  end
67
66
 
68
67
  describe '#license' do
69
- it 'is a DSL method' do
68
+ it "is a DSL method" do
70
69
  expect(subject).to have_exposed_method(:license)
71
70
  end
72
71
 
73
- it 'has a default value' do
74
- expect(subject.license).to eq('Unspecified')
72
+ it "has a default value" do
73
+ expect(subject.license).to eq("Unspecified")
75
74
  end
76
75
 
77
- it 'must be a string' do
76
+ it "must be a string" do
78
77
  expect { subject.license(Object.new) }.to raise_error(InvalidValue)
79
78
  end
80
79
 
81
- context 'with project license' do
82
- let(:project_license) { 'custom-license' }
80
+ context "with project license" do
81
+ let(:project_license) { "custom-license" }
83
82
 
84
- it 'uses project license' do
85
- expect(subject.license).to eq('custom-license')
83
+ it "uses project license" do
84
+ expect(subject.license).to eq("custom-license")
86
85
  end
87
86
  end
88
87
  end
89
88
 
90
89
  describe '#priority' do
91
- it 'is a DSL method' do
90
+ it "is a DSL method" do
92
91
  expect(subject).to have_exposed_method(:priority)
93
92
  end
94
93
 
95
- it 'has a default value' do
96
- expect(subject.priority).to eq('extra')
94
+ it "has a default value" do
95
+ expect(subject.priority).to eq("extra")
97
96
  end
98
97
 
99
- it 'must be a string' do
98
+ it "must be a string" do
100
99
  expect { subject.priority(Object.new) }.to raise_error(InvalidValue)
101
100
  end
102
101
  end
103
102
 
104
103
  describe '#category' do
105
- it 'is a DSL method' do
104
+ it "is a DSL method" do
106
105
  expect(subject).to have_exposed_method(:category)
107
106
  end
108
107
 
109
- it 'has a default value' do
110
- expect(subject.category).to eq('default')
108
+ it "has a default value" do
109
+ expect(subject.category).to eq("default")
111
110
  end
112
111
 
113
- it 'must be a string' do
112
+ it "must be a string" do
114
113
  expect { subject.category(Object.new) }.to raise_error(InvalidValue)
115
114
  end
116
115
  end
117
116
 
118
117
  describe '#dist_tag' do
119
- it 'is a DSL method' do
118
+ it "is a DSL method" do
120
119
  expect(subject).to have_exposed_method(:dist_tag)
121
120
  end
122
121
 
123
- it 'has a default value' do
124
- expect(subject.dist_tag).to eq('.el6')
122
+ it "has a default value" do
123
+ expect(subject.dist_tag).to eq(".el6")
125
124
  end
126
125
  end
127
126
 
128
127
  describe '#id' do
129
- it 'is :rpm' do
128
+ it "is :rpm" do
130
129
  expect(subject.id).to eq(:rpm)
131
130
  end
132
131
  end
133
132
 
134
133
  describe '#package_name' do
135
- context 'when dist_tag is enabled' do
134
+ context "when dist_tag is enabled" do
136
135
  before do
137
- allow(subject).to receive(:safe_architecture).and_return('x86_64')
136
+ allow(subject).to receive(:safe_architecture).and_return("x86_64")
138
137
  end
139
138
 
140
- it 'includes the name, version, and build iteration' do
141
- expect(subject.package_name).to eq('project-1.2.3-2.el6.x86_64.rpm')
139
+ it "includes the name, version, and build iteration" do
140
+ expect(subject.package_name).to eq("project-1.2.3-2.el6.x86_64.rpm")
142
141
  end
143
142
  end
144
143
 
145
- context 'when dist_tag is disabled' do
144
+ context "when dist_tag is disabled" do
146
145
  before do
147
146
  allow(subject).to receive(:dist_tag).and_return(false)
148
147
  end
149
148
 
150
- it 'excludes dist tag' do
151
- expect(subject.package_name).to eq('project-1.2.3-2.x86_64.rpm')
149
+ it "excludes dist tag" do
150
+ expect(subject.package_name).to eq("project-1.2.3-2.x86_64.rpm")
152
151
  end
153
152
  end
154
153
  end
155
154
 
156
155
  describe '#build_dir' do
157
- it 'is nested inside the staging_dir' do
156
+ it "is nested inside the staging_dir" do
158
157
  expect(subject.build_dir).to eq("#{staging_dir}/BUILD")
159
158
  end
160
159
  end
161
160
 
162
161
  describe '#write_rpm_spec' do
163
162
  before do
164
- allow(subject).to receive(:safe_architecture).and_return('x86_64')
163
+ allow(subject).to receive(:safe_architecture).and_return("x86_64")
165
164
  end
166
165
 
167
166
  let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.el6.x86_64.rpm.spec" }
168
167
 
169
- it 'generates the file' do
168
+ it "generates the file" do
170
169
  subject.write_rpm_spec
171
170
  expect(spec_file).to be_a_file
172
171
  end
173
172
 
174
- it 'has the correct content' do
173
+ it "has the correct content" do
175
174
  subject.write_rpm_spec
176
175
  contents = File.read(spec_file)
177
176
 
@@ -190,8 +189,8 @@ module Omnibus
190
189
  expect(contents).to include("Obsoletes: old-project")
191
190
  end
192
191
 
193
- context 'when scripts are given' do
194
- let(:scripts) { %w( pre post preun postun verifyscript pretans posttrans ) }
192
+ context "when scripts are given" do
193
+ let(:scripts) { %w{ pre post preun postun verifyscript pretans posttrans } }
195
194
 
196
195
  before do
197
196
  scripts.each do |script_name|
@@ -201,7 +200,7 @@ module Omnibus
201
200
  end
202
201
  end
203
202
 
204
- it 'writes the scripts into the spec' do
203
+ it "writes the scripts into the spec" do
205
204
  subject.write_rpm_spec
206
205
  contents = File.read(spec_file)
207
206
 
@@ -212,8 +211,8 @@ module Omnibus
212
211
  end
213
212
  end
214
213
 
215
- context 'when scripts with default omnibus naming are given' do
216
- let(:default_scripts) { %w( preinst postinst prerm postrm ) }
214
+ context "when scripts with default omnibus naming are given" do
215
+ let(:default_scripts) { %w{ preinst postinst prerm postrm } }
217
216
 
218
217
  before do
219
218
  default_scripts.each do |default_name|
@@ -223,7 +222,7 @@ module Omnibus
223
222
  end
224
223
  end
225
224
 
226
- it 'writes the scripts into the spec' do
225
+ it "writes the scripts into the spec" do
227
226
  subject.write_rpm_spec
228
227
  contents = File.read(spec_file)
229
228
 
@@ -235,7 +234,7 @@ module Omnibus
235
234
  end
236
235
  end
237
236
 
238
- context 'when files and directories are present' do
237
+ context "when files and directories are present" do
239
238
  before do
240
239
  create_file("#{staging_dir}/BUILD/.file1")
241
240
  create_file("#{staging_dir}/BUILD/file2")
@@ -244,7 +243,7 @@ module Omnibus
244
243
  create_directory("#{staging_dir}/BUILD/dir3 space")
245
244
  end
246
245
 
247
- it 'writes them into the spec' do
246
+ it "writes them into the spec" do
248
247
  subject.write_rpm_spec
249
248
  contents = File.read(spec_file)
250
249
 
@@ -256,14 +255,14 @@ module Omnibus
256
255
  end
257
256
  end
258
257
 
259
- context 'when leaf directories owned by the filesystem package are present' do
258
+ context "when leaf directories owned by the filesystem package are present" do
260
259
  before do
261
260
  create_directory("#{staging_dir}/BUILD/usr/lib")
262
261
  create_directory("#{staging_dir}/BUILD/opt")
263
262
  create_file("#{staging_dir}/BUILD/opt/thing")
264
263
  end
265
264
 
266
- it 'is written into the spec with ownership and permissions' do
265
+ it "is written into the spec with ownership and permissions" do
267
266
  subject.write_rpm_spec
268
267
  contents = File.read(spec_file)
269
268
 
@@ -272,14 +271,14 @@ module Omnibus
272
271
  end
273
272
  end
274
273
 
275
- context 'when the platform_family is wrlinux' do
274
+ context "when the platform_family is wrlinux" do
276
275
  let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.nexus5.x86_64.rpm.spec" }
277
276
 
278
277
  before do
279
- stub_ohai(platform: 'nexus', version: '5')
278
+ stub_ohai(platform: "nexus", version: "5")
280
279
  end
281
280
 
282
- it 'writes out a spec file with no BuildArch' do
281
+ it "writes out a spec file with no BuildArch" do
283
282
  subject.write_rpm_spec
284
283
  contents = File.read(spec_file)
285
284
 
@@ -287,14 +286,14 @@ module Omnibus
287
286
  end
288
287
  end
289
288
 
290
- context 'when dist_tag is disabled' do
289
+ context "when dist_tag is disabled" do
291
290
  let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.x86_64.rpm.spec" }
292
291
 
293
292
  before do
294
293
  allow(subject).to receive(:dist_tag).and_return(false)
295
294
  end
296
295
 
297
- it 'has the correct release' do
296
+ it "has the correct release" do
298
297
  subject.write_rpm_spec
299
298
  contents = File.read(spec_file)
300
299
  expect(contents).to include("Release: 2")
@@ -308,24 +307,24 @@ module Omnibus
308
307
  allow(Dir).to receive(:chdir) { |_, &b| b.call }
309
308
  end
310
309
 
311
- it 'logs a message' do
310
+ it "logs a message" do
312
311
  output = capture_logging { subject.create_rpm_file }
313
- expect(output).to include('Creating .rpm file')
312
+ expect(output).to include("Creating .rpm file")
314
313
  end
315
314
 
316
- it 'uses the correct command' do
315
+ it "uses the correct command" do
317
316
  expect(subject).to receive(:shellout!)
318
317
  .with(/rpmbuild --target #{architecture} -bb --buildroot/)
319
318
  subject.create_rpm_file
320
319
  end
321
320
 
322
- context 'when RPM signing is enabled' do
321
+ context "when RPM signing is enabled" do
323
322
  before do
324
- subject.signing_passphrase('foobar')
323
+ subject.signing_passphrase("foobar")
325
324
  allow(Dir).to receive(:mktmpdir).and_return(tmp_path)
326
325
  end
327
326
 
328
- it 'signs the rpm' do
327
+ it "signs the rpm" do
329
328
  expect(subject).to receive(:shellout!)
330
329
  .with(/sign\-rpm/, kind_of(Hash))
331
330
  subject.create_rpm_file
@@ -335,50 +334,50 @@ module Omnibus
335
334
 
336
335
  describe '#spec_file' do
337
336
  before do
338
- allow(subject).to receive(:package_name).and_return('package_name')
337
+ allow(subject).to receive(:package_name).and_return("package_name")
339
338
  end
340
339
 
341
- it 'includes the package_name' do
340
+ it "includes the package_name" do
342
341
  expect(subject.spec_file).to eq("#{staging_dir}/SPECS/package_name.spec")
343
342
  end
344
343
  end
345
344
 
346
345
  describe '#rpm_safe' do
347
- it 'adds quotes when required' do
348
- expect(subject.rpm_safe('file path')).to eq('"file path"')
346
+ it "adds quotes when required" do
347
+ expect(subject.rpm_safe("file path")).to eq('"file path"')
349
348
  end
350
349
 
351
- it 'escapes [' do
352
- expect(subject.rpm_safe('[foo')).to eq('[\\[]foo')
350
+ it "escapes [" do
351
+ expect(subject.rpm_safe("[foo")).to eq('[\\[]foo')
353
352
  end
354
353
 
355
- it 'escapes *' do
356
- expect(subject.rpm_safe('*foo')).to eq('[*]foo')
354
+ it "escapes *" do
355
+ expect(subject.rpm_safe("*foo")).to eq("[*]foo")
357
356
  end
358
357
 
359
- it 'escapes ?' do
360
- expect(subject.rpm_safe('?foo')).to eq('[?]foo')
358
+ it "escapes ?" do
359
+ expect(subject.rpm_safe("?foo")).to eq("[?]foo")
361
360
  end
362
361
 
363
- it 'escapes %' do
364
- expect(subject.rpm_safe('%foo')).to eq('[%]foo')
362
+ it "escapes %" do
363
+ expect(subject.rpm_safe("%foo")).to eq("[%]foo")
365
364
  end
366
365
  end
367
366
 
368
367
  describe '#safe_base_package_name' do
369
368
  context 'when the project name is "safe"' do
370
- it 'returns the value without logging a message' do
371
- expect(subject.safe_base_package_name).to eq('project')
369
+ it "returns the value without logging a message" do
370
+ expect(subject.safe_base_package_name).to eq("project")
372
371
  expect(subject).to_not receive(:log)
373
372
  end
374
373
  end
375
374
 
376
- context 'when the project name has invalid characters' do
375
+ context "when the project name has invalid characters" do
377
376
  before { project.name("Pro$ject123.for-realz_2") }
378
377
 
379
- it 'returns the value while logging a message' do
378
+ it "returns the value while logging a message" do
380
379
  output = capture_logging do
381
- expect(subject.safe_base_package_name).to eq('pro-ject123.for-realz-2')
380
+ expect(subject.safe_base_package_name).to eq("pro-ject123.for-realz-2")
382
381
  end
383
382
 
384
383
  expect(output).to include("The `name' component of RPM package names can only include")
@@ -387,67 +386,67 @@ module Omnibus
387
386
  end
388
387
 
389
388
  describe '#safe_build_iteration' do
390
- it 'returns the build iternation' do
389
+ it "returns the build iternation" do
391
390
  expect(subject.safe_build_iteration).to eq(project.build_iteration)
392
391
  end
393
392
  end
394
393
 
395
394
  describe '#safe_version' do
396
395
  context 'when the project build_version is "safe"' do
397
- it 'returns the value without logging a message' do
398
- expect(subject.safe_version).to eq('1.2.3')
396
+ it "returns the value without logging a message" do
397
+ expect(subject.safe_version).to eq("1.2.3")
399
398
  expect(subject).to_not receive(:log)
400
399
  end
401
400
  end
402
401
 
403
- context 'when the project build_version has dashes' do
404
- before { project.build_version('1.2-rc.1') }
402
+ context "when the project build_version has dashes" do
403
+ before { project.build_version("1.2-rc.1") }
405
404
 
406
- it 'returns the value while logging a message' do
405
+ it "returns the value while logging a message" do
407
406
  output = capture_logging do
408
- expect(subject.safe_version).to eq('1.2~rc.1')
407
+ expect(subject.safe_version).to eq("1.2~rc.1")
409
408
  end
410
409
 
411
410
  expect(output).to include("Tildes hold special significance in the RPM package versions.")
412
411
  end
413
412
  end
414
413
 
415
- context 'when the project build_version has invalid characters' do
414
+ context "when the project build_version has invalid characters" do
416
415
  before { project.build_version("1.2-pre_alpha.##__2") }
417
416
 
418
- it 'returns the value while logging a message' do
417
+ it "returns the value while logging a message" do
419
418
  output = capture_logging do
420
- expect(subject.safe_version).to eq('1.2~pre_alpha._2')
419
+ expect(subject.safe_version).to eq("1.2~pre_alpha._2")
421
420
  end
422
421
 
423
422
  expect(output).to include("The `version' component of RPM package names can only include")
424
423
  end
425
424
  end
426
425
 
427
- context 'when the build is for nexus' do
426
+ context "when the build is for nexus" do
428
427
  before do
429
- project.build_version('1.2-3')
430
- stub_ohai(platform: 'nexus', version: '5')
428
+ project.build_version("1.2-3")
429
+ stub_ohai(platform: "nexus", version: "5")
431
430
  end
432
431
 
433
- it 'returns the value while logging a message' do
432
+ it "returns the value while logging a message" do
434
433
  output = capture_logging do
435
- expect(subject.safe_version).to eq('1.2_3')
434
+ expect(subject.safe_version).to eq("1.2_3")
436
435
  end
437
436
 
438
437
  expect(output).to include("rpmbuild on Wind River Linux does not support this")
439
438
  end
440
439
  end
441
440
 
442
- context 'when the build is for ios_xr' do
441
+ context "when the build is for ios_xr" do
443
442
  before do
444
- project.build_version('1.2-3')
445
- stub_ohai(platform: 'ios_xr', version: '6.0.0.14I')
443
+ project.build_version("1.2-3")
444
+ stub_ohai(platform: "ios_xr", version: "6.0.0.14I")
446
445
  end
447
446
 
448
- it 'returns the value while logging a message' do
447
+ it "returns the value while logging a message" do
449
448
  output = capture_logging do
450
- expect(subject.safe_version).to eq('1.2_3')
449
+ expect(subject.safe_version).to eq("1.2_3")
451
450
  end
452
451
 
453
452
  expect(output).to include("rpmbuild on Wind River Linux does not support this")
@@ -457,39 +456,39 @@ module Omnibus
457
456
 
458
457
  describe '#safe_architecture' do
459
458
  before do
460
- stub_ohai(platform: 'redhat', version: '6.5') do |data|
461
- data['kernel']['machine'] = 'i386'
459
+ stub_ohai(platform: "redhat", version: "6.5") do |data|
460
+ data["kernel"]["machine"] = "i386"
462
461
  end
463
462
  end
464
463
 
465
- it 'returns the value from Ohai' do
466
- expect(subject.safe_architecture).to eq('i386')
464
+ it "returns the value from Ohai" do
465
+ expect(subject.safe_architecture).to eq("i386")
467
466
  end
468
467
 
469
- context 'when i686' do
468
+ context "when i686" do
470
469
  before do
471
- stub_ohai(platform: 'redhat', version: '6.5') do |data|
472
- data['kernel']['machine'] = 'i686'
470
+ stub_ohai(platform: "redhat", version: "6.5") do |data|
471
+ data["kernel"]["machine"] = "i686"
473
472
  end
474
473
  end
475
474
 
476
- it 'returns i386' do
477
- expect(subject.safe_architecture).to eq('i386')
475
+ it "returns i386" do
476
+ expect(subject.safe_architecture).to eq("i386")
478
477
  end
479
478
  end
480
479
 
481
- context 'on Pidora' do
480
+ context "on Pidora" do
482
481
  before do
483
482
  # There's no Pidora in Fauxhai :(
484
- stub_ohai(platform: 'fedora', version: '20') do |data|
485
- data['platform'] = 'pidora'
486
- data['platform_version'] = '20'
487
- data['kernel']['machine'] = 'armv6l'
483
+ stub_ohai(platform: "fedora", version: "20") do |data|
484
+ data["platform"] = "pidora"
485
+ data["platform_version"] = "20"
486
+ data["kernel"]["machine"] = "armv6l"
488
487
  end
489
488
  end
490
489
 
491
- it 'returns armv6hl' do
492
- expect(subject.safe_architecture).to eq('armv6hl')
490
+ it "returns armv6hl" do
491
+ expect(subject.safe_architecture).to eq("armv6hl")
493
492
  end
494
493
  end
495
494
  end