omnibus 4.0.0.rc.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -93,6 +93,16 @@ module Omnibus
93
93
  subject.fetch
94
94
  expect(extracted).to be_a_directory
95
95
  end
96
+
97
+ context 'when the file is less than 10240 bytes' do
98
+ let(:source_url) { 'https://downloads.chef.io/packages-chef-io-public.key' }
99
+ let(:source_md5) { '369efc3a19b9118cdf51c7e87a34f266' }
100
+
101
+ it 'downloads the file' do
102
+ subject.fetch
103
+ expect(downloaded_file).to be_a_file
104
+ end
105
+ end
96
106
  end
97
107
 
98
108
  describe '#version_for_cache' do
@@ -24,7 +24,7 @@ describe Omnibus do
24
24
  expect(subject.which('not_a_real_executable')).to be nil
25
25
  end
26
26
 
27
- it 'retusnt the path when the file exists' do
27
+ it 'returns the path when the file exists' do
28
28
  ruby = Bundler.which('ruby')
29
29
  expect(subject.which(ruby)).to eq(ruby)
30
30
  end
@@ -187,7 +187,7 @@ module Omnibus
187
187
  expect(subject.safe_base_package_name).to eq('pro-ject123.for-realz-2')
188
188
  end
189
189
 
190
- expect(output).to include("The `name' compontent of BFF package names can only include")
190
+ expect(output).to include("The `name' component of BFF package names can only include")
191
191
  end
192
192
  end
193
193
  end
@@ -260,16 +260,16 @@ module Omnibus
260
260
 
261
261
  it 'returns the value while logging a message' do
262
262
  output = capture_logging do
263
- expect(subject.safe_base_package_name).to eq('Pro-ject123.for-realz-2')
263
+ expect(subject.safe_base_package_name).to eq('pro-ject123.for-realz-2')
264
264
  end
265
265
 
266
- expect(output).to include("The `name' compontent of Debian package names can only include")
266
+ expect(output).to include("The `name' component of Debian package names can only include")
267
267
  end
268
268
  end
269
269
  end
270
270
 
271
271
  describe '#safe_build_iteration' do
272
- it 'returns the build iternation' do
272
+ it 'returns the build iteration' do
273
273
  expect(subject.safe_build_iteration).to eq(project.build_iteration)
274
274
  end
275
275
  end
@@ -282,15 +282,27 @@ module Omnibus
282
282
  end
283
283
  end
284
284
 
285
+ context 'when the project build_version has dashes' do
286
+ before { project.build_version('1.2-rc.1') }
287
+
288
+ it 'returns the value while logging a message' do
289
+ output = capture_logging do
290
+ expect(subject.safe_version).to eq('1.2~rc.1')
291
+ end
292
+
293
+ expect(output).to include("Dashes hold special significance in the Debian package versions.")
294
+ end
295
+ end
296
+
285
297
  context 'when the project build_version has invalid characters' do
286
- before { project.build_version("1.2$alpha.##__2") }
298
+ before { project.build_version("1.2$alpha.~##__2") }
287
299
 
288
300
  it 'returns the value while logging a message' do
289
301
  output = capture_logging do
290
- expect(subject.safe_version).to eq('1.2-alpha.-2')
302
+ expect(subject.safe_version).to eq('1.2_alpha.~_2')
291
303
  end
292
304
 
293
- expect(output).to include("The `version' compontent of Debian package names can only include")
305
+ expect(output).to include("The `version' component of Debian package names can only include")
294
306
  end
295
307
  end
296
308
  end
@@ -207,7 +207,7 @@ module Omnibus
207
207
  expect(subject.safe_base_package_name).to eq('project123forrealz2')
208
208
  end
209
209
 
210
- expect(output).to include("The `name' compontent of Mac package names can only include")
210
+ expect(output).to include("The `name' component of Mac package names can only include")
211
211
  end
212
212
  end
213
213
  end
@@ -264,7 +264,7 @@ module Omnibus
264
264
  expect(subject.safe_version).to eq('1.2-alpha.-2')
265
265
  end
266
266
 
267
- expect(output).to include("The `version' compontent of Mac package names can only include")
267
+ expect(output).to include("The `version' component of Mac package names can only include")
268
268
  end
269
269
  end
270
270
  end
@@ -217,6 +217,19 @@ module Omnibus
217
217
  expect(contents).to include("/file2")
218
218
  end
219
219
  end
220
+
221
+ context 'when leaf directories owned by the filesystem package are present' do
222
+ before do
223
+ create_file("#{staging_dir}/BUILD/opt")
224
+ end
225
+
226
+ it 'does not write them into the spec' do
227
+ subject.write_rpm_spec
228
+ contents = File.read(spec_file)
229
+
230
+ expect(contents).to_not include("/opt")
231
+ end
232
+ end
220
233
  end
221
234
 
222
235
  describe '#create_rpm_file' do
@@ -298,7 +311,7 @@ module Omnibus
298
311
  expect(subject.safe_base_package_name).to eq('pro-ject123.for-realz-2')
299
312
  end
300
313
 
301
- expect(output).to include("The `name' compontent of RPM package names can only include")
314
+ expect(output).to include("The `name' component of RPM package names can only include")
302
315
  end
303
316
  end
304
317
  end
@@ -317,12 +330,24 @@ module Omnibus
317
330
  end
318
331
  end
319
332
 
333
+ context 'when the project build_version has dashes' do
334
+ before { project.build_version('1.2-rc.1') }
335
+
336
+ it 'returns the value while logging a message' do
337
+ output = capture_logging do
338
+ expect(subject.safe_version).to eq('1.2~rc.1')
339
+ end
340
+
341
+ expect(output).to include("Tildes hold special significance in the RPM package versions.")
342
+ end
343
+ end
344
+
320
345
  context 'when the project build_version has invalid characters' do
321
- before { project.build_version("1.2-pre$alpha.##__2") }
346
+ before { project.build_version("1.2-pre_alpha.##__2") }
322
347
 
323
348
  it 'returns the value while logging a message' do
324
349
  output = capture_logging do
325
- expect(subject.safe_version).to eq('1.2_pre$alpha.##__2')
350
+ expect(subject.safe_version).to eq('1.2~pre_alpha._2')
326
351
  end
327
352
 
328
353
  expect(output).to include("The `version' component of RPM package names can only include")
@@ -223,6 +223,14 @@ module Omnibus
223
223
  subject.override(:thing, version: '6.6.6')
224
224
  expect(subject.override(:thing)[:version]).to eq('6.6.6')
225
225
  end
226
+
227
+ it 'symbolizes #overrides' do
228
+ subject.override('thing', version: '6.6.6')
229
+ [:thing, 'thing'].each do |thing|
230
+ expect(subject.override(thing)).not_to be_nil
231
+ end
232
+ expect(subject.override(:thing)[:version]).to eq('6.6.6')
233
+ end
226
234
  end
227
235
 
228
236
  describe '#ohai' do
@@ -47,6 +47,7 @@ module Omnibus
47
47
  before do
48
48
  allow(subject).to receive(:packages).and_return(packages)
49
49
  Config.artifactory_base_path('com/getchef')
50
+ Config.publish_retries(1)
50
51
  end
51
52
 
52
53
  it 'validates the package' do
@@ -64,6 +65,26 @@ module Omnibus
64
65
  subject.publish
65
66
  end
66
67
 
68
+ context 'when upload fails' do
69
+ before do
70
+ Config.publish_retries(3)
71
+
72
+ # This is really ugly but there is no easy way to stub a method to
73
+ # raise an exception a set number of times.
74
+ @times = 0
75
+ allow(artifact).to receive(:upload) do
76
+ @times += 1;
77
+ raise Artifactory::Error::HTTPError.new('status' => '409', 'message' => 'CONFLICT') unless @times > 1
78
+ end
79
+ end
80
+
81
+ it 'retries the upload ' do
82
+ output = capture_logging { subject.publish }
83
+ expect(output).to include('Retrying failed publish')
84
+ end
85
+
86
+ end
87
+
67
88
  context 'when an alternate platform and platform version are provided' do
68
89
  subject do
69
90
  described_class.new(path,
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: 4.0.0.rc.2
4
+ version: 4.0.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: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-sugar
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.2'
117
+ version: '2.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.2'
124
+ version: '2.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: aruba
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -334,6 +334,7 @@ files:
334
334
  - resources/pkg/distribution.xml.erb
335
335
  - resources/pkg/license.html.erb
336
336
  - resources/pkg/welcome.html.erb
337
+ - resources/rpm/filesystem_list
337
338
  - resources/rpm/rpmmacros.erb
338
339
  - resources/rpm/signing.erb
339
340
  - resources/rpm/spec.erb
@@ -406,12 +407,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
406
407
  version: 1.9.1
407
408
  required_rubygems_version: !ruby/object:Gem::Requirement
408
409
  requirements:
409
- - - ">"
410
+ - - ">="
410
411
  - !ruby/object:Gem::Version
411
- version: 1.3.1
412
+ version: '0'
412
413
  requirements: []
413
414
  rubyforge_project:
414
- rubygems_version: 2.2.2
415
+ rubygems_version: 2.4.5
415
416
  signing_key:
416
417
  specification_version: 4
417
418
  summary: Omnibus is a framework for building self-installing, full-stack software