omnibus 5.4.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +8 -5
  5. data/README.md +3 -1
  6. data/Rakefile +20 -13
  7. data/appveyor.yml +4 -3
  8. data/bin/omnibus +3 -3
  9. data/features/commands/manifest.feature +19 -5
  10. data/features/step_definitions/generator_steps.rb +5 -6
  11. data/features/support/env.rb +4 -4
  12. data/lib/omnibus/build_version.rb +14 -14
  13. data/lib/omnibus/build_version_dsl.rb +3 -3
  14. data/lib/omnibus/builder.rb +50 -61
  15. data/lib/omnibus/changelog.rb +2 -2
  16. data/lib/omnibus/changelog_printer.rb +4 -4
  17. data/lib/omnibus/cleaner.rb +4 -4
  18. data/lib/omnibus/cli/base.rb +15 -15
  19. data/lib/omnibus/cli/cache.rb +13 -13
  20. data/lib/omnibus/cli/changelog.rb +8 -9
  21. data/lib/omnibus/cli/publish.rb +12 -13
  22. data/lib/omnibus/cli.rb +26 -27
  23. data/lib/omnibus/compressor.rb +6 -6
  24. data/lib/omnibus/compressors/base.rb +7 -2
  25. data/lib/omnibus/compressors/dmg.rb +12 -12
  26. data/lib/omnibus/compressors/null.rb +1 -1
  27. data/lib/omnibus/compressors/tgz.rb +8 -8
  28. data/lib/omnibus/config.rb +37 -26
  29. data/lib/omnibus/core_extensions/open_uri.rb +3 -3
  30. data/lib/omnibus/core_extensions.rb +1 -1
  31. data/lib/omnibus/digestable.rb +5 -4
  32. data/lib/omnibus/download_helpers.rb +7 -6
  33. data/lib/omnibus/exceptions.rb +29 -13
  34. data/lib/omnibus/fetcher.rb +0 -1
  35. data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
  36. data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
  37. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  38. data/lib/omnibus/file_syncer.rb +3 -3
  39. data/lib/omnibus/generator.rb +60 -47
  40. data/lib/omnibus/git_cache.rb +33 -22
  41. data/lib/omnibus/git_repository.rb +5 -5
  42. data/lib/omnibus/health_check.rb +122 -119
  43. data/lib/omnibus/instrumentation.rb +1 -1
  44. data/lib/omnibus/licensing.rb +348 -60
  45. data/lib/omnibus/logger.rb +12 -9
  46. data/lib/omnibus/logging.rb +1 -1
  47. data/lib/omnibus/manifest.rb +4 -4
  48. data/lib/omnibus/manifest_diff.rb +6 -7
  49. data/lib/omnibus/manifest_entry.rb +1 -1
  50. data/lib/omnibus/metadata.rb +36 -36
  51. data/lib/omnibus/ohai.rb +6 -7
  52. data/lib/omnibus/package.rb +1 -1
  53. data/lib/omnibus/packager.rb +37 -28
  54. data/lib/omnibus/packagers/appx.rb +86 -0
  55. data/lib/omnibus/packagers/base.rb +21 -18
  56. data/lib/omnibus/packagers/bff.rb +22 -24
  57. data/lib/omnibus/packagers/deb.rb +20 -20
  58. data/lib/omnibus/packagers/ips.rb +18 -17
  59. data/lib/omnibus/packagers/makeself.rb +7 -7
  60. data/lib/omnibus/packagers/msi.rb +38 -193
  61. data/lib/omnibus/packagers/pkg.rb +16 -16
  62. data/lib/omnibus/packagers/rpm.rb +53 -54
  63. data/lib/omnibus/packagers/solaris.rb +14 -14
  64. data/lib/omnibus/packagers/windows_base.rb +192 -0
  65. data/lib/omnibus/project.rb +45 -43
  66. data/lib/omnibus/publisher.rb +3 -3
  67. data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
  68. data/lib/omnibus/publishers/s3_publisher.rb +7 -7
  69. data/lib/omnibus/reports.rb +10 -10
  70. data/lib/omnibus/s3_cache.rb +7 -7
  71. data/lib/omnibus/s3_helpers.rb +8 -7
  72. data/lib/omnibus/semantic_version.rb +1 -1
  73. data/lib/omnibus/software.rb +131 -81
  74. data/lib/omnibus/sugarable.rb +10 -10
  75. data/lib/omnibus/templating.rb +5 -5
  76. data/lib/omnibus/thread_pool.rb +1 -1
  77. data/lib/omnibus/util.rb +5 -5
  78. data/lib/omnibus/version.rb +1 -1
  79. data/lib/omnibus.rb +65 -65
  80. data/omnibus.gemspec +34 -32
  81. data/resources/appx/AppxManifest.xml.erb +18 -0
  82. data/resources/appx/assets/clear.png +0 -0
  83. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
  84. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
  85. data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
  86. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
  87. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
  88. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
  89. data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
  90. data/spec/functional/builder_spec.rb +149 -150
  91. data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
  92. data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
  93. data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
  94. data/spec/functional/file_syncer_spec.rb +74 -74
  95. data/spec/functional/licensing_spec.rb +344 -35
  96. data/spec/functional/templating_spec.rb +17 -17
  97. data/spec/spec_helper.rb +20 -20
  98. data/spec/support/examples.rb +21 -15
  99. data/spec/support/file_helpers.rb +1 -1
  100. data/spec/support/git_helpers.rb +37 -37
  101. data/spec/support/matchers.rb +3 -3
  102. data/spec/support/ohai_helpers.rb +4 -4
  103. data/spec/support/path_helpers.rb +2 -2
  104. data/spec/support/shell_helpers.rb +2 -2
  105. data/spec/unit/build_version_dsl_spec.rb +5 -5
  106. data/spec/unit/build_version_spec.rb +63 -63
  107. data/spec/unit/builder_spec.rb +86 -70
  108. data/spec/unit/changelog_spec.rb +4 -4
  109. data/spec/unit/changelogprinter_spec.rb +130 -0
  110. data/spec/unit/cleanroom_spec.rb +11 -11
  111. data/spec/unit/compressor_spec.rb +16 -16
  112. data/spec/unit/compressors/base_spec.rb +6 -6
  113. data/spec/unit/compressors/dmg_spec.rb +76 -76
  114. data/spec/unit/compressors/null_spec.rb +4 -4
  115. data/spec/unit/compressors/tgz_spec.rb +20 -20
  116. data/spec/unit/config_spec.rb +44 -43
  117. data/spec/unit/digestable_spec.rb +13 -13
  118. data/spec/unit/fetcher_spec.rb +11 -12
  119. data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
  120. data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
  121. data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
  122. data/spec/unit/generator_spec.rb +38 -38
  123. data/spec/unit/git_cache_spec.rb +56 -54
  124. data/spec/unit/git_repository_spec.rb +2 -2
  125. data/spec/unit/health_check_spec.rb +40 -40
  126. data/spec/unit/library_spec.rb +35 -35
  127. data/spec/unit/manifest_diff_spec.rb +10 -11
  128. data/spec/unit/manifest_spec.rb +17 -17
  129. data/spec/unit/metadata_spec.rb +152 -152
  130. data/spec/unit/ohai_spec.rb +5 -5
  131. data/spec/unit/omnibus_spec.rb +31 -31
  132. data/spec/unit/package_spec.rb +20 -20
  133. data/spec/unit/packager_spec.rb +48 -42
  134. data/spec/unit/packagers/appx_spec.rb +165 -0
  135. data/spec/unit/packagers/base_spec.rb +34 -34
  136. data/spec/unit/packagers/bff_spec.rb +60 -60
  137. data/spec/unit/packagers/deb_spec.rb +71 -71
  138. data/spec/unit/packagers/ips_spec.rb +45 -45
  139. data/spec/unit/packagers/makeself_spec.rb +22 -22
  140. data/spec/unit/packagers/msi_spec.rb +141 -147
  141. data/spec/unit/packagers/pkg_spec.rb +59 -60
  142. data/spec/unit/packagers/rpm_spec.rb +125 -126
  143. data/spec/unit/packagers/solaris_spec.rb +52 -52
  144. data/spec/unit/project_spec.rb +137 -135
  145. data/spec/unit/publisher_spec.rb +70 -70
  146. data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
  147. data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
  148. data/spec/unit/s3_cacher_spec.rb +34 -34
  149. data/spec/unit/s3_helpers_spec.rb +6 -6
  150. data/spec/unit/semantic_version_spec.rb +2 -2
  151. data/spec/unit/software_spec.rb +346 -384
  152. data/spec/unit/sugarable_spec.rb +10 -10
  153. data/spec/unit/util_spec.rb +60 -60
  154. metadata +54 -6
  155. data/.rubocop.yml +0 -48
@@ -1,16 +1,16 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Builder do
5
5
  let(:software) do
6
6
  double(Software,
7
- name: 'chefdk',
7
+ name: "chefdk",
8
8
  install_dir: project_dir,
9
- project_dir: project_dir,
9
+ project_dir: project_dir
10
10
  )
11
11
  end
12
12
 
13
- let(:project_dir) { on_windows ? 'C:/opscode/chefdk' : '/opt/chefdk' }
13
+ let(:project_dir) { on_windows ? "C:/opscode/chefdk" : "/opt/chefdk" }
14
14
  let(:on_windows) { false }
15
15
  let(:msys_bash) { "C:\\opscode\\chefdk\\embedded\\msys\\1.0\\bin\\bash.exe" }
16
16
 
@@ -29,115 +29,115 @@ module Omnibus
29
29
  end
30
30
 
31
31
  describe '#command' do
32
- it 'is a DSL method' do
32
+ it "is a DSL method" do
33
33
  expect(subject).to have_exposed_method(:command)
34
34
  end
35
35
  end
36
36
 
37
37
  describe '#workers' do
38
- it 'is a DSL method' do
38
+ it "is a DSL method" do
39
39
  expect(subject).to have_exposed_method(:workers)
40
40
  end
41
41
  end
42
42
 
43
43
  describe '#ruby' do
44
- it 'is a DSL method' do
44
+ it "is a DSL method" do
45
45
  expect(subject).to have_exposed_method(:ruby)
46
46
  end
47
47
  end
48
48
 
49
49
  describe '#gem' do
50
- it 'is a DSL method' do
50
+ it "is a DSL method" do
51
51
  expect(subject).to have_exposed_method(:gem)
52
52
  end
53
53
  end
54
54
 
55
55
  describe '#bundle' do
56
- it 'is a DSL method' do
56
+ it "is a DSL method" do
57
57
  expect(subject).to have_exposed_method(:bundle)
58
58
  end
59
59
  end
60
60
 
61
61
  describe '#appbundle' do
62
- it 'is a DSL method' do
62
+ it "is a DSL method" do
63
63
  expect(subject).to have_exposed_method(:appbundle)
64
64
  end
65
65
  end
66
66
 
67
67
  describe '#block' do
68
- it 'is a DSL method' do
68
+ it "is a DSL method" do
69
69
  expect(subject).to have_exposed_method(:block)
70
70
  end
71
71
  end
72
72
 
73
73
  describe '#erb' do
74
- it 'is a DSL method' do
74
+ it "is a DSL method" do
75
75
  expect(subject).to have_exposed_method(:erb)
76
76
  end
77
77
  end
78
78
 
79
79
  describe '#mkdir' do
80
- it 'is a DSL method' do
80
+ it "is a DSL method" do
81
81
  expect(subject).to have_exposed_method(:mkdir)
82
82
  end
83
83
  end
84
84
 
85
85
  describe '#touch' do
86
- it 'is a DSL method' do
86
+ it "is a DSL method" do
87
87
  expect(subject).to have_exposed_method(:touch)
88
88
  end
89
89
  end
90
90
 
91
91
  describe '#delete' do
92
- it 'is a DSL method' do
92
+ it "is a DSL method" do
93
93
  expect(subject).to have_exposed_method(:delete)
94
94
  end
95
95
  end
96
96
 
97
97
  describe '#copy' do
98
- it 'is a DSL method' do
98
+ it "is a DSL method" do
99
99
  expect(subject).to have_exposed_method(:copy)
100
100
  end
101
101
  end
102
102
 
103
103
  describe '#move' do
104
- it 'is a DSL method' do
104
+ it "is a DSL method" do
105
105
  expect(subject).to have_exposed_method(:move)
106
106
  end
107
107
  end
108
108
 
109
109
  describe '#link' do
110
- it 'is a DSL method' do
110
+ it "is a DSL method" do
111
111
  expect(subject).to have_exposed_method(:link)
112
112
  end
113
113
  end
114
114
 
115
115
  describe '#sync' do
116
- it 'is a DSL method' do
116
+ it "is a DSL method" do
117
117
  expect(subject).to have_exposed_method(:sync)
118
118
  end
119
119
  end
120
120
 
121
121
  describe '#update_config_guess' do
122
- it 'is a DSL method' do
122
+ it "is a DSL method" do
123
123
  expect(subject).to have_exposed_method(:update_config_guess)
124
124
  end
125
125
  end
126
126
 
127
127
  describe '#windows_safe_path' do
128
- it 'is a DSL method' do
128
+ it "is a DSL method" do
129
129
  expect(subject).to have_exposed_method(:windows_safe_path)
130
130
  end
131
131
  end
132
132
 
133
133
  describe '#project_dir' do
134
- it 'is a DSL method' do
134
+ it "is a DSL method" do
135
135
  expect(subject).to have_exposed_method(:project_dir)
136
136
  end
137
137
  end
138
138
 
139
139
  describe '#install_dir' do
140
- it 'is a DSL method' do
140
+ it "is a DSL method" do
141
141
  expect(subject).to have_exposed_method(:install_dir)
142
142
  end
143
143
  end
@@ -147,60 +147,60 @@ module Omnibus
147
147
  allow(subject).to receive(:command)
148
148
  end
149
149
 
150
- it 'is a DSL method' do
150
+ it "is a DSL method" do
151
151
  expect(subject).to have_exposed_method(:make)
152
152
  end
153
153
 
154
- context 'when :bin is present' do
155
- it 'uses the custom bin' do
154
+ context "when :bin is present" do
155
+ it "uses the custom bin" do
156
156
  expect(subject).to receive(:command)
157
- .with('/path/to/make', in_msys_bash: true)
158
- subject.make(bin: '/path/to/make')
157
+ .with("/path/to/make", in_msys_bash: true)
158
+ subject.make(bin: "/path/to/make")
159
159
  end
160
160
  end
161
161
 
162
- context 'when gmake is present' do
162
+ context "when gmake is present" do
163
163
  before do
164
164
  allow(Omnibus).to receive(:which)
165
- .with('gmake')
166
- .and_return('/bin/gmake')
165
+ .with("gmake")
166
+ .and_return("/bin/gmake")
167
167
  end
168
168
 
169
- it 'uses gmake and sets MAKE=gmake' do
169
+ it "uses gmake and sets MAKE=gmake" do
170
170
  expect(subject).to receive(:command)
171
- .with('gmake', env: { 'MAKE' => 'gmake' }, in_msys_bash: true)
171
+ .with("gmake", env: { "MAKE" => "gmake" }, in_msys_bash: true)
172
172
  subject.make
173
173
  end
174
174
  end
175
175
 
176
- context 'when gmake is not present' do
176
+ context "when gmake is not present" do
177
177
  before do
178
178
  allow(Omnibus).to receive(:which)
179
179
  .and_return(nil)
180
180
  end
181
181
 
182
- it 'uses make' do
182
+ it "uses make" do
183
183
  expect(subject).to receive(:command)
184
- .with('make', in_msys_bash: true)
184
+ .with("make", in_msys_bash: true)
185
185
  subject.make
186
186
  end
187
187
  end
188
188
 
189
- it 'accepts 0 options' do
189
+ it "accepts 0 options" do
190
190
  expect(subject).to receive(:command)
191
- .with('make', in_msys_bash: true)
191
+ .with("make", in_msys_bash: true)
192
192
  expect { subject.make }.to_not raise_error
193
193
  end
194
194
 
195
- it 'accepts an additional command string' do
195
+ it "accepts an additional command string" do
196
196
  expect(subject).to receive(:command)
197
- .with('make install', in_msys_bash: true)
198
- expect { subject.make('install') }.to_not raise_error
197
+ .with("make install", in_msys_bash: true)
198
+ expect { subject.make("install") }.to_not raise_error
199
199
  end
200
200
 
201
- it 'persists given options' do
201
+ it "persists given options" do
202
202
  expect(subject).to receive(:command)
203
- .with('make', timeout: 3600, in_msys_bash: true)
203
+ .with("make", timeout: 3600, in_msys_bash: true)
204
204
  subject.make(timeout: 3600)
205
205
  end
206
206
  end
@@ -210,11 +210,11 @@ module Omnibus
210
210
  allow(subject).to receive(:command)
211
211
  end
212
212
 
213
- it 'is a DSL method' do
213
+ it "is a DSL method" do
214
214
  expect(subject).to have_exposed_method(:configure)
215
215
  end
216
216
 
217
- context 'on 64-bit windows' do
217
+ context "on 64-bit windows" do
218
218
  let(:on_windows) { true }
219
219
  let(:windows_i386) { false }
220
220
 
@@ -223,48 +223,64 @@ module Omnibus
223
223
  .and_return(windows_i386)
224
224
  end
225
225
 
226
- it 'invokes appends platform host to the options' do
226
+ it "appends platform host to the options" do
227
227
  expect(subject).to receive(:command)
228
- .with("./configure --host=x86_64-w64-mingw32 --prefix=#{project_dir}/embedded", in_msys_bash: true)
228
+ .with("./configure --build=x86_64-w64-mingw32 --prefix=#{project_dir}/embedded", in_msys_bash: true)
229
229
  subject.configure()
230
230
  end
231
231
  end
232
232
 
233
- context 'when :bin is present' do
234
- it 'uses the custom bin' do
233
+ context "on 32-bit windows" do
234
+ let(:on_windows) { true }
235
+ let(:windows_i386) { true }
236
+
237
+ before do
238
+ allow(subject).to receive(:windows_arch_i386?)
239
+ .and_return(windows_i386)
240
+ end
241
+
242
+ it "appends platform host to the options" do
243
+ expect(subject).to receive(:command)
244
+ .with("./configure --build=i686-w64-mingw32 --prefix=#{project_dir}/embedded", in_msys_bash: true)
245
+ subject.configure()
246
+ end
247
+ end
248
+
249
+ context "when :bin is present" do
250
+ it "uses the custom bin" do
235
251
  expect(subject).to receive(:command)
236
252
  .with("/path/to/configure --prefix=#{project_dir}/embedded", in_msys_bash: true)
237
- subject.configure(bin: '/path/to/configure')
253
+ subject.configure(bin: "/path/to/configure")
238
254
  end
239
255
  end
240
256
 
241
- context 'when :prefix is present' do
242
- it 'emits non-empty prefix' do
257
+ context "when :prefix is present" do
258
+ it "emits non-empty prefix" do
243
259
  expect(subject).to receive(:command)
244
260
  .with("./configure --prefix=/some/prefix", in_msys_bash: true)
245
- subject.configure(prefix: '/some/prefix')
261
+ subject.configure(prefix: "/some/prefix")
246
262
  end
247
263
 
248
- it 'omits prefix if empty' do
264
+ it "omits prefix if empty" do
249
265
  expect(subject).to receive(:command)
250
266
  .with("./configure", in_msys_bash: true)
251
- subject.configure(prefix: '')
267
+ subject.configure(prefix: "")
252
268
  end
253
269
  end
254
270
 
255
- it 'accepts 0 options' do
271
+ it "accepts 0 options" do
256
272
  expect(subject).to receive(:command)
257
273
  .with("./configure --prefix=#{project_dir}/embedded", in_msys_bash: true)
258
274
  expect { subject.configure }.to_not raise_error
259
275
  end
260
276
 
261
- it 'accepts an additional command string' do
277
+ it "accepts an additional command string" do
262
278
  expect(subject).to receive(:command)
263
279
  .with("./configure --prefix=#{project_dir}/embedded --myopt", in_msys_bash: true)
264
- expect { subject.configure('--myopt') }.to_not raise_error
280
+ expect { subject.configure("--myopt") }.to_not raise_error
265
281
  end
266
282
 
267
- it 'persists given options' do
283
+ it "persists given options" do
268
284
  expect(subject).to receive(:command)
269
285
  .with("./configure --prefix=#{project_dir}/embedded", timeout: 3600, in_msys_bash: true)
270
286
  subject.configure(timeout: 3600)
@@ -274,39 +290,39 @@ module Omnibus
274
290
  describe '#patch' do
275
291
  before do
276
292
  allow(subject).to receive(:find_file)
277
- .with('config/patches', 'good_patch')
293
+ .with("config/patches", "good_patch")
278
294
  .and_return(
279
295
  [ ["#{project_dir}/patch_location1/good_patch", "#{project_dir}/patch_location2/good_patch"],
280
296
  "#{project_dir}/patch_location2/good_patch" ])
281
297
  end
282
298
 
283
- it 'is a DSL method' do
299
+ it "is a DSL method" do
284
300
  expect(subject).to have_exposed_method(:patch)
285
301
  end
286
302
 
287
- it 'invokes patch with patch level 1 unless specified' do
288
- expect { subject.patch(source: 'good_patch') }.to_not raise_error
303
+ it "invokes patch with patch level 1 unless specified" do
304
+ expect { subject.patch(source: "good_patch") }.to_not raise_error
289
305
  expect(subject).to receive(:shellout!)
290
306
  .with("patch -p1 -i #{project_dir}/patch_location2/good_patch", in_msys_bash: true)
291
307
  run_build_command
292
308
  end
293
309
 
294
- it 'invokes patch with patch level provided' do
295
- expect { subject.patch(source: 'good_patch', plevel: 0) }.to_not raise_error
310
+ it "invokes patch with patch level provided" do
311
+ expect { subject.patch(source: "good_patch", plevel: 0) }.to_not raise_error
296
312
  expect(subject).to receive(:shellout!)
297
313
  .with("patch -p0 -i #{project_dir}/patch_location2/good_patch", in_msys_bash: true)
298
314
  run_build_command
299
315
  end
300
316
 
301
- it 'invokes patch differently if target is provided' do
302
- expect { subject.patch(source: 'good_patch', target: 'target/path') }.to_not raise_error
317
+ it "invokes patch differently if target is provided" do
318
+ expect { subject.patch(source: "good_patch", target: "target/path") }.to_not raise_error
303
319
  expect(subject).to receive(:shellout!)
304
320
  .with("cat #{project_dir}/patch_location2/good_patch | patch -p1 target/path", in_msys_bash: true)
305
321
  run_build_command
306
322
  end
307
323
 
308
- it 'persists other options' do
309
- expect { subject.patch(source: 'good_patch', timeout:3600) }.to_not raise_error
324
+ it "persists other options" do
325
+ expect { subject.patch(source: "good_patch", timeout: 3600) }.to_not raise_error
310
326
  expect(subject).to receive(:shellout!)
311
327
  .with("patch -p1 -i #{project_dir}/patch_location2/good_patch", timeout: 3600, in_msys_bash: true)
312
328
  run_build_command
@@ -327,7 +343,7 @@ module Omnibus
327
343
 
328
344
  let(:software) do
329
345
  double(Software,
330
- name: 'chefdk',
346
+ name: "chefdk",
331
347
  install_dir: tmp_dir,
332
348
  project_dir: tmp_dir,
333
349
  overridden?: false)
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe ChangeLog do
@@ -18,7 +18,7 @@ module Omnibus
18
18
  repo = double(GitRepository, :commit_messages => ["ChangeLog-Entry: foobar\n",
19
19
  "ChangeLog-Entry: wombat\n"])
20
20
  changelog = ChangeLog.new("0.0.1", "0.0.2", repo)
21
- expect(changelog.changelog_entries).to eq(["foobar\n", "wombat\n"])
21
+ expect(changelog.changelog_entries).to eq(%W{foobar\n wombat\n})
22
22
  end
23
23
 
24
24
  it "returns an empty array if there were no changelog entries" do
@@ -28,13 +28,13 @@ module Omnibus
28
28
  end
29
29
 
30
30
  it "does not return git messages without a ChangeLog: tag" do
31
- repo = double(GitRepository, :commit_messages => ["foobar\n", "wombat\n"])
31
+ repo = double(GitRepository, :commit_messages => %W{foobar\n wombat\n})
32
32
  changelog = ChangeLog.new("0.0.1", "0.0.2", repo)
33
33
  expect(changelog.changelog_entries).to eq([])
34
34
  end
35
35
 
36
36
  it "does not return blank lines" do
37
- repo = double(GitRepository, :commit_messages => ["\n", "\n"])
37
+ repo = double(GitRepository, :commit_messages => %W{\n \n})
38
38
  changelog = ChangeLog.new("0.0.1", "0.0.2", repo)
39
39
  expect(changelog.changelog_entries).to eq([])
40
40
  end
@@ -0,0 +1,130 @@
1
+ require "spec_helper"
2
+ require "omnibus/changelog_printer"
3
+ require "omnibus/manifest_diff"
4
+
5
+ module Omnibus
6
+ describe ChangeLogPrinter do
7
+ describe "#print" do
8
+ def manifest_entry_for(name, dv, lv, source_type = :local)
9
+ Omnibus::ManifestEntry.new(name, { :described_version => dv,
10
+ :locked_version => lv,
11
+ :locked_source => {
12
+ :git => "git://#{name}@example.com" },
13
+ :source_type => source_type,
14
+ })
15
+ end
16
+
17
+ let(:changelog) { double(ChangeLog,
18
+ changelog_entries: %w{entry1 entry2},
19
+ authors: %w{alice bob}) }
20
+ let(:git_changelog) { double(ChangeLog,
21
+ changelog_entries:
22
+ %w{sub-entry1 sub-entry2}) }
23
+ let(:now) { double(Time) }
24
+ let(:emptydiff) { EmptyManifestDiff.new }
25
+ let(:old_manifest) {
26
+ m = Manifest.new()
27
+ m.add("updated-comp", manifest_entry_for("updated-comp", "v9", "v9"))
28
+ m.add("updated-comp-2", manifest_entry_for("updated-comp-2", "someref0", "someref0", :git))
29
+ m.add("removed-comp", manifest_entry_for("removed-comp", "v9", "v9"))
30
+ m.add("removed-comp-2", manifest_entry_for("removed-comp-2", "v10", "v10"))
31
+ m
32
+ }
33
+ let(:new_manifest) {
34
+ m = Manifest.new()
35
+ m.add("updated-comp", manifest_entry_for("updated-comp", "v10", "v10"))
36
+ m.add("updated-comp-2", manifest_entry_for("updated-comp-2", "someotherref", "someotherref", :git))
37
+ m.add("added-comp", manifest_entry_for("added-comp", "v100", "v100"))
38
+ m.add("added-comp-2", manifest_entry_for("added-comp-2", "v101", "v101"))
39
+ m
40
+ }
41
+ let(:diff) { ManifestDiff.new(old_manifest, new_manifest) }
42
+
43
+ it "starts with a changelog version header including the time" do
44
+ expect(Time).to receive(:now).and_return(now)
45
+ expect(now).to receive(:strftime).with("%Y-%m-%d")
46
+ .and_return("1970-01-01")
47
+
48
+ expect { ChangeLogPrinter.new(changelog, diff).print("v1.0.1") }
49
+ .to output(/## v1\.0\.1 \(1970-01-01\)/).to_stdout
50
+ end
51
+
52
+ it "outputs the list of changelog entries" do
53
+ [ /entry1/, /entry2/ ].each do |re|
54
+ expect { ChangeLogPrinter.new(changelog, diff).print("v1") }
55
+ .to output(re).to_stdout
56
+ end
57
+ end
58
+
59
+ it "outputs the component sections when there are changes" do
60
+ expect { ChangeLogPrinter.new(changelog, diff).print("v1") }
61
+ .to output(/### Components/).to_stdout
62
+ end
63
+
64
+ it "does not output a component sections when there are no changes" do
65
+ expect { ChangeLogPrinter.new(changelog, emptydiff).print("v1") }
66
+ .not_to output(/### Components/).to_stdout
67
+ end
68
+
69
+ it "outputs the list of new components" do
70
+ [
71
+ /New Components/,
72
+ /added-comp \(v100\)/,
73
+ /added-comp-2 \(v101\)/,
74
+ ].each do |re|
75
+ expect { ChangeLogPrinter.new(changelog, diff).print("v1") }
76
+ .to output(re).to_stdout
77
+ end
78
+ end
79
+
80
+ it "outputs the list of updated components" do
81
+ source_path = "path/to/source/"
82
+ allow(File).to receive(:directory?).with("#{source_path}updated-comp-2/.git")
83
+ .and_return(false)
84
+
85
+ [ /Updated Components/,
86
+ /updated-comp \(v9 -> v10\)/,
87
+ /updated-comp-2 \(someref0 -> someothe\)/,
88
+ ].each do |re|
89
+ expect { ChangeLogPrinter.new(changelog, diff, source_path).print("v1") }
90
+ .to output(re).to_stdout
91
+ end
92
+ end
93
+
94
+ it "uses git commit log for components in git repositories" do
95
+ git_repo = double(GitRepository)
96
+ source_path = "path/to/source/"
97
+ allow(File).to receive(:directory?).with("#{source_path}updated-comp-2/.git")
98
+ .and_return(true)
99
+ allow(GitRepository).to receive(:new).with("#{source_path}updated-comp-2")
100
+ .and_return(git_repo)
101
+ allow(ChangeLog).to receive(:new).with("someref0", "someotherref", git_repo)
102
+ .and_return(git_changelog)
103
+
104
+ [ / \* sub-entry1/,
105
+ / \* sub-entry2/,
106
+ ].each do |re|
107
+ expect { ChangeLogPrinter.new(changelog, diff, source_path).print("v1") }
108
+ .to output(re).to_stdout
109
+ end
110
+ end
111
+
112
+ it "outputs the list of removed components" do
113
+ [ /Removed Components/,
114
+ /removed-comp \(v9\)/,
115
+ /removed-comp-2 \(v10\)/,
116
+ ].each do |re|
117
+ expect { ChangeLogPrinter.new(changelog, diff).print("v1") }
118
+ .to output(re).to_stdout
119
+ end
120
+ end
121
+
122
+ it "outputs the list of contributors" do
123
+ [ /### Contributors/, /alice/, /bob/ ].each do |re|
124
+ expect { ChangeLogPrinter.new(changelog, diff).print("v1") }
125
+ .to output(re).to_stdout
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Cleanroom do
@@ -18,43 +18,43 @@ module Omnibus
18
18
  let(:instance) { klass.new }
19
19
 
20
20
  describe '#evaluate' do
21
- it 'exposes public methods' do
21
+ it "exposes public methods" do
22
22
  expect {
23
- instance.evaluate('exposed_method')
23
+ instance.evaluate("exposed_method")
24
24
  }.to_not raise_error
25
25
  end
26
26
 
27
- it 'calls exposed methods on the instance' do
28
- instance.evaluate('exposed_method')
27
+ it "calls exposed methods on the instance" do
28
+ instance.evaluate("exposed_method")
29
29
  expect(instance.instance_variable_get(:@called)).to be_truthy
30
30
  end
31
31
 
32
- it 'does not expose unexposed methods' do
32
+ it "does not expose unexposed methods" do
33
33
  expect {
34
- instance.evaluate('unexposed_method')
34
+ instance.evaluate("unexposed_method")
35
35
  }.to raise_error(NameError)
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#evaluate_file' do
40
40
  let(:contents) do
41
- <<-EOH.gsub(/^ {10}/, '')
41
+ <<-EOH.gsub(/^ {10}/, "")
42
42
  exposed_method
43
43
  EOH
44
44
  end
45
45
 
46
- let(:filepath) { File.join(tmp_path, '/file/path') }
46
+ let(:filepath) { File.join(tmp_path, "/file/path") }
47
47
 
48
48
  before do
49
49
  allow(IO).to receive(:read).and_call_original
50
50
  allow(IO).to receive(:read).with(filepath).and_return(contents)
51
51
  end
52
52
 
53
- it 'evaluates the file and exposes public methods' do
53
+ it "evaluates the file and exposes public methods" do
54
54
  expect { instance.evaluate_file(filepath) }.to_not raise_error
55
55
  end
56
56
 
57
- it 'calls exposed methods on the instance' do
57
+ it "calls exposed methods on the instance" do
58
58
  instance.evaluate_file(filepath)
59
59
  expect(instance.instance_variable_get(:@called)).to be_truthy
60
60
  end
@@ -1,41 +1,41 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Compressor do
5
- describe '.for_current_system' do
6
- context 'on Mac OS X' do
7
- before { stub_ohai(platform: 'mac_os_x', version: '10.9.2') }
5
+ describe ".for_current_system" do
6
+ context "on Mac OS X" do
7
+ before { stub_ohai(platform: "mac_os_x", version: "10.9.2") }
8
8
 
9
- context 'when :dmg is activated' do
10
- it 'prefers dmg' do
9
+ context "when :dmg is activated" do
10
+ it "prefers dmg" do
11
11
  expect(described_class.for_current_system([:tgz, :dmg])).to eq(Compressor::DMG)
12
12
  end
13
13
  end
14
14
 
15
- context 'when :dmg is not activated' do
16
- it 'prefers tgz' do
15
+ context "when :dmg is not activated" do
16
+ it "prefers tgz" do
17
17
  expect(described_class.for_current_system([:tgz, :foo])).to eq(Compressor::TGZ)
18
18
  end
19
19
  end
20
20
 
21
- context 'when nothing is given' do
22
- it 'returns null' do
21
+ context "when nothing is given" do
22
+ it "returns null" do
23
23
  expect(described_class.for_current_system([])).to eq(Compressor::Null)
24
24
  end
25
25
  end
26
26
  end
27
27
 
28
- context 'on Ubuntu' do
29
- before { stub_ohai(platform: 'ubuntu', version: '14.04') }
28
+ context "on Ubuntu" do
29
+ before { stub_ohai(platform: "ubuntu", version: "14.04") }
30
30
 
31
- context 'when :tgz activated' do
32
- it 'prefers tgz' do
31
+ context "when :tgz activated" do
32
+ it "prefers tgz" do
33
33
  expect(described_class.for_current_system([:tgz, :foo])).to eq(Compressor::TGZ)
34
34
  end
35
35
  end
36
36
 
37
- context 'when nothing is given' do
38
- it 'returns null' do
37
+ context "when nothing is given" do
38
+ it "returns null" do
39
39
  expect(described_class.for_current_system([])).to eq(Compressor::Null)
40
40
  end
41
41
  end