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
@@ -14,12 +14,11 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'pathname'
17
+ require "pathname"
18
+ require "omnibus/packagers/windows_base"
18
19
 
19
20
  module Omnibus
20
- class Packager::MSI < Packager::Base
21
- DEFAULT_TIMESTAMP_SERVERS = ['http://timestamp.digicert.com',
22
- 'http://timestamp.verisign.com/scripts/timestamp.dll']
21
+ class Packager::MSI < Packager::WindowsBase
23
22
  id :msi
24
23
 
25
24
  setup do
@@ -51,7 +50,7 @@ module Omnibus
51
50
  # Source for the custom action is at https://github.com/chef/fastmsi-custom-action
52
51
  # The dll will be built separately as part of the custom action build process
53
52
  # and made available as a binary for the Omnibus projects to use.
54
- copy_file(resource_path('CustomActionFastMsi.CA.dll'), staging_dir) if fast_msi
53
+ copy_file(resource_path("CustomActionFastMsi.CA.dll"), staging_dir) if fast_msi
55
54
  end
56
55
 
57
56
  build do
@@ -108,10 +107,10 @@ module Omnibus
108
107
  #
109
108
  def upgrade_code(val = NULL)
110
109
  if null?(val)
111
- @upgrade_code || raise(MissingRequiredAttribute.new(self, :upgrade_code, '2CD7259C-776D-4DDB-A4C8-6E544E580AA1'))
110
+ @upgrade_code || raise(MissingRequiredAttribute.new(self, :upgrade_code, "2CD7259C-776D-4DDB-A4C8-6E544E580AA1"))
112
111
  else
113
112
  unless val.is_a?(String)
114
- raise InvalidValue.new(:upgrade_code, 'be a String')
113
+ raise InvalidValue.new(:upgrade_code, "be a String")
115
114
  end
116
115
 
117
116
  @upgrade_code = val
@@ -138,7 +137,7 @@ module Omnibus
138
137
  @parameters || {}
139
138
  else
140
139
  unless val.is_a?(Hash)
141
- raise InvalidValue.new(:parameters, 'be a Hash')
140
+ raise InvalidValue.new(:parameters, "be a Hash")
142
141
  end
143
142
 
144
143
  @parameters = val
@@ -160,7 +159,7 @@ module Omnibus
160
159
  #
161
160
  def wix_light_extension(extension)
162
161
  unless extension.is_a?(String)
163
- raise InvalidValue.new(:wix_light_extension, 'be an String')
162
+ raise InvalidValue.new(:wix_light_extension, "be an String")
164
163
  end
165
164
 
166
165
  wix_light_extensions << extension
@@ -181,7 +180,7 @@ module Omnibus
181
180
  #
182
181
  def wix_candle_extension(extension)
183
182
  unless extension.is_a?(String)
184
- raise InvalidValue.new(:wix_candle_extension, 'be an String')
183
+ raise InvalidValue.new(:wix_candle_extension, "be an String")
185
184
  end
186
185
 
187
186
  wix_candle_extensions << extension
@@ -200,8 +199,8 @@ module Omnibus
200
199
  # @return [TrueClass, FalseClass]
201
200
  # whether we're a bundle or not
202
201
  def bundle_msi(val = false)
203
- unless (val.is_a?(TrueClass) || val.is_a?(FalseClass))
204
- raise InvalidValue.new(:bundle_msi, 'be TrueClass or FalseClass')
202
+ unless val.is_a?(TrueClass) || val.is_a?(FalseClass)
203
+ raise InvalidValue.new(:bundle_msi, "be TrueClass or FalseClass")
205
204
  end
206
205
  @bundle_msi ||= val
207
206
  end
@@ -219,79 +218,13 @@ module Omnibus
219
218
  # @return [TrueClass, FalseClass]
220
219
  # whether we're building a zip-based MSI or not
221
220
  def fast_msi(val = false)
222
- unless (val.is_a?(TrueClass) || val.is_a?(FalseClass))
223
- raise InvalidValue.new(:fast_msi, 'be TrueClass or FalseClass')
221
+ unless val.is_a?(TrueClass) || val.is_a?(FalseClass)
222
+ raise InvalidValue.new(:fast_msi, "be TrueClass or FalseClass")
224
223
  end
225
224
  @fast_msi ||= val
226
225
  end
227
226
  expose :fast_msi
228
227
 
229
- #
230
- # Set the signing certificate name
231
- #
232
- # @example
233
- # signing_identity 'FooCert'
234
- # signing_identity 'FooCert', store: 'BarStore'
235
- #
236
- # @param [String] thumbprint
237
- # the thumbprint of the certificate in the certificate store
238
- # @param [Hash<Symbol, String>] params
239
- # an optional hash that defines the parameters for the singing identity
240
- #
241
- # @option params [String] :store (My)
242
- # The name of the certificate store which contains the certificate
243
- # @option params [Array<String>, String] :timestamp_servers
244
- # A trusted timestamp server or a list of truested timestamp servers to
245
- # be tried. They are tried in the order provided.
246
- # @option params [TrueClass, FalseClass] :machine_store (false)
247
- # If set to true, the local machine store will be searched for a valid
248
- # certificate. Otherwise, the current user store is used
249
- #
250
- # Setting nothing will default to trying ['http://timestamp.digicert.com',
251
- # 'http://timestamp.verisign.com/scripts/timestamp.dll']
252
- #
253
- # @return [Hash{:thumbprint => String, :store => String, :timestamp_servers => Array[String]}]
254
- #
255
- def signing_identity(thumbprint= NULL, params = NULL)
256
- unless null?(thumbprint)
257
- @signing_identity = {}
258
- unless thumbprint.is_a?(String)
259
- raise InvalidValue.new(:signing_identity, 'be a String')
260
- end
261
-
262
- @signing_identity[:thumbprint] = thumbprint
263
-
264
- if !null?(params)
265
- unless params.is_a?(Hash)
266
- raise InvalidValue.new(:params, 'be a Hash')
267
- end
268
-
269
- valid_keys = [:store, :timestamp_servers, :machine_store]
270
- invalid_keys = params.keys - valid_keys
271
- unless invalid_keys.empty?
272
- raise InvalidValue.new(:params, "contain keys from [#{valid_keys.join(', ')}]. "\
273
- "Found invalid keys [#{invalid_keys.join(', ')}]")
274
- end
275
-
276
- if !params[:machine_store].nil? && !(
277
- params[:machine_store].is_a?(TrueClass) ||
278
- params[:machine_store].is_a?(FalseClass))
279
- raise InvalidValue.new(:params, 'contain key :machine_store of type TrueClass or FalseClass')
280
- end
281
- else
282
- params = {}
283
- end
284
-
285
- @signing_identity[:store] = params[:store] || 'My'
286
- servers = params[:timestamp_servers] || DEFAULT_TIMESTAMP_SERVERS
287
- @signing_identity[:timestamp_servers] = [servers].flatten
288
- @signing_identity[:machine_store] = params[:machine_store] || false
289
- end
290
-
291
- @signing_identity
292
- end
293
- expose :signing_identity
294
-
295
228
  #
296
229
  # Discovers a path to a gem/file included in a gem under the install directory.
297
230
  #
@@ -307,15 +240,15 @@ module Omnibus
307
240
  #
308
241
  def gem_path(glob = NULL)
309
242
  unless glob.is_a?(String) || null?(glob)
310
- raise InvalidValue.new(:glob, 'be an String')
243
+ raise InvalidValue.new(:glob, "be an String")
311
244
  end
312
245
 
313
246
  install_path = Pathname.new(project.install_dir)
314
247
 
315
248
  # Find path in which the Chef gem is installed
316
- search_pattern = install_path.join('**', 'gems')
249
+ search_pattern = install_path.join("**", "gems")
317
250
  search_pattern = search_pattern.join(glob) unless null?(glob)
318
- file_paths = Pathname.glob(search_pattern).find
251
+ file_paths = Pathname.glob(search_pattern).find
319
252
 
320
253
  raise "Could not find `#{search_pattern}'!" if file_paths.none?
321
254
  raise "Multiple possible matches of `#{search_pattern}'! : #{file_paths}" if file_paths.count > 1
@@ -355,7 +288,7 @@ module Omnibus
355
288
  # @return [void]
356
289
  #
357
290
  def write_localization_file
358
- render_template(resource_path('localization-en-us.wxl.erb'),
291
+ render_template(resource_path("localization-en-us.wxl.erb"),
359
292
  destination: "#{staging_dir}/localization-en-us.wxl",
360
293
  variables: {
361
294
  name: project.package_name,
@@ -371,7 +304,7 @@ module Omnibus
371
304
  # @return [void]
372
305
  #
373
306
  def write_parameters_file
374
- render_template(resource_path('parameters.wxi.erb'),
307
+ render_template(resource_path("parameters.wxi.erb"),
375
308
  destination: "#{staging_dir}/parameters.wxi",
376
309
  variables: {
377
310
  name: project.package_name,
@@ -379,7 +312,7 @@ module Omnibus
379
312
  maintainer: project.maintainer,
380
313
  upgrade_code: upgrade_code,
381
314
  parameters: parameters,
382
- version: msi_version,
315
+ version: windows_package_version,
383
316
  display_version: msi_display_version,
384
317
  }
385
318
  )
@@ -394,7 +327,7 @@ module Omnibus
394
327
  paths = []
395
328
 
396
329
  # Remove C:/
397
- install_dir = project.install_dir.split('/')[1..-1].join('/')
330
+ install_dir = project.install_dir.split("/")[1..-1].join("/")
398
331
 
399
332
  # Grab all parent paths
400
333
  Pathname.new(install_dir).ascend do |path|
@@ -403,24 +336,24 @@ module Omnibus
403
336
 
404
337
  # Create the hierarchy
405
338
  hierarchy = paths.reverse.inject({}) do |hash, path|
406
- hash[File.basename(path)] = path.gsub(/[^[:alnum:]]/, '').upcase + 'LOCATION'
339
+ hash[File.basename(path)] = path.gsub(/[^[:alnum:]]/, "").upcase + "LOCATION"
407
340
  hash
408
341
  end
409
342
 
410
343
  # The last item in the path MUST be named PROJECTLOCATION or else space
411
344
  # robots will cause permanent damage to you and your family.
412
- hierarchy[hierarchy.keys.last] = 'PROJECTLOCATION'
345
+ hierarchy[hierarchy.keys.last] = "PROJECTLOCATION"
413
346
 
414
347
  # If the path hierarchy is > 1, the customizable installation directory
415
348
  # should default to the second-to-last item in the hierarchy. If the
416
349
  # hierarchy is smaller than that, then just use the system drive.
417
350
  wix_install_dir = if hierarchy.size > 1
418
- hierarchy.to_a[-2][1]
419
- else
420
- 'WINDOWSVOLUME'
421
- end
351
+ hierarchy.to_a[-2][1]
352
+ else
353
+ "WINDOWSVOLUME"
354
+ end
422
355
 
423
- render_template(resource_path('source.wxs.erb'),
356
+ render_template(resource_path("source.wxs.erb"),
424
357
  destination: "#{staging_dir}/source.wxs",
425
358
  variables: {
426
359
  name: project.package_name,
@@ -439,7 +372,7 @@ module Omnibus
439
372
  # @return [void]
440
373
  #
441
374
  def write_bundle_file
442
- render_template(resource_path('bundle.wxs.erb'),
375
+ render_template(resource_path("bundle.wxs.erb"),
443
376
  destination: "#{staging_dir}/bundle.wxs",
444
377
  variables: {
445
378
  name: project.package_name,
@@ -447,33 +380,13 @@ module Omnibus
447
380
  maintainer: project.maintainer,
448
381
  upgrade_code: upgrade_code,
449
382
  parameters: parameters,
450
- version: msi_version,
383
+ version: windows_package_version,
451
384
  display_version: msi_display_version,
452
385
  msi: windows_safe_path(Config.package_dir, msi_name),
453
386
  }
454
387
  )
455
388
  end
456
389
 
457
- #
458
- # Parse and return the MSI version from the {Project#build_version}.
459
- #
460
- # A project's +build_version+ looks something like:
461
- #
462
- # dev builds => 11.14.0-alpha.1+20140501194641.git.94.561b564
463
- # => 0.0.0+20140506165802.1
464
- #
465
- # rel builds => 11.14.0.alpha.1 || 11.14.0
466
- #
467
- # The MSI version spec expects a version that looks like X.Y.Z.W where
468
- # X, Y, Z & W are all 32 bit integers.
469
- #
470
- # @return [String]
471
- #
472
- def msi_version
473
- versions = project.build_version.split(/[.+-]/)
474
- "#{versions[0]}.#{versions[1]}.#{versions[2]}.#{project.build_iteration}"
475
- end
476
-
477
390
  #
478
391
  # Get the shell command to create a zip file that contains
479
392
  # the contents of the project install directory
@@ -481,7 +394,7 @@ module Omnibus
481
394
  # @return [String]
482
395
  #
483
396
  def zip_command
484
- <<-EOH.split.join(' ').squeeze(' ').strip
397
+ <<-EOH.split.join(" ").squeeze(" ").strip
485
398
  7z a -r
486
399
  #{windows_safe_path(staging_dir)}\\#{project.name}.zip
487
400
  #{windows_safe_path(project.install_dir)}\\*
@@ -496,7 +409,7 @@ module Omnibus
496
409
  #
497
410
  def heat_command
498
411
  if fast_msi
499
- <<-EOH.split.join(' ').squeeze(' ').strip
412
+ <<-EOH.split.join(" ").squeeze(" ").strip
500
413
  heat.exe file "#{project.name}.zip"
501
414
  -cg ProjectDir
502
415
  -dr INSTALLLOCATION
@@ -504,7 +417,7 @@ module Omnibus
504
417
  -out "project-files.wxs"
505
418
  EOH
506
419
  else
507
- <<-EOH.split.join(' ').squeeze(' ').strip
420
+ <<-EOH.split.join(" ").squeeze(" ").strip
508
421
  heat.exe dir "#{windows_safe_path(project.install_dir)}"
509
422
  -nologo -srd -sreg -gg -cg ProjectDir
510
423
  -dr PROJECTLOCATION
@@ -521,7 +434,7 @@ module Omnibus
521
434
  #
522
435
  def candle_command(is_bundle: false)
523
436
  if is_bundle
524
- <<-EOH.split.join(' ').squeeze(' ').strip
437
+ <<-EOH.split.join(" ").squeeze(" ").strip
525
438
  candle.exe
526
439
  -nologo
527
440
  #{wix_candle_flags}
@@ -531,7 +444,7 @@ module Omnibus
531
444
  "#{windows_safe_path(staging_dir, 'bundle.wxs')}"
532
445
  EOH
533
446
  else
534
- <<-EOH.split.join(' ').squeeze(' ').strip
447
+ <<-EOH.split.join(" ").squeeze(" ").strip
535
448
  candle.exe
536
449
  -nologo
537
450
  #{wix_candle_flags}
@@ -549,7 +462,7 @@ module Omnibus
549
462
  #
550
463
  def light_command(out_file, is_bundle: false)
551
464
  if is_bundle
552
- <<-EOH.split.join(' ').squeeze(' ').strip
465
+ <<-EOH.split.join(" ").squeeze(" ").strip
553
466
  light.exe
554
467
  -nologo
555
468
  -ext WixUIExtension
@@ -561,7 +474,7 @@ module Omnibus
561
474
  -out "#{out_file}"
562
475
  EOH
563
476
  else
564
- <<-EOH.split.join(' ').squeeze(' ').strip
477
+ <<-EOH.split.join(" ").squeeze(" ").strip
565
478
  light.exe
566
479
  -nologo
567
480
  -ext WixUIExtension
@@ -577,7 +490,7 @@ module Omnibus
577
490
  #
578
491
  # The display version calculated from the {Project#build_version}.
579
492
  #
580
- # @see #msi_version an explanation of the breakdown
493
+ # @see #windows_package_version an explanation of the breakdown
581
494
  #
582
495
  # @return [String]
583
496
  #
@@ -627,75 +540,7 @@ module Omnibus
627
540
  # @return [String]
628
541
  #
629
542
  def wix_extension_switches(arr)
630
- "#{arr.map {|e| "-ext '#{e}'"}.join(' ')}"
631
- end
632
-
633
- def thumbprint
634
- signing_identity[:thumbprint]
635
- end
636
-
637
- def cert_store_name
638
- signing_identity[:store]
639
- end
640
-
641
- def timestamp_servers
642
- signing_identity[:timestamp_servers]
643
- end
644
-
645
- def machine_store?
646
- signing_identity[:machine_store]
647
- end
648
-
649
- #
650
- # Takes a path to a msi and uses the set certificate store and
651
- # certificate name
652
- #
653
- def sign_package(msi_file)
654
- cmd = Array.new.tap do |arr|
655
- arr << 'signtool.exe'
656
- arr << 'sign /v'
657
- arr << '/sm' if machine_store?
658
- arr << "/s #{cert_store_name}"
659
- arr << "/sha1 #{thumbprint}"
660
- arr << "/d #{project.package_name}"
661
- arr << "\"#{msi_file}\""
662
- end
663
- shellout!(cmd.join(" "))
664
- add_timestamp(msi_file)
665
- end
666
-
667
- #
668
- # Iterates through available timestamp servers and tries to timestamp
669
- # the file. If non succeed, an exception is raised.
670
- #
671
- def add_timestamp(msi_file)
672
- success = false
673
- timestamp_servers.each do |ts|
674
- success = try_timestamp(msi_file, ts)
675
- break if success
676
- end
677
- raise FailedToTimestampMSI.new if !success
678
- end
679
-
680
- def try_timestamp(msi_file, url)
681
- timestamp_command = "signtool.exe timestamp -t #{url} \"#{msi_file}\""
682
- status = shellout(timestamp_command)
683
- if status.exitstatus != 0
684
- log.warn(log_key) do
685
- <<-EOH.strip
686
- Failed to add timestamp with timeserver #{url}
687
-
688
- STDOUT
689
- ------
690
- #{status.stdout}
691
-
692
- STDERR
693
- ------
694
- #{status.stderr}
695
- EOH
696
- end
697
- end
698
- status.exitstatus == 0
543
+ "#{arr.map { |e| "-ext '#{e}'" }.join(' ')}"
699
544
  end
700
545
  end
701
546
  end
@@ -19,11 +19,11 @@ module Omnibus
19
19
  # @return [Hash]
20
20
  SCRIPT_MAP = {
21
21
  # Default Omnibus naming
22
- preinst: 'preinstall',
23
- postinst: 'postinstall',
22
+ preinst: "preinstall",
23
+ postinst: "postinstall",
24
24
  # Default PKG naming
25
- preinstall: 'preinstall',
26
- postinstall: 'postinstall',
25
+ preinstall: "preinstall",
26
+ postinstall: "postinstall",
27
27
  }.freeze
28
28
 
29
29
  id :pkg
@@ -36,7 +36,7 @@ module Omnibus
36
36
  create_directory(scripts_dir)
37
37
 
38
38
  # Render the license
39
- render_template(resource_path('license.html.erb'),
39
+ render_template(resource_path("license.html.erb"),
40
40
  destination: "#{resources_dir}/license.html",
41
41
  variables: {
42
42
  name: project.name,
@@ -48,7 +48,7 @@ module Omnibus
48
48
  )
49
49
 
50
50
  # Render the welcome template
51
- render_template(resource_path('welcome.html.erb'),
51
+ render_template(resource_path("welcome.html.erb"),
52
52
  destination: "#{resources_dir}/welcome.html",
53
53
  variables: {
54
54
  name: project.name,
@@ -60,7 +60,7 @@ module Omnibus
60
60
  )
61
61
 
62
62
  # "Render" the assets
63
- copy_file(resource_path('background.png'), "#{resources_dir}/background.png")
63
+ copy_file(resource_path("background.png"), "#{resources_dir}/background.png")
64
64
  end
65
65
 
66
66
  build do
@@ -187,7 +187,7 @@ module Omnibus
187
187
  # @return [void]
188
188
  #
189
189
  def build_component_pkg
190
- command = <<-EOH.gsub(/^ {8}/, '')
190
+ command = <<-EOH.gsub(/^ {8}/, "")
191
191
  pkgbuild \\
192
192
  --identifier "#{safe_identifier}" \\
193
193
  --version "#{safe_version}" \\
@@ -213,7 +213,7 @@ module Omnibus
213
213
  # @return [void]
214
214
  #
215
215
  def write_distribution_file
216
- render_template(resource_path('distribution.xml.erb'),
216
+ render_template(resource_path("distribution.xml.erb"),
217
217
  destination: "#{staging_dir}/Distribution",
218
218
  mode: 0600,
219
219
  variables: {
@@ -232,15 +232,15 @@ module Omnibus
232
232
  # @return [void]
233
233
  #
234
234
  def build_product_pkg
235
- command = <<-EOH.gsub(/^ {8}/, '')
235
+ command = <<-EOH.gsub(/^ {8}/, "")
236
236
  productbuild \\
237
237
  --distribution "#{staging_dir}/Distribution" \\
238
238
  --resources "#{resources_dir}" \\
239
239
  EOH
240
240
 
241
- command << %Q( --sign "#{signing_identity}" \\\n) if signing_identity
242
- command << %Q( "#{final_pkg}")
243
- command << %Q(\n)
241
+ command << %Q{ --sign "#{signing_identity}" \\\n} if signing_identity
242
+ command << %Q{ "#{final_pkg}"}
243
+ command << %Q{\n}
244
244
 
245
245
  Dir.chdir(staging_dir) do
246
246
  shellout!(command)
@@ -265,7 +265,7 @@ module Omnibus
265
265
  if project.package_name =~ /\A[[:alnum:]-]+\z/
266
266
  project.package_name.dup
267
267
  else
268
- converted = project.package_name.downcase.gsub(/[^[:alnum:]+]/, '')
268
+ converted = project.package_name.downcase.gsub(/[^[:alnum:]+]/, "")
269
269
 
270
270
  log.warn(log_key) do
271
271
  "The `name' component of Mac package names can only include " \
@@ -287,7 +287,7 @@ module Omnibus
287
287
  def safe_identifier
288
288
  return identifier if identifier
289
289
 
290
- maintainer = project.maintainer.gsub(/[^[:alnum:]+]/, '').downcase
290
+ maintainer = project.maintainer.gsub(/[^[:alnum:]+]/, "").downcase
291
291
  "test.#{maintainer}.pkg.#{safe_base_package_name}"
292
292
  end
293
293
 
@@ -311,7 +311,7 @@ module Omnibus
311
311
  if project.build_version =~ /\A[a-zA-Z0-9\.\+\-]+\z/
312
312
  project.build_version.dup
313
313
  else
314
- converted = project.build_version.gsub(/[^a-zA-Z0-9\.\+\-]+/, '-')
314
+ converted = project.build_version.gsub(/[^a-zA-Z0-9\.\+\-]+/, "-")
315
315
 
316
316
  log.warn(log_key) do
317
317
  "The `version' component of Mac package names can only include " \