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
@@ -15,11 +15,11 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'time'
19
- require 'ffi_yajl'
20
- require 'omnibus/manifest'
21
- require 'omnibus/manifest_entry'
22
- require 'omnibus/reports'
18
+ require "time"
19
+ require "ffi_yajl"
20
+ require "omnibus/manifest"
21
+ require "omnibus/manifest_entry"
22
+ require "omnibus/reports"
23
23
 
24
24
  module Omnibus
25
25
  class Project
@@ -30,7 +30,7 @@ module Omnibus
30
30
  #
31
31
  # @return [Project]
32
32
  #
33
- def load(name, manifest=nil)
33
+ def load(name, manifest = nil)
34
34
  loaded_projects[name] ||= begin
35
35
  filepath = Omnibus.project_path(name)
36
36
 
@@ -77,7 +77,7 @@ module Omnibus
77
77
  include Sugarable
78
78
  include Util
79
79
 
80
- def initialize(filepath = nil, manifest=nil)
80
+ def initialize(filepath = nil, manifest = nil)
81
81
  @filepath = filepath
82
82
  @manifest = manifest
83
83
  end
@@ -105,7 +105,7 @@ module Omnibus
105
105
  #
106
106
  def name(val = NULL)
107
107
  if null?(val)
108
- @name || raise(MissingRequiredAttribute.new(self, :name, 'hamlet'))
108
+ @name || raise(MissingRequiredAttribute.new(self, :name, "hamlet"))
109
109
  else
110
110
  @name = val
111
111
  end
@@ -177,9 +177,9 @@ module Omnibus
177
177
  #
178
178
  def install_dir(val = NULL)
179
179
  if null?(val)
180
- @install_dir || raise(MissingRequiredAttribute.new(self, :install_dir, '/opt/chef'))
180
+ @install_dir || raise(MissingRequiredAttribute.new(self, :install_dir, "/opt/chef"))
181
181
  else
182
- @install_dir = val.gsub('\\', '/').squeeze('/').chomp('/')
182
+ @install_dir = val.tr('\\', "/").squeeze("/").chomp("/")
183
183
  end
184
184
  end
185
185
  expose :install_dir
@@ -197,9 +197,9 @@ module Omnibus
197
197
  #
198
198
  def default_root
199
199
  if windows?
200
- 'C:'
200
+ "C:"
201
201
  else
202
- '/opt'
202
+ "/opt"
203
203
  end
204
204
  end
205
205
  expose :default_root
@@ -235,7 +235,7 @@ module Omnibus
235
235
  #
236
236
  def maintainer(val = NULL)
237
237
  if null?(val)
238
- @maintainer || raise(MissingRequiredAttribute.new(self, :maintainer, 'Chef Software, Inc.'))
238
+ @maintainer || raise(MissingRequiredAttribute.new(self, :maintainer, "Chef Software, Inc."))
239
239
  else
240
240
  @maintainer = val
241
241
  end
@@ -258,7 +258,7 @@ module Omnibus
258
258
  #
259
259
  def homepage(val = NULL)
260
260
  if null?(val)
261
- @homepage || raise(MissingRequiredAttribute.new(self, :homepage, 'https://www.getchef.com'))
261
+ @homepage || raise(MissingRequiredAttribute.new(self, :homepage, "https://www.getchef.com"))
262
262
  else
263
263
  @homepage = val
264
264
  end
@@ -367,7 +367,7 @@ module Omnibus
367
367
  #
368
368
  def build_version(val = NULL, &block)
369
369
  if block && !null?(val)
370
- raise Error, 'You cannot specify additional parameters to ' \
370
+ raise Error, "You cannot specify additional parameters to " \
371
371
  '#build_version when a block is given!'
372
372
  end
373
373
 
@@ -383,7 +383,6 @@ module Omnibus
383
383
  end
384
384
  expose :build_version
385
385
 
386
-
387
386
  #
388
387
  # Set or retrieve the git revision of the omnibus
389
388
  # project being built.
@@ -437,7 +436,7 @@ module Omnibus
437
436
  #
438
437
  def package(id, &block)
439
438
  unless block
440
- raise InvalidValue.new(:package, 'have a block')
439
+ raise InvalidValue.new(:package, "have a block")
441
440
  end
442
441
 
443
442
  packagers[id] << block
@@ -490,7 +489,7 @@ module Omnibus
490
489
  #
491
490
  def package_user(val = NULL)
492
491
  if null?(val)
493
- @package_user || 'root'
492
+ @package_user || "root"
494
493
  else
495
494
  @package_user = val
496
495
  end
@@ -537,7 +536,7 @@ module Omnibus
537
536
  #
538
537
  def package_group(val = NULL)
539
538
  if null?(val)
540
- @package_group || Ohai['root_group'] || 'root'
539
+ @package_group || Ohai["root_group"] || "root"
541
540
  else
542
541
  @package_group = val
543
542
  end
@@ -711,7 +710,7 @@ module Omnibus
711
710
  #
712
711
  def license(val = NULL)
713
712
  if null?(val)
714
- @license || 'Unspecified'
713
+ @license || "Unspecified"
715
714
  else
716
715
  @license = val
717
716
  end
@@ -776,7 +775,7 @@ module Omnibus
776
775
  if null?(path)
777
776
  @json_manifest_path || File.join(install_dir, "version-manifest.json")
778
777
  else
779
- @json_manifest_path=path
778
+ @json_manifest_path = path
780
779
  end
781
780
  end
782
781
  expose :json_manifest_path
@@ -932,12 +931,12 @@ module Omnibus
932
931
  end
933
932
 
934
933
  #
935
- # Instantiate a new instance of the best packager for this system.
934
+ # Instantiate new instances of the best packagers for this system.
936
935
  #
937
- # @return [~Packager::Base]
936
+ # @return [[~Packager::Base]]
938
937
  #
939
- def packager
940
- @packager ||= Packager.for_current_system.new(self)
938
+ def packagers_for_system
939
+ @packagers_for_system ||= Packager.for_current_system.map { |p| p.new(self) }
941
940
  end
942
941
 
943
942
  #
@@ -1073,20 +1072,21 @@ module Omnibus
1073
1072
  FileUtils.rm_rf(install_dir)
1074
1073
  FileUtils.mkdir_p(install_dir)
1075
1074
 
1076
- softwares.each do |software|
1077
- software.build_me
1075
+ Licensing.create_incrementally(self) do |license_collector|
1076
+ softwares.each do |software|
1077
+ software.build_me([license_collector])
1078
+ end
1078
1079
  end
1079
1080
 
1080
1081
  write_json_manifest
1081
1082
  write_text_manifest
1082
- Licensing.create!(self)
1083
1083
  HealthCheck.run!(self)
1084
1084
  package_me
1085
1085
  compress_me
1086
1086
  end
1087
1087
 
1088
1088
  def write_json_manifest
1089
- File.open(json_manifest_path, 'w') do |f|
1089
+ File.open(json_manifest_path, "w") do |f|
1090
1090
  f.write(FFI_Yajl::Encoder.encode(built_manifest.to_hash, pretty: true))
1091
1091
  end
1092
1092
  end
@@ -1097,7 +1097,7 @@ module Omnibus
1097
1097
  # omnibus-software.
1098
1098
  #
1099
1099
  def write_text_manifest
1100
- File.open(text_manifest_path, 'w') do |f|
1100
+ File.open(text_manifest_path, "w") do |f|
1101
1101
  f.puts "#{name} #{build_version}"
1102
1102
  f.puts ""
1103
1103
  f.puts Omnibus::Reports.pretty_version_map(self)
@@ -1118,32 +1118,34 @@ module Omnibus
1118
1118
  #
1119
1119
  #
1120
1120
  def package_me
1121
- destination = File.expand_path('pkg', Config.project_root)
1121
+ destination = File.expand_path("pkg", Config.project_root)
1122
1122
 
1123
1123
  # Create the destination directory
1124
1124
  unless File.directory?(destination)
1125
1125
  FileUtils.mkdir_p(destination)
1126
1126
  end
1127
1127
 
1128
- # Evaluate any packager-specific blocks, in order.
1129
- packagers[packager.id].each do |block|
1130
- packager.evaluate(&block)
1131
- end
1128
+ packagers_for_system.each do |packager|
1129
+ # Evaluate any packager-specific blocks, in order.
1130
+ packagers[packager.id].each do |block|
1131
+ packager.evaluate(&block)
1132
+ end
1132
1133
 
1133
- # Run the actual packager
1134
- packager.run!
1134
+ # Run the actual packager
1135
+ packager.run!
1135
1136
 
1136
- # Copy the generated package and metadata back into the workspace
1137
- package_path = File.join(Config.package_dir, packager.package_name)
1138
- FileUtils.cp(package_path, destination, preserve: true)
1139
- FileUtils.cp("#{package_path}.metadata.json", destination, preserve: true)
1137
+ # Copy the generated package and metadata back into the workspace
1138
+ package_path = File.join(Config.package_dir, packager.package_name)
1139
+ FileUtils.cp(package_path, destination, preserve: true)
1140
+ FileUtils.cp("#{package_path}.metadata.json", destination, preserve: true)
1141
+ end
1140
1142
  end
1141
1143
 
1142
1144
  #
1143
1145
  #
1144
1146
  #
1145
1147
  def compress_me
1146
- destination = File.expand_path('pkg', Config.project_root)
1148
+ destination = File.expand_path("pkg", Config.project_root)
1147
1149
 
1148
1150
  # Create the destination directory
1149
1151
  unless File.directory?(destination)
@@ -1211,7 +1213,7 @@ module Omnibus
1211
1213
  if filepath && File.exist?(filepath)
1212
1214
  update_with_file_contents(digest, filepath)
1213
1215
  else
1214
- update_with_string(digest, '<DYNAMIC>')
1216
+ update_with_string(digest, "<DYNAMIC>")
1215
1217
  end
1216
1218
 
1217
1219
  digest.hexdigest
@@ -76,7 +76,7 @@ module Omnibus
76
76
  # the platform map is a simple hash with publish to build platform mappings
77
77
  @options[:platform_mappings].each_pair do |build_platform, publish_platforms|
78
78
  # Splits `ubuntu-12.04` into `ubuntu` and `12.04`
79
- build_platform, build_platform_version = build_platform.rpartition('-') - %w( - )
79
+ build_platform, build_platform_version = build_platform.rpartition("-") - %w{ - }
80
80
 
81
81
  # locate the package for the build platform
82
82
  packages = build_packages.select do |p|
@@ -92,7 +92,7 @@ module Omnibus
92
92
  end
93
93
 
94
94
  publish_platforms.each do |publish_platform|
95
- publish_platform, publish_platform_version = publish_platform.rpartition('-') - %w( - )
95
+ publish_platform, publish_platform_version = publish_platform.rpartition("-") - %w{ - }
96
96
 
97
97
  packages.each do |p|
98
98
  # create a copy of our package before mucking with its metadata
@@ -115,7 +115,7 @@ module Omnibus
115
115
  end
116
116
 
117
117
  if publish_packages.empty?
118
- log.info(log_key) { 'No packages found, skipping publish' }
118
+ log.info(log_key) { "No packages found, skipping publish" }
119
119
  end
120
120
 
121
121
  publish_packages
@@ -14,14 +14,14 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'uri'
18
- require 'benchmark'
17
+ require "uri"
18
+ require "benchmark"
19
19
 
20
20
  module Omnibus
21
21
  class ArtifactoryPublisher < Publisher
22
22
  def publish(&block)
23
- log.info(log_key) { 'Starting artifactory publisher' }
24
- safe_require('artifactory')
23
+ log.info(log_key) { "Starting artifactory publisher" }
24
+ safe_require("artifactory")
25
25
 
26
26
  packages.each do |package|
27
27
  # Make sure the package is good to go!
@@ -40,7 +40,7 @@ module Omnibus
40
40
  artifact_for(package).upload(
41
41
  repository,
42
42
  remote_path,
43
- properties,
43
+ properties
44
44
  )
45
45
  # Upload the package's assoacited `*.metadata.json` file
46
46
  log.info(log_key) { "Uploading '#{package.name}.metadata.json'" }
@@ -49,12 +49,12 @@ module Omnibus
49
49
  "#{remote_path}.metadata.json",
50
50
  # *.metadata.json files should not include
51
51
  # the checksum properties
52
- properties.dup.delete_if { |k,v| k =~ /^omnibus\.(md5|sha)/ },
52
+ properties.dup.delete_if { |k, v| k =~ /^omnibus\.(md5|sha)/ }
53
53
  )
54
54
  end
55
55
  rescue Artifactory::Error::HTTPError => e
56
56
  if (retries -= 1) != 0
57
- log.info(log_key) { "Upload failed with exception: #{e}"}
57
+ log.info(log_key) { "Upload failed with exception: #{e}" }
58
58
  log.info(log_key) { "Retrying failed publish #{retries} more time(s)..." }
59
59
  retry
60
60
  else
@@ -62,10 +62,10 @@ module Omnibus
62
62
  end
63
63
  end
64
64
 
65
- log.debug(log_key) { "Elapsed time to publish #{package.name}: #{1000*upload_time} ms" }
65
+ log.debug(log_key) { "Elapsed time to publish #{package.name}: #{1000 * upload_time} ms" }
66
66
 
67
67
  # If a block was given, "yield" the package to the caller
68
- block.call(package) if block
68
+ yield(package) if block
69
69
  end
70
70
 
71
71
  if build_record?
@@ -95,8 +95,8 @@ module Omnibus
95
95
  local_path: artifact.path,
96
96
  client: client,
97
97
  checksums: {
98
- 'md5' => md5,
99
- 'sha1' => sha1,
98
+ "md5" => md5,
99
+ "sha1" => sha1,
100
100
  }
101
101
  )
102
102
  end
@@ -122,7 +122,7 @@ module Omnibus
122
122
  # we already know the `version_manifest` entry is
123
123
  # missing so we can't pull in the `build_git_revision`
124
124
  nil,
125
- metadata[:license],
125
+ metadata[:license]
126
126
  )
127
127
  end
128
128
 
@@ -135,40 +135,40 @@ module Omnibus
135
135
  number: manifest.build_version,
136
136
  vcs_revision: manifest.build_git_revision,
137
137
  build_agent: {
138
- name: 'omnibus',
138
+ name: "omnibus",
139
139
  version: Omnibus::VERSION,
140
140
  },
141
141
  properties: default_properties.merge(
142
- 'omnibus.project' => name,
143
- 'omnibus.version' => manifest.build_version,
144
- 'omnibus.build_git_revision' => manifest.build_git_revision,
145
- 'omnibus.license' => manifest.license,
142
+ "omnibus.project" => name,
143
+ "omnibus.version" => manifest.build_version,
144
+ "omnibus.build_git_revision" => manifest.build_git_revision,
145
+ "omnibus.license" => manifest.license
146
146
  ),
147
147
  modules: [
148
148
  {
149
149
  # com.getchef:chef-server:12.0.0
150
150
  id: [
151
- Config.artifactory_base_path.gsub('/', '.'),
151
+ Config.artifactory_base_path.tr("/", "."),
152
152
  name,
153
153
  manifest.build_version,
154
- ].join(':'),
154
+ ].join(":"),
155
155
  artifacts: packages.map do |package|
156
156
  [
157
157
  {
158
- type: File.extname(package.path).split('.').last,
158
+ type: File.extname(package.path).split(".").last,
159
159
  sha1: package.metadata[:sha1],
160
160
  md5: package.metadata[:md5],
161
161
  name: package.metadata[:basename],
162
162
  },
163
163
  {
164
- type: File.extname(package.metadata.path).split('.').last,
164
+ type: File.extname(package.metadata.path).split(".").last,
165
165
  sha1: digest(package.metadata.path, :sha1),
166
166
  md5: digest(package.metadata.path, :md5),
167
167
  name: File.basename(package.metadata.path),
168
- }
168
+ },
169
169
  ]
170
- end.flatten
171
- }
170
+ end.flatten,
171
+ },
172
172
  ]
173
173
  )
174
174
  end
@@ -203,7 +203,7 @@ module Omnibus
203
203
  proxy_username: Config.artifactory_proxy_username,
204
204
  proxy_password: Config.artifactory_proxy_password,
205
205
  proxy_address: Config.artifactory_proxy_address,
206
- proxy_port: Config.artifactory_proxy_port,
206
+ proxy_port: Config.artifactory_proxy_port
207
207
  )
208
208
  end
209
209
 
@@ -217,21 +217,21 @@ module Omnibus
217
217
  #
218
218
  def metadata_properties_for(package)
219
219
  metadata = {
220
- 'omnibus.project' => package.metadata[:name],
221
- 'omnibus.platform' => package.metadata[:platform],
222
- 'omnibus.platform_version' => package.metadata[:platform_version],
223
- 'omnibus.architecture' => package.metadata[:arch],
224
- 'omnibus.version' => package.metadata[:version],
225
- 'omnibus.iteration' => package.metadata[:iteration],
226
- 'omnibus.license' => package.metadata[:license],
227
- 'omnibus.md5' => package.metadata[:md5],
228
- 'omnibus.sha1' => package.metadata[:sha1],
229
- 'omnibus.sha256' => package.metadata[:sha256],
230
- 'omnibus.sha512' => package.metadata[:sha512]
220
+ "omnibus.project" => package.metadata[:name],
221
+ "omnibus.platform" => package.metadata[:platform],
222
+ "omnibus.platform_version" => package.metadata[:platform_version],
223
+ "omnibus.architecture" => package.metadata[:arch],
224
+ "omnibus.version" => package.metadata[:version],
225
+ "omnibus.iteration" => package.metadata[:iteration],
226
+ "omnibus.license" => package.metadata[:license],
227
+ "omnibus.md5" => package.metadata[:md5],
228
+ "omnibus.sha1" => package.metadata[:sha1],
229
+ "omnibus.sha256" => package.metadata[:sha256],
230
+ "omnibus.sha512" => package.metadata[:sha512],
231
231
  }.tap do |h|
232
232
  if build_record?
233
- h['build.name'] = package.metadata[:name]
234
- h['build.number'] = package.metadata[:version]
233
+ h["build.name"] = package.metadata[:name]
234
+ h["build.number"] = package.metadata[:version]
235
235
  end
236
236
  end
237
237
 
@@ -276,7 +276,7 @@ module Omnibus
276
276
  package.metadata[:version],
277
277
  package.metadata[:platform],
278
278
  package.metadata[:platform_version],
279
- package.metadata[:basename],
279
+ package.metadata[:basename]
280
280
  )
281
281
  end
282
282
  end
@@ -14,14 +14,14 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'omnibus/s3_helpers'
17
+ require "omnibus/s3_helpers"
18
18
 
19
19
  module Omnibus
20
20
  class S3Publisher < Publisher
21
21
  include S3Helpers
22
22
 
23
23
  def publish(&block)
24
- log.info(log_key) { 'Starting S3 publisher' }
24
+ log.info(log_key) { "Starting S3 publisher" }
25
25
 
26
26
  packages.each do |package|
27
27
  # Make sure the package is good to go!
@@ -39,7 +39,7 @@ module Omnibus
39
39
  package.metadata[:md5], access_policy)
40
40
 
41
41
  # If a block was given, "yield" the package to the caller
42
- block.call(package) if block
42
+ yield(package) if block
43
43
  end
44
44
  end
45
45
 
@@ -71,7 +71,7 @@ module Omnibus
71
71
  package.metadata[:platform_version],
72
72
  package.metadata[:arch],
73
73
  package.name,
74
- *stuff,
74
+ *stuff
75
75
  )
76
76
  end
77
77
 
@@ -84,10 +84,10 @@ module Omnibus
84
84
  # the access policy
85
85
  #
86
86
  def access_policy
87
- if @options[:acl].to_s == 'public'
88
- 'public-read'
87
+ if @options[:acl].to_s == "public"
88
+ "public-read"
89
89
  else
90
- 'private'
90
+ "private"
91
91
  end
92
92
  end
93
93
  end
@@ -39,7 +39,7 @@ module Omnibus
39
39
  end
40
40
 
41
41
  def pretty_version_map(project)
42
- out = ''
42
+ out = ""
43
43
  version_map = project.library.version_map
44
44
 
45
45
  # Pull out data to print out
@@ -52,20 +52,20 @@ module Omnibus
52
52
  overridden_versions = non_nil_values(version_map.values.select { |v| v[:overridden] }, :default_version)
53
53
 
54
54
  # Determine how wide the printed table columns need to be
55
- name_width = column_width(version_map.keys, 'Component')
56
- version_width = column_width(versions, 'Installed Version')
57
- guid_width = column_width(guids, 'Version GUID')
58
- override_width = column_width(overridden_versions, 'Overridden From')
55
+ name_width = column_width(version_map.keys, "Component")
56
+ version_width = column_width(versions, "Installed Version")
57
+ guid_width = column_width(guids, "Version GUID")
58
+ override_width = column_width(overridden_versions, "Overridden From")
59
59
 
60
60
  total_width = name_width + version_width + guid_width + override_width
61
- divider = '-' * total_width
61
+ divider = "-" * total_width
62
62
 
63
63
  # Print out the column headers
64
- out << 'Component'.ljust(name_width)
65
- out << 'Installed Version'.ljust(version_width)
66
- out << 'Version GUID'.ljust(guid_width)
64
+ out << "Component".ljust(name_width)
65
+ out << "Installed Version".ljust(version_width)
66
+ out << "Version GUID".ljust(guid_width)
67
67
  # Only print out column if something was overridden
68
- out << 'Overridden From'.ljust(override_width) if override_width > 0
68
+ out << "Overridden From".ljust(override_width) if override_width > 0
69
69
  out << "\n"
70
70
  out << divider << "\n"
71
71
 
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'fileutils'
18
- require 'omnibus/s3_helpers'
17
+ require "fileutils"
18
+ require "omnibus/s3_helpers"
19
19
 
20
20
  module Omnibus
21
21
  class S3Cache
@@ -76,14 +76,14 @@ module Omnibus
76
76
  log.info(log_key) do
77
77
  "Caching '#{fetcher.downloaded_file}' to '#{Config.s3_bucket}/#{key}'"
78
78
  end
79
-
79
+
80
80
  # Fetcher has already verified the downloaded file in software.fetch.
81
81
  # Compute the md5 from scratch because the fetcher may have been
82
82
  # specified with a different hashing algorithm.
83
83
  md5 = digest(fetcher.downloaded_file, :md5)
84
84
 
85
- File.open(fetcher.downloaded_file, 'rb') do |file|
86
- store_object(key, file, md5, 'public-read')
85
+ File.open(fetcher.downloaded_file, "rb") do |file|
86
+ store_object(key, file, md5, "public-read")
87
87
  end
88
88
  end
89
89
 
@@ -126,7 +126,7 @@ module Omnibus
126
126
  end
127
127
 
128
128
  unless software.fetcher.checksum
129
- raise InsufficientSpecification.new('source md5 checksum', software)
129
+ raise InsufficientSpecification.new("source md5 checksum", software)
130
130
  end
131
131
 
132
132
  "#{software.name}-#{software.version}-#{software.fetcher.checksum}"
@@ -139,7 +139,7 @@ module Omnibus
139
139
  region: Config.s3_region,
140
140
  access_key_id: Config.s3_access_key,
141
141
  secret_access_key: Config.s3_secret_key,
142
- bucket_name: Config.s3_bucket
142
+ bucket_name: Config.s3_bucket,
143
143
  }
144
144
  end
145
145
 
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'aws-sdk'
18
- require 'base64'
17
+ require "aws-sdk"
18
+ require "base64"
19
19
 
20
20
  module Omnibus
21
21
  module S3Helpers
@@ -25,9 +25,10 @@ module Omnibus
25
25
 
26
26
  module InstanceMethods
27
27
  private
28
+
28
29
  #
29
30
  # Returns the configuration for S3. You must provide keys
30
- # :region,
31
+ # :region,
31
32
  #
32
33
  # @example
33
34
  # {
@@ -65,11 +66,11 @@ module Omnibus
65
66
  @s3_bucket ||= begin
66
67
  bucket = client.bucket(s3_configuration[:bucket_name])
67
68
  unless bucket.exists?
68
- bucket_config = if s3_configuration[:region] == 'us-east-1'
69
+ bucket_config = if s3_configuration[:region] == "us-east-1"
69
70
  nil
70
71
  else
71
72
  {
72
- location_constraint: s3_configuration[:region]
73
+ location_constraint: s3_configuration[:region],
73
74
  }
74
75
  end
75
76
  bucket.create(create_bucket_configuration: bucket_config)
@@ -93,7 +94,7 @@ module Omnibus
93
94
  key: key,
94
95
  body: content,
95
96
  content_md5: to_base64_digest(content_md5),
96
- acl: acl
97
+ acl: acl,
97
98
  })
98
99
  true
99
100
  end
@@ -110,7 +111,7 @@ module Omnibus
110
111
  #
111
112
  def to_base64_digest(content_md5)
112
113
  if content_md5
113
- md5_digest = content_md5.unpack('a2'*16).collect {|i| i.hex.chr }.join
114
+ md5_digest = content_md5.unpack("a2" * 16).collect { |i| i.hex.chr }.join
114
115
  Base64.encode64(md5_digest).strip
115
116
  end
116
117
  end
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'mixlib/versioning'
17
+ require "mixlib/versioning"
18
18
 
19
19
  module Omnibus
20
20
  class SemanticVersion