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,24 +1,24 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Packager::MSI do
5
5
  let(:project) do
6
6
  Project.new.tap do |project|
7
- project.name('project')
8
- project.homepage('https://example.com')
7
+ project.name("project")
8
+ project.homepage("https://example.com")
9
9
  project.install_dir(install_dir)
10
- project.build_version('1.2.3')
11
- project.build_iteration('2')
12
- project.maintainer('Chef Software <maintainers@chef.io>')
10
+ project.build_version("1.2.3")
11
+ project.build_iteration("2")
12
+ project.maintainer("Chef Software <maintainers@chef.io>")
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(:install_dir) { 'C:/project' }
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(:install_dir) { "C:/project" }
22
22
 
23
23
  before do
24
24
  Config.project_root(project_root)
@@ -28,63 +28,63 @@ module Omnibus
28
28
  create_directory(staging_dir)
29
29
  end
30
30
 
31
- describe 'DSL' do
32
- it 'exposes :parameters' do
31
+ describe "DSL" do
32
+ it "exposes :parameters" do
33
33
  expect(subject).to have_exposed_method(:parameters)
34
34
  end
35
35
 
36
- it 'exposes :signing_identity' do
36
+ it "exposes :signing_identity" do
37
37
  expect(subject).to have_exposed_method(:signing_identity)
38
38
  end
39
39
  end
40
40
 
41
41
  describe '#id' do
42
- it 'is :pkg' do
42
+ it "is :pkg" do
43
43
  expect(subject.id).to eq(:msi)
44
44
  end
45
45
  end
46
46
 
47
47
  describe '#upgrade_code' do
48
- it 'is a DSL method' do
48
+ it "is a DSL method" do
49
49
  expect(subject).to have_exposed_method(:upgrade_code)
50
50
  end
51
51
 
52
- it 'is required' do
52
+ it "is required" do
53
53
  expect {
54
54
  subject.upgrade_code
55
55
  }.to raise_error(MissingRequiredAttribute)
56
56
  end
57
57
 
58
- it 'requires the value to be a String' do
58
+ it "requires the value to be a String" do
59
59
  expect {
60
60
  subject.parameters(Object.new)
61
61
  }.to raise_error(InvalidValue)
62
62
  end
63
63
 
64
- it 'returns the given value' do
65
- code = 'ABCD-1234'
64
+ it "returns the given value" do
65
+ code = "ABCD-1234"
66
66
  subject.upgrade_code(code)
67
67
  expect(subject.upgrade_code).to be(code)
68
68
  end
69
69
  end
70
70
 
71
71
  describe '#parameters' do
72
- it 'is a DSL method' do
72
+ it "is a DSL method" do
73
73
  expect(subject).to have_exposed_method(:parameters)
74
74
  end
75
75
 
76
- it 'is defaults to an empty hash' do
76
+ it "is defaults to an empty hash" do
77
77
  expect(subject.parameters).to be_a(Hash)
78
78
  end
79
79
 
80
- it 'requires the value to be a Hash' do
80
+ it "requires the value to be a Hash" do
81
81
  expect {
82
82
  subject.parameters(Object.new)
83
83
  }.to raise_error(InvalidValue)
84
84
  end
85
85
 
86
- it 'returns the given value' do
87
- params = { 'Key' => 'value' }
86
+ it "returns the given value" do
87
+ params = { "Key" => "value" }
88
88
  subject.parameters(params)
89
89
  expect(subject.parameters).to be(params)
90
90
  end
@@ -95,29 +95,29 @@ module Omnibus
95
95
  allow(Config).to receive(:windows_arch).and_return(:foo_arch)
96
96
  end
97
97
 
98
- it 'includes the name, version, and build iteration' do
99
- expect(subject.package_name).to eq('project-1.2.3-2-foo_arch.msi')
98
+ it "includes the name, version, and build iteration" do
99
+ expect(subject.package_name).to eq("project-1.2.3-2-foo_arch.msi")
100
100
  end
101
101
 
102
- it 'returns the bundle name when building a bundle' do
102
+ it "returns the bundle name when building a bundle" do
103
103
  subject.bundle_msi(true)
104
- expect(subject.package_name).to eq('project-1.2.3-2-foo_arch.exe')
104
+ expect(subject.package_name).to eq("project-1.2.3-2-foo_arch.exe")
105
105
  end
106
106
  end
107
107
 
108
108
  describe '#resources_dir' do
109
- it 'is nested inside the staging_dir' do
109
+ it "is nested inside the staging_dir" do
110
110
  expect(subject.resources_dir).to eq("#{staging_dir}/Resources")
111
111
  end
112
112
  end
113
113
 
114
114
  describe '#write_localization_file' do
115
- it 'generates the file' do
115
+ it "generates the file" do
116
116
  subject.write_localization_file
117
117
  expect("#{staging_dir}/localization-en-us.wxl").to be_a_file
118
118
  end
119
119
 
120
- it 'has the correct content' do
120
+ it "has the correct content" do
121
121
  subject.write_localization_file
122
122
  contents = File.read("#{staging_dir}/localization-en-us.wxl")
123
123
 
@@ -129,15 +129,15 @@ module Omnibus
129
129
 
130
130
  describe '#write_parameters_file' do
131
131
  before do
132
- subject.upgrade_code('ABCD-1234')
132
+ subject.upgrade_code("ABCD-1234")
133
133
  end
134
134
 
135
- it 'generates the file' do
135
+ it "generates the file" do
136
136
  subject.write_parameters_file
137
137
  expect("#{staging_dir}/parameters.wxi").to be_a_file
138
138
  end
139
139
 
140
- it 'has the correct content' do
140
+ it "has the correct content" do
141
141
  subject.write_parameters_file
142
142
  contents = File.read("#{staging_dir}/parameters.wxi")
143
143
 
@@ -148,18 +148,18 @@ module Omnibus
148
148
  end
149
149
 
150
150
  describe '#write_source_file' do
151
- it 'generates the file' do
151
+ it "generates the file" do
152
152
  subject.write_source_file
153
153
  expect("#{staging_dir}/source.wxs").to be_a_file
154
154
  end
155
155
 
156
- it 'has the correct content' do
157
- project.install_dir('C:/foo/bar/blip')
156
+ it "has the correct content" do
157
+ project.install_dir("C:/foo/bar/blip")
158
158
  subject.write_source_file
159
159
  contents = File.read("#{staging_dir}/source.wxs")
160
160
 
161
161
  expect(contents).to include('<?include "parameters.wxi" ?>')
162
- expect(contents).to include <<-EOH.gsub(/^ {6}/, '')
162
+ expect(contents).to include <<-EOH.gsub(/^ {6}/, "")
163
163
  <Directory Id="TARGETDIR" Name="SourceDir">
164
164
  <Directory Id="WINDOWSVOLUME">
165
165
  <Directory Id="FOOLOCATION" Name="foo">
@@ -173,7 +173,7 @@ module Omnibus
173
173
  EOH
174
174
  end
175
175
 
176
- it 'has the correct wix_install_dir when the path is short' do
176
+ it "has the correct wix_install_dir when the path is short" do
177
177
  subject.write_source_file
178
178
  contents = File.read("#{staging_dir}/source.wxs")
179
179
 
@@ -181,20 +181,20 @@ module Omnibus
181
181
  expect(contents).to include('<Property Id="WIXUI_INSTALLDIR" Value="WINDOWSVOLUME" />')
182
182
  end
183
183
 
184
- context 'when fastmsi is not specified' do
185
- it 'does not include a reference to the fast msi custom action' do
184
+ context "when fastmsi is not specified" do
185
+ it "does not include a reference to the fast msi custom action" do
186
186
  subject.write_source_file
187
187
  contents = File.read("#{staging_dir}/source.wxs")
188
188
  expect(contents).not_to include("<Binary Id=\"CustomActionFastMsiDLL\"")
189
189
  end
190
190
  end
191
191
 
192
- context 'when fastmsi is specified' do
192
+ context "when fastmsi is specified" do
193
193
  before do
194
194
  subject.fast_msi(true)
195
195
  end
196
196
 
197
- it 'includes a reference to the fast msi custom action' do
197
+ it "includes a reference to the fast msi custom action" do
198
198
  subject.write_source_file
199
199
  contents = File.read("#{staging_dir}/source.wxs")
200
200
  expect(contents).to include("<Binary Id=\"CustomActionFastMsiDLL\"")
@@ -205,16 +205,16 @@ module Omnibus
205
205
  describe '#write_bundle_file' do
206
206
  before do
207
207
  subject.bundle_msi(true)
208
- subject.upgrade_code('ABCD-1234')
208
+ subject.upgrade_code("ABCD-1234")
209
209
  allow(Config).to receive(:windows_arch).and_return(:x86)
210
210
  end
211
211
 
212
- it 'generates the file' do
212
+ it "generates the file" do
213
213
  subject.write_bundle_file
214
214
  expect("#{staging_dir}/bundle.wxs").to be_a_file
215
215
  end
216
216
 
217
- it 'has the correct content' do
217
+ it "has the correct content" do
218
218
  outpath = "#{tmp_path}/package/dir/project-1.2.3-2-x86.msi"
219
219
  outpath = outpath.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if windows?
220
220
  subject.write_bundle_file
@@ -223,238 +223,238 @@ module Omnibus
223
223
  end
224
224
  end
225
225
 
226
- describe '#msi_version' do
227
- context 'when the project build_version semver' do
228
- it 'returns the right value' do
229
- expect(subject.msi_version).to eq('1.2.3.2')
226
+ describe '#windows_package_version' do
227
+ context "when the project build_version semver" do
228
+ it "returns the right value" do
229
+ expect(subject.windows_package_version).to eq("1.2.3.2")
230
230
  end
231
231
  end
232
232
 
233
- context 'when the project build_version is git' do
234
- before { project.build_version('1.2.3-alpha.1+20140501194641.git.94.561b564') }
233
+ context "when the project build_version is git" do
234
+ before { project.build_version("1.2.3-alpha.1+20140501194641.git.94.561b564") }
235
235
 
236
- it 'returns the right value' do
237
- expect(subject.msi_version).to eq('1.2.3.2')
236
+ it "returns the right value" do
237
+ expect(subject.windows_package_version).to eq("1.2.3.2")
238
238
  end
239
239
  end
240
240
  end
241
241
 
242
242
  describe '#msi_display_version' do
243
243
  context 'when the project build_version is "safe"' do
244
- it 'returns the right value' do
245
- expect(subject.msi_display_version).to eq('1.2.3')
244
+ it "returns the right value" do
245
+ expect(subject.msi_display_version).to eq("1.2.3")
246
246
  end
247
247
  end
248
248
 
249
- context 'when the project build_version is a git tag' do
250
- before { project.build_version('1.2.3-alpha.1+20140501194641.git.94.561b564') }
249
+ context "when the project build_version is a git tag" do
250
+ before { project.build_version("1.2.3-alpha.1+20140501194641.git.94.561b564") }
251
251
 
252
- it 'returns the right value' do
253
- expect(subject.msi_display_version).to eq('1.2.3')
252
+ it "returns the right value" do
253
+ expect(subject.msi_display_version).to eq("1.2.3")
254
254
  end
255
255
  end
256
256
  end
257
257
 
258
258
  describe '#wix_candle_extensions' do
259
- it 'defaults to an empty Array' do
259
+ it "defaults to an empty Array" do
260
260
  expect(subject.wix_candle_extensions).to be_an(Array)
261
261
  expect(subject.wix_candle_extensions).to be_empty
262
262
  end
263
263
  end
264
264
 
265
265
  describe '#wix_light_extensions' do
266
- it 'defaults to an empty Array' do
266
+ it "defaults to an empty Array" do
267
267
  expect(subject.wix_light_extensions).to be_an(Array)
268
268
  expect(subject.wix_light_extensions).to be_empty
269
269
  end
270
270
  end
271
271
 
272
272
  describe '#wix_candle_extension' do
273
- it 'is a DSL method' do
273
+ it "is a DSL method" do
274
274
  expect(subject).to have_exposed_method(:wix_candle_extension)
275
275
  end
276
276
 
277
- it 'requires the value to be an String' do
277
+ it "requires the value to be an String" do
278
278
  expect {
279
279
  subject.wix_candle_extension(Object.new)
280
280
  }.to raise_error(InvalidValue)
281
281
  end
282
282
 
283
- it 'returns the given value' do
284
- extensions = ['a']
283
+ it "returns the given value" do
284
+ extensions = ["a"]
285
285
  subject.wix_candle_extension(extensions[0])
286
286
  expect(subject.wix_candle_extensions).to match_array(extensions)
287
287
  end
288
288
  end
289
289
 
290
290
  describe '#wix_light_extension' do
291
- it 'is a DSL method' do
291
+ it "is a DSL method" do
292
292
  expect(subject).to have_exposed_method(:wix_light_extension)
293
293
  end
294
294
 
295
- it 'requires the value to be an String' do
295
+ it "requires the value to be an String" do
296
296
  expect {
297
297
  subject.wix_light_extension(Object.new)
298
298
  }.to raise_error(InvalidValue)
299
299
  end
300
300
 
301
- it 'returns the given value' do
302
- extensions = ['a']
301
+ it "returns the given value" do
302
+ extensions = ["a"]
303
303
  subject.wix_light_extension(extensions[0])
304
304
  expect(subject.wix_light_extensions).to match_array(extensions)
305
305
  end
306
306
  end
307
307
 
308
308
  describe '#wix_extension_switches' do
309
- it 'returns an empty string for an empty array' do
310
- expect(subject.wix_extension_switches([])).to eq('')
309
+ it "returns an empty string for an empty array" do
310
+ expect(subject.wix_extension_switches([])).to eq("")
311
311
  end
312
312
 
313
- it 'returns the correct value for one extension' do
314
- expect(subject.wix_extension_switches(['a'])).to eq("-ext 'a'")
313
+ it "returns the correct value for one extension" do
314
+ expect(subject.wix_extension_switches(["a"])).to eq("-ext 'a'")
315
315
  end
316
316
 
317
- it 'returns the correct value for many extensions' do
318
- expect(subject.wix_extension_switches(['a', 'b'])).to eq("-ext 'a' -ext 'b'")
317
+ it "returns the correct value for many extensions" do
318
+ expect(subject.wix_extension_switches(%w{a b})).to eq("-ext 'a' -ext 'b'")
319
319
  end
320
320
  end
321
321
 
322
322
  describe '#bundle_msi' do
323
- it 'is a DSL method' do
323
+ it "is a DSL method" do
324
324
  expect(subject).to have_exposed_method(:bundle_msi)
325
325
  end
326
326
 
327
- it 'requires the value to be a TrueClass or a FalseClass' do
327
+ it "requires the value to be a TrueClass or a FalseClass" do
328
328
  expect {
329
329
  subject.bundle_msi(Object.new)
330
330
  }.to raise_error(InvalidValue)
331
331
  end
332
332
 
333
- it 'returns the given value' do
333
+ it "returns the given value" do
334
334
  subject.bundle_msi(true)
335
335
  expect(subject.bundle_msi).to be_truthy
336
336
  end
337
337
  end
338
338
 
339
339
  describe '#fast_msi' do
340
- it 'is a DSL method' do
340
+ it "is a DSL method" do
341
341
  expect(subject).to have_exposed_method(:fast_msi)
342
342
  end
343
343
 
344
- it 'requires the value to be a TrueClass or a FalseClass' do
344
+ it "requires the value to be a TrueClass or a FalseClass" do
345
345
  expect {
346
346
  subject.fast_msi(Object.new)
347
347
  }.to raise_error(InvalidValue)
348
348
  end
349
349
 
350
- it 'returns the given value' do
350
+ it "returns the given value" do
351
351
  subject.fast_msi(true)
352
352
  expect(subject.fast_msi).to be_truthy
353
353
  end
354
354
  end
355
355
 
356
356
  describe '#zip_command' do
357
- it 'returns a String' do
357
+ it "returns a String" do
358
358
  expect(subject.zip_command).to be_a(String)
359
359
  end
360
360
 
361
- it 'sets zip file location to the staging directory' do
361
+ it "sets zip file location to the staging directory" do
362
362
  expect(subject.zip_command).to include("#{subject.windows_safe_path(staging_dir)}\\#{project.name}.zip")
363
363
  end
364
364
  end
365
365
 
366
366
  describe '#candle_command' do
367
- it 'returns a String' do
367
+ it "returns a String" do
368
368
  expect(subject.candle_command).to be_a(String)
369
369
  end
370
370
 
371
- context 'default behavior' do
372
- it 'defines the ProjectSourceDir property' do
371
+ context "default behavior" do
372
+ it "defines the ProjectSourceDir property" do
373
373
  expect(subject.candle_command).to include("-dProjectSourceDir=")
374
374
  end
375
375
 
376
- it 'outputs a source.wxs file to the staging directory' do
376
+ it "outputs a source.wxs file to the staging directory" do
377
377
  expect(subject.candle_command).to include("#{subject.windows_safe_path(staging_dir, 'source.wxs')}")
378
378
  end
379
379
  end
380
380
 
381
- context 'when is_bundle is true' do
382
- it 'uses the WIX Bootstrapper/Burn extension' do
381
+ context "when is_bundle is true" do
382
+ it "uses the WIX Bootstrapper/Burn extension" do
383
383
  expect(subject.candle_command(is_bundle: true)).to include("-ext WixBalExtension")
384
384
  end
385
385
 
386
- it 'defines the OmnibusCacheDir property' do
386
+ it "defines the OmnibusCacheDir property" do
387
387
  expect(subject.candle_command(is_bundle: true)).to include("-dOmnibusCacheDir=")
388
388
  end
389
389
 
390
- it 'outputs a bundle.wxs file to the staging directory' do
390
+ it "outputs a bundle.wxs file to the staging directory" do
391
391
  expect(subject.candle_command(is_bundle: true)).to include("#{subject.windows_safe_path(staging_dir, 'bundle.wxs')}")
392
392
  end
393
393
  end
394
394
  end
395
395
 
396
396
  describe '#heat_command' do
397
- it 'returns a String' do
397
+ it "returns a String" do
398
398
  expect(subject.heat_command).to be_a(String)
399
399
  end
400
400
 
401
- context 'when fast_msi is not set' do
402
- it 'operates in directory mode' do
401
+ context "when fast_msi is not set" do
402
+ it "operates in directory mode" do
403
403
  expect(subject.heat_command).to include("dir \"#{subject.windows_safe_path(project.install_dir)}\"")
404
404
  end
405
405
 
406
- it 'sets destination to the project location' do
406
+ it "sets destination to the project location" do
407
407
  expect(subject.heat_command).to include("-dr PROJECTLOCATION")
408
408
  end
409
409
  end
410
410
 
411
- context 'when fast_msi is set' do
411
+ context "when fast_msi is set" do
412
412
  before do
413
413
  subject.fast_msi(true)
414
414
  end
415
415
 
416
- it 'operates in file mode' do
416
+ it "operates in file mode" do
417
417
  expect(subject.heat_command).to include("file \"#{project.name}.zip\"")
418
418
  end
419
419
 
420
- it 'sets destination to the install location' do
420
+ it "sets destination to the install location" do
421
421
  expect(subject.heat_command).to include("-dr INSTALLLOCATION")
422
422
  end
423
423
  end
424
424
  end
425
425
 
426
426
  describe '#light_command' do
427
- it 'returns a String' do
427
+ it "returns a String" do
428
428
  expect(subject.light_command("foo")).to be_a(String)
429
429
  end
430
430
 
431
- context 'default behavior' do
432
- let (:command) { subject.light_command("foo") }
431
+ context "default behavior" do
432
+ let (:command) { subject.light_command("foo") }
433
433
 
434
- it 'uses the WIX UI extension' do
434
+ it "uses the WIX UI extension" do
435
435
  expect(command).to include("-ext WixUIExtension")
436
436
  end
437
437
 
438
- it 'includes the project-files and source wixobj files' do
438
+ it "includes the project-files and source wixobj files" do
439
439
  expect(command).to include("project-files.wixobj source.wixobj")
440
440
  end
441
441
  end
442
442
 
443
- context 'when is_bundle is true' do
444
- let (:command) { subject.light_command("foo", is_bundle: true) }
443
+ context "when is_bundle is true" do
444
+ let (:command) { subject.light_command("foo", is_bundle: true) }
445
445
 
446
- it 'uses the WIX Bootstrapper/Burn extension' do
446
+ it "uses the WIX Bootstrapper/Burn extension" do
447
447
  expect(command).to include("-ext WixBalExtension")
448
448
  end
449
449
 
450
- it 'includes the bundle wixobj file' do
450
+ it "includes the bundle wixobj file" do
451
451
  expect(command).to include("bundle.wixobj")
452
452
  end
453
453
  end
454
454
  end
455
455
 
456
456
  describe '#gem_path' do
457
- let(:install_dir) { File.join(tmp_path, 'install_dir') }
457
+ let(:install_dir) { File.join(tmp_path, "install_dir") }
458
458
 
459
459
  before do
460
460
  create_directory(install_dir)
@@ -464,89 +464,83 @@ module Omnibus
464
464
  remove_directory(install_dir)
465
465
  end
466
466
 
467
- it 'is a DSL method' do
467
+ it "is a DSL method" do
468
468
  expect(subject).to have_exposed_method(:gem_path)
469
469
  end
470
470
 
471
- it 'requires the value to be a String' do
471
+ it "requires the value to be a String" do
472
472
  expect {
473
473
  subject.gem_path(Object.new)
474
474
  }.to raise_error(InvalidValue)
475
475
  end
476
476
 
477
- it 'globs for gems under the install directory' do
478
- expected_gem_path = 'something/gems/athing-1.0.0'
477
+ it "globs for gems under the install directory" do
478
+ expected_gem_path = "something/gems/athing-1.0.0"
479
479
  create_directory(File.join(install_dir, expected_gem_path))
480
- expect(subject.gem_path('athing-*')).to eq(expected_gem_path)
480
+ expect(subject.gem_path("athing-*")).to eq(expected_gem_path)
481
481
  end
482
482
 
483
- it 'returns the gem directory when no argument is given' do
484
- expected_gem_path = 'foo/bar123/gems'
483
+ it "returns the gem directory when no argument is given" do
484
+ expected_gem_path = "foo/bar123/gems"
485
485
  create_directory(File.join(install_dir, expected_gem_path))
486
486
  expect(subject.gem_path).to eq(expected_gem_path)
487
487
  end
488
488
  end
489
489
 
490
- context 'when signing parameters are provided' do
491
- let(:msi) { 'somemsi.msi' }
490
+ context "when signing parameters are provided" do
491
+ let(:msi) { "somemsi.msi" }
492
492
 
493
- context 'when invalid parameters' do
494
- it 'should raise an InvalidValue error when the certificate name is not a String' do
495
- expect{subject.signing_identity(Object.new)}.to raise_error(InvalidValue)
493
+ context "when invalid parameters" do
494
+ it "should raise an InvalidValue error when the certificate name is not a String" do
495
+ expect { subject.signing_identity(Object.new) }.to raise_error(InvalidValue)
496
496
  end
497
497
 
498
- it 'should raise an InvalidValue error when params is not a Hash' do
499
- expect{subject.signing_identity("foo", Object.new)}.to raise_error(InvalidValue)
498
+ it "should raise an InvalidValue error when params is not a Hash" do
499
+ expect { subject.signing_identity("foo", Object.new) }.to raise_error(InvalidValue)
500
500
  end
501
501
 
502
- it 'should raise an InvalidValue error when params contains an invalid key' do
503
- expect{subject.signing_identity("foo", bar: 'baz')}.to raise_error(InvalidValue)
502
+ it "should raise an InvalidValue error when params contains an invalid key" do
503
+ expect { subject.signing_identity("foo", bar: "baz") }.to raise_error(InvalidValue)
504
504
  end
505
505
  end
506
506
 
507
- context 'when valid parameters' do
507
+ context "when valid parameters" do
508
508
  before do
509
509
  allow(subject).to receive(:shellout!)
510
510
  end
511
511
 
512
- it 'should sign the file and then add the timestamp' do
513
- subject.signing_identity('foo')
514
- expect(subject).to receive(:add_timestamp)
515
- subject.sign_package(msi)
516
- end
517
-
518
512
  describe '#timestamp_servers' do
519
513
  it "defaults to using ['http://timestamp.digicert.com','http://timestamp.verisign.com/scripts/timestamp.dll']" do
520
- subject.signing_identity('foo')
521
- expect(subject).to receive(:try_timestamp).with(msi, 'http://timestamp.digicert.com').and_return(false)
522
- expect(subject).to receive(:try_timestamp).with(msi, 'http://timestamp.verisign.com/scripts/timestamp.dll').and_return(true)
514
+ subject.signing_identity("foo")
515
+ expect(subject).to receive(:try_sign).with(msi, "http://timestamp.digicert.com").and_return(false)
516
+ expect(subject).to receive(:try_sign).with(msi, "http://timestamp.verisign.com/scripts/timestamp.dll").and_return(true)
523
517
  subject.sign_package(msi)
524
518
  end
525
519
 
526
520
  it 'uses the timestamp server if provided through the #timestamp_server dsl' do
527
- subject.signing_identity('foo', timestamp_servers: 'http://fooserver')
528
- expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(true)
521
+ subject.signing_identity("foo", timestamp_servers: "http://fooserver")
522
+ expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(true)
529
523
  subject.sign_package(msi)
530
524
  end
531
525
 
532
526
  it 'tries all timestamp server if provided through the #timestamp_server dsl' do
533
- subject.signing_identity('foo', timestamp_servers: ['http://fooserver', 'http://barserver'])
534
- expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(false)
535
- expect(subject).to receive(:try_timestamp).with(msi, 'http://barserver').and_return(true)
527
+ subject.signing_identity("foo", timestamp_servers: ["http://fooserver", "http://barserver"])
528
+ expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(false)
529
+ expect(subject).to receive(:try_sign).with(msi, "http://barserver").and_return(true)
536
530
  subject.sign_package(msi)
537
531
  end
538
532
 
539
533
  it 'tries all timestamp server if provided through the #timestamp_servers dsl and stops at the first available' do
540
- subject.signing_identity('foo', timestamp_servers: ['http://fooserver', 'http://barserver'])
541
- expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(true)
542
- expect(subject).not_to receive(:try_timestamp).with(msi, 'http://barserver')
534
+ subject.signing_identity("foo", timestamp_servers: ["http://fooserver", "http://barserver"])
535
+ expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(true)
536
+ expect(subject).not_to receive(:try_sign).with(msi, "http://barserver")
543
537
  subject.sign_package(msi)
544
538
  end
545
539
 
546
- it 'raises an exception if there are no available timestamp servers' do
547
- subject.signing_identity('foo', timestamp_servers: 'http://fooserver')
548
- expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(false)
549
- expect {subject.sign_package(msi)}.to raise_error(FailedToTimestampMSI)
540
+ it "raises an exception if there are no available timestamp servers" do
541
+ subject.signing_identity("foo", timestamp_servers: "http://fooserver")
542
+ expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(false)
543
+ expect { subject.sign_package(msi) }.to raise_error(FailedToSignWindowsPackage)
550
544
  end
551
545
  end
552
546
  end