omnibus 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +26 -0
  5. data/Gemfile +3 -0
  6. data/MAINTAINERS.md +1 -0
  7. data/appveyor.yml +1 -1
  8. data/bin/omnibus +5 -0
  9. data/lib/omnibus/builder.rb +165 -26
  10. data/lib/omnibus/digestable.rb +4 -2
  11. data/lib/omnibus/fetcher.rb +18 -5
  12. data/lib/omnibus/fetchers/git_fetcher.rb +38 -22
  13. data/lib/omnibus/fetchers/net_fetcher.rb +106 -37
  14. data/lib/omnibus/fetchers/path_fetcher.rb +13 -12
  15. data/lib/omnibus/file_syncer.rb +33 -14
  16. data/lib/omnibus/generator_files/README.md.erb +1 -1
  17. data/lib/omnibus/generator_files/package_scripts/postinst.erb +3 -3
  18. data/lib/omnibus/generator_files/package_scripts/postrm.erb +1 -1
  19. data/lib/omnibus/generator_files/package_scripts/preinst.erb +1 -1
  20. data/lib/omnibus/generator_files/package_scripts/prerm.erb +3 -3
  21. data/lib/omnibus/git_cache.rb +20 -7
  22. data/lib/omnibus/health_check.rb +144 -12
  23. data/lib/omnibus/packagers/bff.rb +57 -5
  24. data/lib/omnibus/packagers/deb.rb +2 -2
  25. data/lib/omnibus/packagers/pkg.rb +2 -2
  26. data/lib/omnibus/packagers/solaris.rb +18 -6
  27. data/lib/omnibus/project.rb +1 -1
  28. data/lib/omnibus/s3_cache.rb +8 -2
  29. data/lib/omnibus/software.rb +152 -18
  30. data/lib/omnibus/sugarable.rb +1 -5
  31. data/lib/omnibus/util.rb +1 -1
  32. data/lib/omnibus/version.rb +1 -1
  33. data/omnibus.gemspec +4 -1
  34. data/resources/bff/config.erb +7 -0
  35. data/resources/deb/md5sums.erb +1 -1
  36. data/spec/functional/builder_spec.rb +89 -2
  37. data/spec/functional/fetchers/git_fetcher_spec.rb +44 -37
  38. data/spec/functional/fetchers/net_fetcher_spec.rb +36 -5
  39. data/spec/functional/fetchers/path_fetcher_spec.rb +28 -28
  40. data/spec/unit/builder_spec.rb +143 -11
  41. data/spec/unit/fetchers/git_fetcher_spec.rb +23 -59
  42. data/spec/unit/fetchers/net_fetcher_spec.rb +151 -63
  43. data/spec/unit/fetchers/path_fetcher_spec.rb +4 -35
  44. data/spec/unit/git_cache_spec.rb +13 -14
  45. data/spec/unit/health_check_spec.rb +90 -0
  46. data/spec/unit/library_spec.rb +1 -1
  47. data/spec/unit/packagers/bff_spec.rb +126 -3
  48. data/spec/unit/packagers/deb_spec.rb +8 -3
  49. data/spec/unit/packagers/pkg_spec.rb +19 -19
  50. data/spec/unit/packagers/solaris_spec.rb +13 -1
  51. data/spec/unit/software_spec.rb +242 -38
  52. metadata +7 -6
  53. data/lib/omnibus/generator_files/package_scripts/makeselfinst.erb +0 -0
@@ -116,6 +116,12 @@ module Omnibus
116
116
 
117
117
  before do
118
118
  allow(subject).to receive(:shellout!)
119
+ File.open("#{staging_dir}/files", "w+") do |f|
120
+ f.write <<-EOF
121
+ /foo/bar/baz
122
+ /a file with spaces
123
+ EOF
124
+ end
119
125
  end
120
126
 
121
127
  it 'creates the prototype file' do
@@ -135,11 +141,17 @@ module Omnibus
135
141
  expect(subject).to receive(:shellout!)
136
142
  .with("cd /opt && find project -print > #{File.join(staging_dir, 'files')}")
137
143
  expect(subject).to receive(:shellout!)
138
- .with("cd /opt && pkgproto < #{File.join(staging_dir, 'files')} > #{File.join(staging_dir, 'Prototype.files')}")
144
+ .with("cd /opt && pkgproto < #{File.join(staging_dir, 'files.clean')} > #{File.join(staging_dir, 'Prototype.files')}")
139
145
  expect(subject).to receive(:shellout!)
140
146
  .with("awk '{ $5 = \"root\"; $6 = \"root\"; print }' < #{File.join(staging_dir, 'Prototype.files')} >> #{File.join(staging_dir, 'Prototype')}")
147
+ subject.write_prototype_file
148
+ end
141
149
 
150
+ it 'strips out the file with spaces from files.clean' do
142
151
  subject.write_prototype_file
152
+ contents = File.read(File.join(staging_dir, 'files.clean'))
153
+ expect(contents).not_to include("a file with spaces")
154
+ expect(contents).to include("/foo/bar/baz")
143
155
  end
144
156
  end
145
157
 
@@ -9,19 +9,32 @@ module Omnibus
9
9
  end
10
10
  end
11
11
 
12
+ let(:source) do
13
+ {
14
+ url: 'http://example.com/',
15
+ md5: 'abcd1234'
16
+ }
17
+ end
18
+
19
+ let(:rel_path) { 'software' }
20
+
12
21
  subject do
22
+ local_source = source
23
+ local_rel_path = rel_path
24
+
13
25
  described_class.new(project).evaluate do
14
26
  name 'software'
15
27
  default_version '1.2.3'
16
28
 
17
- source url: 'http://example.com/',
18
- md5: 'abcd1234'
29
+ source local_source
30
+ relative_path local_rel_path
19
31
  end
20
32
  end
21
33
 
22
34
  it_behaves_like 'a cleanroom getter', :project
23
35
  it_behaves_like 'a cleanroom setter', :name, %|name 'libxml2'|
24
36
  it_behaves_like 'a cleanroom setter', :description, %|description 'The XML magician'|
37
+ it_behaves_like 'a cleanroom setter', :maintainer, %|maintainer 'Captain Jack <sparrow@chef.io>'|
25
38
  it_behaves_like 'a cleanroom setter', :dependency, %|dependency 'libxslt'|
26
39
  it_behaves_like 'a cleanroom setter', :source, %|source url: 'https://source.example.com'|
27
40
  it_behaves_like 'a cleanroom setter', :default_version, %|default_version '1.2.3'|
@@ -50,9 +63,9 @@ module Omnibus
50
63
  it "sets the defaults" do
51
64
  expect(subject.with_standard_compiler_flags).to eq(
52
65
  'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
53
- 'CFLAGS' => '-I/opt/project/embedded/include',
54
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
55
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
66
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
67
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
68
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
56
69
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
57
70
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
58
71
  )
@@ -60,9 +73,9 @@ module Omnibus
60
73
  it 'overrides LDFLAGS' do
61
74
  expect(subject.with_standard_compiler_flags('LDFLAGS' => 'foo')).to eq(
62
75
  'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
63
- 'CFLAGS' => '-I/opt/project/embedded/include',
64
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
65
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
76
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
77
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
78
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
66
79
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
67
80
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
68
81
  )
@@ -70,9 +83,9 @@ module Omnibus
70
83
  it 'overrides CFLAGS' do
71
84
  expect(subject.with_standard_compiler_flags('CFLAGS'=>'foo')).to eq(
72
85
  'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
73
- 'CFLAGS' => '-I/opt/project/embedded/include',
74
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
75
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
86
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
87
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
88
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
76
89
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
77
90
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
78
91
  )
@@ -80,9 +93,9 @@ module Omnibus
80
93
  it 'overrides CXXFLAGS' do
81
94
  expect(subject.with_standard_compiler_flags('CXXFLAGS'=>'foo')).to eq(
82
95
  'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
83
- 'CFLAGS' => '-I/opt/project/embedded/include',
84
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
85
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
96
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
97
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
98
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
86
99
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
87
100
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
88
101
  )
@@ -90,9 +103,9 @@ module Omnibus
90
103
  it 'overrides CPPFLAGS' do
91
104
  expect(subject.with_standard_compiler_flags('CPPFLAGS'=>'foo')).to eq(
92
105
  'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
93
- 'CFLAGS' => '-I/opt/project/embedded/include',
94
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
95
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
106
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
107
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
108
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
96
109
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
97
110
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
98
111
  )
@@ -101,9 +114,9 @@ module Omnibus
101
114
  expect(subject.with_standard_compiler_flags('numberwang'=>4)).to eq(
102
115
  'numberwang' => 4,
103
116
  'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
104
- 'CFLAGS' => '-I/opt/project/embedded/include',
105
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
106
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
117
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
118
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
119
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
107
120
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
108
121
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
109
122
  )
@@ -165,9 +178,9 @@ module Omnibus
165
178
  it 'sets the defaults' do
166
179
  expect(subject.with_standard_compiler_flags).to eq(
167
180
  'LDFLAGS' => '-L/opt/project/embedded/lib',
168
- 'CFLAGS' => '-I/opt/project/embedded/include',
169
- "CXXFLAGS" => "-I/opt/project/embedded/include",
170
- "CPPFLAGS" => "-I/opt/project/embedded/include",
181
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
182
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
183
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
171
184
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
172
185
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
173
186
  )
@@ -199,37 +212,100 @@ module Omnibus
199
212
  end
200
213
  end
201
214
 
202
- context 'on freebsd' do
215
+ context 'on freebsd 9' do
203
216
  before do
204
217
  stub_ohai(platform: 'freebsd', version: '9.2')
205
218
  end
206
219
 
207
220
  it 'sets the defaults' do
208
221
  expect(subject.with_standard_compiler_flags).to eq(
209
- 'CFLAGS' => '-I/opt/project/embedded/include',
210
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
211
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
222
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
223
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
224
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
212
225
  'LDFLAGS' => '-L/opt/project/embedded/lib',
213
226
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
214
227
  'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
215
228
  )
216
229
  end
230
+ end
231
+
232
+ context 'on freebsd 10' do
233
+ before do
234
+ stub_ohai(platform: 'freebsd', version: '10.0')
235
+ end
236
+
237
+ it 'Clang as the default compiler' do
238
+ expect(subject.with_standard_compiler_flags).to eq(
239
+ 'CC' => 'clang',
240
+ 'CXX' => 'clang++',
241
+ 'CFLAGS' => '-I/opt/project/embedded/include -O2',
242
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
243
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
244
+ 'LDFLAGS' => '-L/opt/project/embedded/lib',
245
+ 'LD_RUN_PATH' => '/opt/project/embedded/lib',
246
+ 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
247
+ )
248
+ end
249
+ end
217
250
 
218
- context 'on freebsd' do
219
- before do
220
- stub_ohai(platform: 'freebsd', version: '10.0')
251
+ context 'on Windows' do
252
+ let(:win_arch_i386) { true }
253
+
254
+ before do
255
+ stub_ohai(platform: 'windows', version: '2012')
256
+ allow(subject).to receive(:windows_arch_i386?).and_return(win_arch_i386)
257
+ end
258
+
259
+ context 'in 32-bit mode' do
260
+ it 'sets the default' do
261
+ expect(subject.with_standard_compiler_flags).to eq(
262
+ 'CFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -mfpmath=sse -msse2 -march=i686',
263
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -mfpmath=sse -msse2 -march=i686',
264
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -mfpmath=sse -msse2 -march=i686',
265
+ 'LDFLAGS' => '-L/opt/project/embedded/lib -m32',
266
+ 'LD_RUN_PATH' => '/opt/project/embedded/lib',
267
+ 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
268
+ )
221
269
  end
222
270
 
223
- it 'Clang as the default compiler' do
271
+ it 'sets BFD flags if requested' do
272
+ expect(subject.with_standard_compiler_flags({}, bfd_flags: true)).to eq(
273
+ 'CFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -mfpmath=sse -msse2 -march=i686',
274
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -mfpmath=sse -msse2 -march=i686',
275
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -mfpmath=sse -msse2 -march=i686',
276
+ 'LDFLAGS' => '-L/opt/project/embedded/lib -m32',
277
+ 'RCFLAGS' => '--target=pe-i386',
278
+ 'ARFLAGS' => '--target=pe-i386',
279
+ 'LD_RUN_PATH' => '/opt/project/embedded/lib',
280
+ 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
281
+ )
282
+ end
283
+ end
284
+
285
+ context 'in 64-bit mode' do
286
+ let(:win_arch_i386) { false }
287
+
288
+ it 'sets the default' do
224
289
  expect(subject.with_standard_compiler_flags).to eq(
225
- 'CC' => 'clang',
226
- 'CXX' => 'clang++',
227
- 'CFLAGS' => '-I/opt/project/embedded/include',
228
- 'CXXFLAGS' => '-I/opt/project/embedded/include',
229
- 'CPPFLAGS' => '-I/opt/project/embedded/include',
230
- 'LDFLAGS' => '-L/opt/project/embedded/lib',
290
+ 'CFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -mfpmath=sse -msse2 -march=x86-64',
291
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -mfpmath=sse -msse2 -march=x86-64',
292
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -mfpmath=sse -msse2 -march=x86-64',
293
+ 'LDFLAGS' => '-L/opt/project/embedded/lib -m64',
231
294
  'LD_RUN_PATH' => '/opt/project/embedded/lib',
232
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
295
+ 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
296
+ )
297
+ end
298
+
299
+ it 'sets BFD flags if requested' do
300
+ expect(subject.with_standard_compiler_flags({}, bfd_flags: true)).to eq(
301
+ 'CFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -mfpmath=sse -msse2 -march=x86-64',
302
+ 'CXXFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -mfpmath=sse -msse2 -march=x86-64',
303
+ 'CPPFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -mfpmath=sse -msse2 -march=x86-64',
304
+ 'LDFLAGS' => '-L/opt/project/embedded/lib -m64',
305
+ 'RCFLAGS' => '--target=pe-x86-64',
306
+ 'ARFLAGS' => '--target=pe-x86-64',
307
+ 'LD_RUN_PATH' => '/opt/project/embedded/lib',
308
+ 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
233
309
  )
234
310
  end
235
311
  end
@@ -273,6 +349,12 @@ module Omnibus
273
349
  )
274
350
  end
275
351
 
352
+ it 'with_embedded_path ignores option to add msys to path' do
353
+ expect(subject.with_embedded_path({}, msys: true)).to eq(
354
+ 'PATH' => prepended_path
355
+ )
356
+ end
357
+
276
358
  it 'prepends multiple paths to PATH' do
277
359
  expect(subject.prepend_path('/foo/bar', '/foo/baz')).to eq(
278
360
  ['/foo/bar', separator, '/foo/baz', separator, path].join
@@ -288,6 +370,10 @@ module Omnibus
288
370
  let(:separator) { ';' }
289
371
  let(:path) { 'c:/Ruby193/bin;c:/Windows/system32;c:/Windows;c:/Windows/System32/Wbem' }
290
372
  let(:install_dir) { 'c:/opt/project' }
373
+ let(:prepended_path_msys) do
374
+ [ "#{install_dir}/bin", separator, "#{install_dir}/embedded/bin", separator,
375
+ "#{install_dir}/embedded/msys/1.0/bin", separator, path].join
376
+ end
291
377
 
292
378
  context '`Path` exists in the environment' do
293
379
  before do
@@ -306,11 +392,19 @@ module Omnibus
306
392
  before do
307
393
  allow(ENV).to receive(:keys).and_return(['PATH'])
308
394
  end
395
+
309
396
  it 'returns a path key of `PATH`' do
310
397
  expect(subject.with_embedded_path).to eq(
311
398
  'PATH' => prepended_path
312
399
  )
313
400
  end
401
+
402
+ it 'with_embedded_path accepts option to add msys to path' do
403
+ expect(subject.with_embedded_path({}, msys: true)).to eq(
404
+ 'PATH' => prepended_path_msys
405
+ )
406
+ end
407
+
314
408
  end
315
409
  end
316
410
  end
@@ -447,6 +541,116 @@ module Omnibus
447
541
  end
448
542
  end
449
543
 
544
+ describe '#fetcher' do
545
+ before do
546
+ expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", source).and_return("1.2.8")
547
+ end
548
+
549
+ context 'when given a source url to an archive' do
550
+ let(:source) do
551
+ {
552
+ url: 'http://example.com/foo.tar.gz',
553
+ md5: 'abcd1234'
554
+ }
555
+ end
556
+
557
+ context 'when relative_path is the same as name' do
558
+ let(:rel_path) { 'software' }
559
+
560
+ it 'ignores back-compat and leaves fetch_dir alone' do
561
+ subject.send(:fetcher)
562
+ expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
563
+ end
564
+
565
+ it 'sets the fetcher project_dir to fetch_dir' do
566
+ expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software"))
567
+ end
568
+ end
569
+
570
+ context 'when relative_path is different from name' do
571
+ let(:rel_path) { 'foo' }
572
+
573
+ it 'ignores back-compat and leaves fetch_dir alone' do
574
+ subject.send(:fetcher)
575
+ expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
576
+ end
577
+
578
+ it 'sets the fetcher project_dir to fetch_dir' do
579
+ expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software"))
580
+ end
581
+ end
582
+ end
583
+
584
+ context 'when given source url is not an archive' do
585
+ let(:source) do
586
+ {
587
+ url: 'http://example.com/foo.txt',
588
+ md5: 'abcd1234'
589
+ }
590
+ end
591
+
592
+ context 'when relative_path is the same as name' do
593
+ let(:rel_path) { 'software' }
594
+
595
+ it 'for back-compat, changes fetch_dir' do
596
+ subject.send(:fetcher)
597
+ expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
598
+ end
599
+
600
+ it 'sets the fetcher project_dir to project_dir' do
601
+ expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
602
+ end
603
+ end
604
+
605
+ context 'when relative_path is different from name' do
606
+ let(:rel_path) { 'foo' }
607
+
608
+ it 'ignores back-compat and leaves fetch_dir alone' do
609
+ subject.send(:fetcher)
610
+ expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
611
+ end
612
+
613
+ it 'sets the fetcher project_dir to project_dir' do
614
+ expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
615
+ end
616
+ end
617
+ end
618
+
619
+ context 'when given source is a git repo' do
620
+ let(:source) do
621
+ {
622
+ git: 'http://example.com/my/git/repo',
623
+ }
624
+ end
625
+
626
+ context 'when relative_path is the same as name' do
627
+ let(:rel_path) { 'software' }
628
+
629
+ it 'for back-compat, changes fetch_dir' do
630
+ subject.send(:fetcher)
631
+ expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
632
+ end
633
+
634
+ it 'sets the fetcher project_dir to project_dir' do
635
+ expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
636
+ end
637
+ end
638
+
639
+ context 'when relative_path is different from name' do
640
+ let(:rel_path) { 'foo' }
641
+
642
+ it 'ignores back-compat and leaves fetch_dir alone' do
643
+ subject.send(:fetcher)
644
+ expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
645
+ end
646
+
647
+ it 'sets the fetcher project_dir to project_dir' do
648
+ expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
649
+ end
650
+ end
651
+ end
652
+ end
653
+
450
654
  describe '#shasum' do
451
655
  context 'when a filepath is given' do
452
656
  let(:path) { '/software.rb' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-sugar
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cleanroom
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -257,6 +257,7 @@ extensions: []
257
257
  extra_rdoc_files: []
258
258
  files:
259
259
  - ".gitignore"
260
+ - ".rspec"
260
261
  - ".rubocop.yml"
261
262
  - ".travis.yml"
262
263
  - CHANGELOG.md
@@ -320,7 +321,6 @@ files:
320
321
  - lib/omnibus/generator_files/config/software/zlib.rb.erb
321
322
  - lib/omnibus/generator_files/gitignore.erb
322
323
  - lib/omnibus/generator_files/omnibus.rb.erb
323
- - lib/omnibus/generator_files/package_scripts/makeselfinst.erb
324
324
  - lib/omnibus/generator_files/package_scripts/postinst.erb
325
325
  - lib/omnibus/generator_files/package_scripts/postrm.erb
326
326
  - lib/omnibus/generator_files/package_scripts/preinst.erb
@@ -364,6 +364,7 @@ files:
364
364
  - lib/omnibus/util.rb
365
365
  - lib/omnibus/version.rb
366
366
  - omnibus.gemspec
367
+ - resources/bff/config.erb
367
368
  - resources/bff/gen.template.erb
368
369
  - resources/deb/conffiles.erb
369
370
  - resources/deb/control.erb
@@ -476,7 +477,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
476
477
  version: '0'
477
478
  requirements: []
478
479
  rubyforge_project:
479
- rubygems_version: 2.2.2
480
+ rubygems_version: 2.5.2
480
481
  signing_key:
481
482
  specification_version: 4
482
483
  summary: Omnibus is a framework for building self-installing, full-stack software