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,25 +1,25 @@
1
- require 'stringio'
1
+ require "stringio"
2
2
 
3
3
  module Omnibus
4
4
  describe Compressor::Base do
5
5
  let(:packager) { double(Packager::Base) }
6
- let(:project) { double(Project, packager: packager) }
6
+ let(:project) { double(Project, packagers_for_system: [packager]) }
7
7
 
8
- describe '.initialize' do
8
+ describe ".initialize" do
9
9
  subject { described_class.new(project) }
10
10
 
11
- it 'sets the project' do
11
+ it "sets the project" do
12
12
  expect(subject.project).to eq(project)
13
13
  end
14
14
 
15
- it 'sets the packager' do
15
+ it "sets the packager" do
16
16
  expect(subject.packager).to eq(packager)
17
17
  end
18
18
  end
19
19
 
20
20
  subject { described_class.new(project) }
21
21
 
22
- it 'inherits from Packager' do
22
+ it "inherits from Packager" do
23
23
  expect(subject).to be_a(Packager::Base)
24
24
  end
25
25
  end
@@ -1,27 +1,27 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Compressor::DMG do
5
5
  let(:project) do
6
6
  Project.new.tap do |project|
7
- project.name('project')
8
- project.homepage('https://example.com')
9
- project.install_dir('/opt/project')
10
- project.build_version('1.2.3')
11
- project.build_iteration('2')
12
- project.maintainer('Chef Software')
7
+ project.name("project")
8
+ project.homepage("https://example.com")
9
+ project.install_dir("/opt/project")
10
+ project.build_version("1.2.3")
11
+ project.build_iteration("2")
12
+ project.maintainer("Chef Software")
13
13
  end
14
14
  end
15
15
 
16
16
  subject { described_class.new(project) }
17
17
 
18
- let(:project_root) { File.join(tmp_path, 'project/root') }
19
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
20
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
18
+ let(:project_root) { File.join(tmp_path, "project/root") }
19
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
20
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
21
21
 
22
22
  before do
23
- allow(project).to receive(:packager)
24
- .and_return(Packager::PKG.new(project))
23
+ allow(project).to receive(:packagers_for_system)
24
+ .and_return([Packager::PKG.new(project)])
25
25
 
26
26
  Config.project_root(project_root)
27
27
  Config.package_dir(package_dir)
@@ -34,56 +34,56 @@ module Omnibus
34
34
  end
35
35
 
36
36
  describe '#window_bounds' do
37
- it 'is a DSL method' do
37
+ it "is a DSL method" do
38
38
  expect(subject).to have_exposed_method(:window_bounds)
39
39
  end
40
40
 
41
- it 'has a default value' do
42
- expect(subject.window_bounds).to eq('100, 100, 750, 600')
41
+ it "has a default value" do
42
+ expect(subject.window_bounds).to eq("100, 100, 750, 600")
43
43
  end
44
44
  end
45
45
 
46
46
  describe '#pkg_position' do
47
- it 'is a DSL method' do
47
+ it "is a DSL method" do
48
48
  expect(subject).to have_exposed_method(:pkg_position)
49
49
  end
50
50
 
51
- it 'has a default value' do
52
- expect(subject.pkg_position).to eq('535, 50')
51
+ it "has a default value" do
52
+ expect(subject.pkg_position).to eq("535, 50")
53
53
  end
54
54
  end
55
55
 
56
56
  describe '#id' do
57
- it 'is :dmg' do
57
+ it "is :dmg" do
58
58
  expect(subject.id).to eq(:dmg)
59
59
  end
60
60
  end
61
61
 
62
62
  describe '#resources_dir' do
63
- it 'is nested inside the staging_dir' do
63
+ it "is nested inside the staging_dir" do
64
64
  expect(subject.resources_dir).to eq("#{staging_dir}/Resources")
65
65
  end
66
66
  end
67
67
 
68
68
  describe '#clean_disks' do
69
- it 'logs a message' do
69
+ it "logs a message" do
70
70
  allow(subject).to receive(:shellout!)
71
- .and_return(double(Mixlib::ShellOut, stdout: ''))
71
+ .and_return(double(Mixlib::ShellOut, stdout: ""))
72
72
 
73
73
  output = capture_logging { subject.clean_disks }
74
- expect(output).to include('Cleaning previously mounted disks')
74
+ expect(output).to include("Cleaning previously mounted disks")
75
75
  end
76
76
  end
77
77
 
78
78
  describe '#create_writable_dmg' do
79
- it 'logs a message' do
79
+ it "logs a message" do
80
80
  output = capture_logging { subject.create_writable_dmg }
81
- expect(output).to include('Creating writable dmg')
81
+ expect(output).to include("Creating writable dmg")
82
82
  end
83
83
 
84
- it 'runs the hdiutil command' do
84
+ it "runs the hdiutil command" do
85
85
  expect(subject).to receive(:shellout!)
86
- .with <<-EOH.gsub(/^ {12}/, '')
86
+ .with <<-EOH.gsub(/^ {12}/, "")
87
87
  hdiutil create \\
88
88
  -srcfolder "#{staging_dir}/Resources" \\
89
89
  -volname "Project" \\
@@ -106,14 +106,14 @@ module Omnibus
106
106
 
107
107
  let(:shellout) { double(Mixlib::ShellOut, stdout: "hello\n") }
108
108
 
109
- it 'logs a message' do
109
+ it "logs a message" do
110
110
  output = capture_logging { subject.attach_dmg }
111
- expect(output).to include('Attaching dmg as disk')
111
+ expect(output).to include("Attaching dmg as disk")
112
112
  end
113
113
 
114
- it 'runs the hdiutil command' do
114
+ it "runs the hdiutil command" do
115
115
  expect(subject).to receive(:shellout!)
116
- .with <<-EOH.gsub(/^ {12}/, '')
116
+ .with <<-EOH.gsub(/^ {12}/, "")
117
117
  hdiutil attach \\
118
118
  -readwrite \\
119
119
  -noverify \\
@@ -124,22 +124,22 @@ module Omnibus
124
124
  subject.attach_dmg
125
125
  end
126
126
 
127
- it 'returns the stripped stdout' do
128
- expect(subject.attach_dmg).to eq('hello')
127
+ it "returns the stripped stdout" do
128
+ expect(subject.attach_dmg).to eq("hello")
129
129
  end
130
130
  end
131
131
 
132
132
  describe '#set_volume_icon' do
133
- it 'logs a message' do
133
+ it "logs a message" do
134
134
  output = capture_logging { subject.set_volume_icon }
135
- expect(output).to include('Setting volume icon')
135
+ expect(output).to include("Setting volume icon")
136
136
  end
137
137
 
138
- it 'runs the sips commands' do
139
- icon = subject.resource_path('icon.png')
138
+ it "runs the sips commands" do
139
+ icon = subject.resource_path("icon.png")
140
140
 
141
141
  expect(subject).to receive(:shellout!)
142
- .with <<-EOH.gsub(/^ {12}/, '')
142
+ .with <<-EOH.gsub(/^ {12}/, "")
143
143
  # Generate the icns
144
144
  mkdir tmp.iconset
145
145
  sips -z 16 16 #{icon} --out tmp.iconset/icon_16x16.png
@@ -166,42 +166,42 @@ module Omnibus
166
166
  end
167
167
 
168
168
  describe '#prettify_dmg' do
169
- it 'logs a message' do
169
+ it "logs a message" do
170
170
  output = capture_logging { subject.prettify_dmg }
171
- expect(output).to include('Making the dmg all pretty and stuff')
171
+ expect(output).to include("Making the dmg all pretty and stuff")
172
172
  end
173
173
 
174
- it 'renders the apple script template' do
174
+ it "renders the apple script template" do
175
175
  subject.prettify_dmg
176
176
  expect("#{staging_dir}/create_dmg.osascript").to be_a_file
177
177
  end
178
178
 
179
- it 'has the correct content' do
179
+ it "has the correct content" do
180
180
  subject.prettify_dmg
181
181
  contents = File.read("#{staging_dir}/create_dmg.osascript")
182
182
 
183
183
  expect(contents).to include('tell application "Finder"')
184
184
  expect(contents).to include(' tell disk "Project"')
185
- expect(contents).to include(' open')
186
- expect(contents).to include(' set current view of container window to icon view')
187
- expect(contents).to include(' set toolbar visible of container window to false')
188
- expect(contents).to include(' set statusbar visible of container window to false')
189
- expect(contents).to include(' set the bounds of container window to {100, 100, 750, 600}')
190
- expect(contents).to include(' set theViewOptions to the icon view options of container window')
191
- expect(contents).to include(' set arrangement of theViewOptions to not arranged')
192
- expect(contents).to include(' set icon size of theViewOptions to 72')
185
+ expect(contents).to include(" open")
186
+ expect(contents).to include(" set current view of container window to icon view")
187
+ expect(contents).to include(" set toolbar visible of container window to false")
188
+ expect(contents).to include(" set statusbar visible of container window to false")
189
+ expect(contents).to include(" set the bounds of container window to {100, 100, 750, 600}")
190
+ expect(contents).to include(" set theViewOptions to the icon view options of container window")
191
+ expect(contents).to include(" set arrangement of theViewOptions to not arranged")
192
+ expect(contents).to include(" set icon size of theViewOptions to 72")
193
193
  expect(contents).to include(' set background picture of theViewOptions to file ".support:background.png"')
194
- expect(contents).to include(' delay 5')
194
+ expect(contents).to include(" delay 5")
195
195
  expect(contents).to include(' set position of item "project-1.2.3-2.pkg" of container window to {535, 50}')
196
- expect(contents).to include(' update without registering applications')
197
- expect(contents).to include(' delay 5')
198
- expect(contents).to include(' end tell')
199
- expect(contents).to include('end tell')
196
+ expect(contents).to include(" update without registering applications")
197
+ expect(contents).to include(" delay 5")
198
+ expect(contents).to include(" end tell")
199
+ expect(contents).to include("end tell")
200
200
  end
201
201
 
202
- it 'runs the apple script' do
202
+ it "runs the apple script" do
203
203
  expect(subject).to receive(:shellout!)
204
- .with <<-EOH.gsub(/^ {12}/, '')
204
+ .with <<-EOH.gsub(/^ {12}/, "")
205
205
  osascript "#{staging_dir}/create_dmg.osascript"
206
206
  EOH
207
207
 
@@ -210,17 +210,17 @@ module Omnibus
210
210
  end
211
211
 
212
212
  describe '#compress_dmg' do
213
- it 'logs a message' do
213
+ it "logs a message" do
214
214
  output = capture_logging { subject.compress_dmg }
215
- expect(output).to include('Compressing dmg')
215
+ expect(output).to include("Compressing dmg")
216
216
  end
217
217
 
218
- it 'runs the magical command series' do
219
- device = '/dev/sda1'
218
+ it "runs the magical command series" do
219
+ device = "/dev/sda1"
220
220
  subject.instance_variable_set(:@device, device)
221
221
 
222
222
  expect(subject).to receive(:shellout!)
223
- .with <<-EOH.gsub(/^ {12}/, '')
223
+ .with <<-EOH.gsub(/^ {12}/, "")
224
224
  chmod -Rf go-w /Volumes/Project
225
225
  sync
226
226
  hdiutil detach "#{device}"
@@ -238,16 +238,16 @@ module Omnibus
238
238
  end
239
239
 
240
240
  describe '#set_dmg_icon' do
241
- it 'logs a message' do
241
+ it "logs a message" do
242
242
  output = capture_logging { subject.set_dmg_icon }
243
- expect(output).to include('Setting dmg icon')
243
+ expect(output).to include("Setting dmg icon")
244
244
  end
245
245
 
246
- it 'runs the sips commands' do
247
- icon = subject.resource_path('icon.png')
246
+ it "runs the sips commands" do
247
+ icon = subject.resource_path("icon.png")
248
248
 
249
249
  expect(subject).to receive(:shellout!)
250
- .with <<-EOH.gsub(/^ {12}/, '')
250
+ .with <<-EOH.gsub(/^ {12}/, "")
251
251
  # Convert the png to an icon
252
252
  sips -i "#{icon}"
253
253
 
@@ -267,12 +267,12 @@ module Omnibus
267
267
 
268
268
  describe '#package_name' do
269
269
  it 'reflects the packager\'s unmodified package_name' do
270
- expect(subject.package_name).to eq('project-1.2.3-2.dmg')
270
+ expect(subject.package_name).to eq("project-1.2.3-2.dmg")
271
271
  end
272
272
 
273
273
  it 'reflects the packager\'s modified package_name' do
274
- package_basename = 'projectsub-1.2.3-3'
275
- allow(project.packager).to receive(:package_name)
274
+ package_basename = "projectsub-1.2.3-3"
275
+ allow(project.packagers_for_system[0]).to receive(:package_name)
276
276
  .and_return("#{package_basename}.pkg")
277
277
 
278
278
  expect(subject.package_name).to eq("#{package_basename}.dmg")
@@ -280,19 +280,19 @@ module Omnibus
280
280
  end
281
281
 
282
282
  describe '#writable_dmg' do
283
- it 'is in the staging_dir' do
283
+ it "is in the staging_dir" do
284
284
  expect(subject.writable_dmg).to include(staging_dir)
285
285
  end
286
286
 
287
- it 'is project-writable' do
288
- expect(subject.writable_dmg).to include('project-writable.dmg')
287
+ it "is project-writable" do
288
+ expect(subject.writable_dmg).to include("project-writable.dmg")
289
289
  end
290
290
  end
291
291
 
292
292
  describe '#volume_name' do
293
- it 'is the project friendly_name' do
294
- project.friendly_name('Friendly Bacon Bits')
295
- expect(subject.volume_name).to eq('Friendly Bacon Bits')
293
+ it "is the project friendly_name" do
294
+ project.friendly_name("Friendly Bacon Bits")
295
+ expect(subject.volume_name).to eq("Friendly Bacon Bits")
296
296
  end
297
297
  end
298
298
  end
@@ -1,20 +1,20 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Compressor::Null do
5
5
  let(:packager) { double(Packager::Base) }
6
- let(:project) { double(Project, packager: packager) }
6
+ let(:project) { double(Project, packagers_for_system: [packager]) }
7
7
 
8
8
  subject { described_class.new(project) }
9
9
 
10
10
  describe '#id' do
11
- it 'is :dmg' do
11
+ it "is :dmg" do
12
12
  expect(subject.id).to eq(:null)
13
13
  end
14
14
  end
15
15
 
16
16
  describe '#run!' do
17
- it 'does nothing' do
17
+ it "does nothing" do
18
18
  expect(subject).to_not receive(:instance_eval)
19
19
  subject.run!
20
20
  end
@@ -1,31 +1,31 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Compressor::TGZ do
5
5
  let(:project) do
6
6
  Project.new.tap do |project|
7
- project.name('project')
8
- project.homepage('https://example.com')
9
- project.install_dir('/opt/project')
10
- project.build_version('1.2.3')
11
- project.build_iteration('2')
12
- project.maintainer('Chef Software')
7
+ project.name("project")
8
+ project.homepage("https://example.com")
9
+ project.install_dir("/opt/project")
10
+ project.build_version("1.2.3")
11
+ project.build_iteration("2")
12
+ project.maintainer("Chef Software")
13
13
  end
14
14
  end
15
15
 
16
16
  subject { described_class.new(project) }
17
17
 
18
- let(:project_root) { File.join(tmp_path, 'project/root') }
19
- let(:package_dir) { File.join(tmp_path, 'package/dir') }
20
- let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
18
+ let(:project_root) { File.join(tmp_path, "project/root") }
19
+ let(:package_dir) { File.join(tmp_path, "package/dir") }
20
+ let(:staging_dir) { File.join(tmp_path, "staging/dir") }
21
21
 
22
22
  before do
23
23
  create_directory(project_root)
24
24
  create_directory(package_dir)
25
25
  create_directory(staging_dir)
26
26
 
27
- allow(project).to receive(:packager)
28
- .and_return(Packager::PKG.new(project))
27
+ allow(project).to receive(:packagers_for_system)
28
+ .and_return([Packager::PKG.new(project)])
29
29
 
30
30
  Config.project_root(project_root)
31
31
  Config.package_dir(package_dir)
@@ -37,30 +37,30 @@ module Omnibus
37
37
  end
38
38
 
39
39
  describe '#package_name' do
40
- it 'returns the name of the packager' do
41
- expect(subject.package_name).to eq('project-1.2.3-2.pkg.tar.gz')
40
+ it "returns the name of the packager" do
41
+ expect(subject.package_name).to eq("project-1.2.3-2.pkg.tar.gz")
42
42
  end
43
43
  end
44
44
 
45
45
  describe '#write_tgz' do
46
46
  before do
47
- File.open("#{staging_dir}/project-1.2.3-2.pkg", 'wb') do |f|
48
- f.write " "*1_000_000
47
+ File.open("#{staging_dir}/project-1.2.3-2.pkg", "wb") do |f|
48
+ f.write " " * 1_000_000
49
49
  end
50
50
  end
51
51
 
52
- it 'generates the file' do
52
+ it "generates the file" do
53
53
  subject.write_tgz
54
54
  expect("#{staging_dir}/project-1.2.3-2.pkg.tar.gz").to be_a_file
55
55
  end
56
56
 
57
- it 'has the correct content' do
57
+ it "has the correct content" do
58
58
  subject.write_tgz
59
- file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz", 'rb')
59
+ file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz", "rb")
60
60
  contents = file.read
61
61
  file.close
62
62
 
63
- expect(contents).to include("\x1F\x8B\b\x00".force_encoding('ASCII-8BIT'))
63
+ expect(contents).to include("\x1F\x8B\b\x00".force_encoding("ASCII-8BIT"))
64
64
  end
65
65
  end
66
66
  end
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Config do
5
5
  subject { described_class.instance }
6
6
 
7
- it 'extends Util' do
7
+ it "extends Util" do
8
8
  expect(subject).to be_a(Util)
9
9
  end
10
10
 
@@ -16,7 +16,7 @@ module Omnibus
16
16
  allow(File).to receive(:expand_path) { |arg| arg }
17
17
  end
18
18
 
19
- shared_examples 'a configurable' do |id, default|
19
+ shared_examples "a configurable" do |id, default|
20
20
  it "responds to .#{id}" do
21
21
  expect(described_class).to respond_to(id)
22
22
  end
@@ -25,71 +25,72 @@ module Omnibus
25
25
  expect(described_class.send(id)).to eq(default)
26
26
  end
27
27
 
28
- it_behaves_like 'a cleanroom getter', id, default
29
- it_behaves_like 'a cleanroom setter', id, %|#{id}(#{default.inspect})|
28
+ it_behaves_like "a cleanroom getter", id, default
29
+ it_behaves_like "a cleanroom setter", id, %{#{id}(#{default.inspect})}
30
30
  end
31
31
 
32
- include_examples 'a configurable', :base_dir, '/var/cache/omnibus'
33
- include_examples 'a configurable', :cache_dir, '/var/cache/omnibus/cache'
34
- include_examples 'a configurable', :git_cache_dir, '/var/cache/omnibus/cache/git_cache'
35
- include_examples 'a configurable', :source_dir, '/var/cache/omnibus/src'
36
- include_examples 'a configurable', :build_dir, '/var/cache/omnibus/build'
37
- include_examples 'a configurable', :package_dir, '/var/cache/omnibus/pkg'
38
- include_examples 'a configurable', :project_root, Dir.pwd
39
- include_examples 'a configurable', :local_software_dirs, []
40
- include_examples 'a configurable', :software_gems, ['omnibus-software']
41
- include_examples 'a configurable', :solaris_linker_mapfile, 'files/mapfiles/solaris'
42
- include_examples 'a configurable', :append_timestamp, true
43
- include_examples 'a configurable', :build_retries, 0
44
- include_examples 'a configurable', :use_git_caching, true
45
- include_examples 'a configurable', :fetcher_read_timeout, 60
46
- include_examples 'a configurable', :fetcher_retries, 5
32
+ include_examples "a configurable", :base_dir, "/var/cache/omnibus"
33
+ include_examples "a configurable", :cache_dir, "/var/cache/omnibus/cache"
34
+ include_examples "a configurable", :git_cache_dir, "/var/cache/omnibus/cache/git_cache"
35
+ include_examples "a configurable", :source_dir, "/var/cache/omnibus/src"
36
+ include_examples "a configurable", :build_dir, "/var/cache/omnibus/build"
37
+ include_examples "a configurable", :package_dir, "/var/cache/omnibus/pkg"
38
+ include_examples "a configurable", :project_root, Dir.pwd
39
+ include_examples "a configurable", :local_software_dirs, []
40
+ include_examples "a configurable", :software_gems, ["omnibus-software"]
41
+ include_examples "a configurable", :solaris_linker_mapfile, "files/mapfiles/solaris"
42
+ include_examples "a configurable", :append_timestamp, true
43
+ include_examples "a configurable", :build_retries, 0
44
+ include_examples "a configurable", :use_git_caching, true
45
+ include_examples "a configurable", :fetcher_read_timeout, 60
46
+ include_examples "a configurable", :fetcher_retries, 5
47
+ include_examples "a configurable", :fatal_licensing_warnings, false
47
48
 
48
49
  describe '#workers' do
49
- context 'when the Ohai data is not present' do
50
+ context "when the Ohai data is not present" do
50
51
  before do
51
- stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
52
- data['cpu'] = nil
52
+ stub_ohai(platform: "ubuntu", version: "12.04") do |data|
53
+ data["cpu"] = nil
53
54
  end
54
55
  end
55
56
 
56
- it 'defaults to 3' do
57
+ it "defaults to 3" do
57
58
  expect(described_class.workers).to eq(3)
58
59
  end
59
60
  end
60
61
 
61
- context 'when the Ohai data is present' do
62
+ context "when the Ohai data is present" do
62
63
  before do
63
- stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
64
- data['cpu'] = { 'total' => '5' }
64
+ stub_ohai(platform: "ubuntu", version: "12.04") do |data|
65
+ data["cpu"] = { "total" => "5" }
65
66
  end
66
67
  end
67
68
 
68
- it 'defaults to the value + 6' do
69
+ it "defaults to the value + 6" do
69
70
  expect(described_class.workers).to eq(6)
70
71
  end
71
72
  end
72
73
  end
73
74
 
74
- context 'on Windows' do
75
- before { stub_ohai(platform: 'windows', version: '2012') }
75
+ context "on Windows" do
76
+ before { stub_ohai(platform: "windows", version: "2012") }
76
77
 
77
- include_examples 'a configurable', :base_dir, 'C:/omnibus-ruby'
78
- include_examples 'a configurable', :cache_dir, 'C:/omnibus-ruby/cache'
79
- include_examples 'a configurable', :git_cache_dir, 'C:/omnibus-ruby/cache/git_cache'
80
- include_examples 'a configurable', :source_dir, 'C:/omnibus-ruby/src'
81
- include_examples 'a configurable', :build_dir, 'C:/omnibus-ruby/build'
82
- include_examples 'a configurable', :package_dir, 'C:/omnibus-ruby/pkg'
78
+ include_examples "a configurable", :base_dir, "C:/omnibus-ruby"
79
+ include_examples "a configurable", :cache_dir, "C:/omnibus-ruby/cache"
80
+ include_examples "a configurable", :git_cache_dir, "C:/omnibus-ruby/cache/git_cache"
81
+ include_examples "a configurable", :source_dir, "C:/omnibus-ruby/src"
82
+ include_examples "a configurable", :build_dir, "C:/omnibus-ruby/build"
83
+ include_examples "a configurable", :package_dir, "C:/omnibus-ruby/pkg"
83
84
  end
84
85
 
85
- context 'when base_dir is changed' do
86
- before { described_class.base_dir('/foo/bar') }
86
+ context "when base_dir is changed" do
87
+ before { described_class.base_dir("/foo/bar") }
87
88
 
88
- include_examples 'a configurable', :cache_dir, '/foo/bar/cache'
89
- include_examples 'a configurable', :git_cache_dir, '/foo/bar/cache/git_cache'
90
- include_examples 'a configurable', :source_dir, '/foo/bar/src'
91
- include_examples 'a configurable', :build_dir, '/foo/bar/build'
92
- include_examples 'a configurable', :package_dir, '/foo/bar/pkg'
89
+ include_examples "a configurable", :cache_dir, "/foo/bar/cache"
90
+ include_examples "a configurable", :git_cache_dir, "/foo/bar/cache/git_cache"
91
+ include_examples "a configurable", :source_dir, "/foo/bar/src"
92
+ include_examples "a configurable", :build_dir, "/foo/bar/build"
93
+ include_examples "a configurable", :package_dir, "/foo/bar/pkg"
93
94
  end
94
95
  end
95
96
  end
@@ -1,37 +1,37 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Digestable do
5
- let(:path) { '/path/to/file' }
5
+ let(:path) { "/path/to/file" }
6
6
  let(:io) { StringIO.new }
7
7
 
8
8
  subject { Class.new { include Digestable }.new }
9
9
 
10
10
  describe '#digest' do
11
- it 'reads the IO in chunks' do
11
+ it "reads the IO in chunks" do
12
12
  expect(File).to receive(:open).with(path).and_yield(io)
13
- expect(subject.digest(path)).to eq('d41d8cd98f00b204e9800998ecf8427e')
13
+ expect(subject.digest(path)).to eq("d41d8cd98f00b204e9800998ecf8427e")
14
14
  end
15
15
  end
16
16
 
17
17
  describe '#digest_directory' do
18
- let(:path) { '/path/to/dir' }
18
+ let(:path) { "/path/to/dir" }
19
19
  let(:glob) { "#{path}/**/*" }
20
- let(:subdir) { '/path/to/dir/subdir' }
21
- let(:subfile) { '/path/to/dir/subfile' }
20
+ let(:subdir) { "/path/to/dir/subdir" }
21
+ let(:subfile) { "/path/to/dir/subfile" }
22
22
  let(:io) { StringIO.new }
23
23
 
24
- it 'inspects the file types of glob entries' do
24
+ it "inspects the file types of glob entries" do
25
25
  expect(FileSyncer).to receive(:glob).with(glob).and_return([subdir])
26
- expect(File).to receive(:ftype).with(subdir).and_return('directory')
27
- expect(subject.digest_directory(path)).to eq('8b91792e7917b1152d8494670caaeb85')
26
+ expect(File).to receive(:ftype).with(subdir).and_return("directory")
27
+ expect(subject.digest_directory(path)).to eq("8b91792e7917b1152d8494670caaeb85")
28
28
  end
29
29
 
30
- it 'inspects the contents of the files' do
30
+ it "inspects the contents of the files" do
31
31
  expect(FileSyncer).to receive(:glob).with(glob).and_return([subfile])
32
- expect(File).to receive(:ftype).with(subfile).and_return('file')
32
+ expect(File).to receive(:ftype).with(subfile).and_return("file")
33
33
  expect(File).to receive(:open).with(subfile).and_yield(io)
34
- expect(subject.digest_directory(path)).to eq('c8f023976b95ace2ae3678540fd3b4f1')
34
+ expect(subject.digest_directory(path)).to eq("c8f023976b95ace2ae3678540fd3b4f1")
35
35
  end
36
36
  end
37
37
  end