omnibus 3.2.0.rc.3 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -118,7 +118,7 @@ module Omnibus
118
118
  # and the package metadata.
119
119
  #
120
120
  # @example
121
- # com/getchef/chef/11.6.0/chef-11.6.0-1.el6.x86_64.rpm
121
+ # chef/11.6.0/chef-11.6.0-1.el6.x86_64.rpm
122
122
  #
123
123
  # @param [Package] package
124
124
  # the package to generate the remote path for
@@ -126,16 +126,8 @@ module Omnibus
126
126
  # @return [String]
127
127
  #
128
128
  def remote_path_for(package)
129
- unless package.metadata[:homepage]
130
- raise OldMetadata.new(package.metadata.path)
131
- end
132
-
133
- domain_parts = parsed_uri_for(package).host.split('.')
134
- domain_parts.delete('www')
135
- domain_parts.reverse!
136
-
137
129
  File.join(
138
- *domain_parts,
130
+ Config.artifactory_base_path,
139
131
  package.metadata[:name],
140
132
  package.metadata[:version],
141
133
  package.metadata[:platform],
@@ -143,29 +135,5 @@ module Omnibus
143
135
  package.metadata[:basename],
144
136
  )
145
137
  end
146
-
147
- #
148
- # The parsed domain for this package. Ruby's URI parser does not "assume"
149
- # a valid protocol, so passing a URI like "CHANGEME.org" will essentially
150
- # result in an unsable object that has no useful, extractable information.
151
- #
152
- # This method will essentially "force" a default protocol on the +homepage+
153
- # attribute of the package, so that it can be parsed like a good little URI.
154
- #
155
- # @param [Package] package
156
- # the package to generate the remote path for
157
- #
158
- # @return [URI]
159
- # the parsed URI object
160
- #
161
- def parsed_uri_for(package)
162
- raw = package.metadata[:homepage]
163
-
164
- if raw =~ /\Ahttps?:\/\//
165
- URI.parse(raw)
166
- else
167
- URI.parse("http://#{raw}")
168
- end
169
- end
170
138
  end
171
139
  end
data/lib/omnibus/util.rb CHANGED
@@ -98,23 +98,5 @@ module Omnibus
98
98
  def falsey?(value)
99
99
  value && value.to_s =~ /^(false|f|no|n|0)$/i
100
100
  end
101
-
102
- #
103
- # Convert the given path to be appropiate for shelling out on Windows.
104
- #
105
- # @param [Array<String>] pieces
106
- # the pieces of the path to join and fix
107
- # @return [String]
108
- # the path with applied changes
109
- #
110
- def windows_safe_path(*pieces)
111
- path = File.join(*pieces)
112
-
113
- if File::ALT_SEPARATOR
114
- path.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
115
- else
116
- path
117
- end
118
- end
119
101
  end
120
102
  end
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Omnibus
18
- VERSION = '3.2.0.rc.3'
18
+ VERSION = '3.2.0'
19
19
  end
data/omnibus.gemspec CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Omnibus::VERSION
9
9
  gem.license = 'Apache 2.0'
10
10
  gem.author = 'Chef Software, Inc.'
11
- gem.email = 'info@getchef.com'
12
- gem.description = 'Omnibus helps you build self-installing, full-stack software builds.'
13
- gem.summary = gem.description
14
- gem.homepage = 'https://github.com/opscode/omnibus-ruby'
11
+ gem.email = 'releng@getchef.com'
12
+ gem.summary = 'Omnibus is a framework for building self-installing, full-stack software builds.'
13
+ gem.description = gem.summary
14
+ gem.homepage = 'https://github.com/opscode/omnibus'
15
15
 
16
16
  gem.required_ruby_version = '>= 1.9.1'
17
17
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.add_dependency 'chef-sugar', '~> 1.2'
25
25
  gem.add_dependency 'mixlib-shellout', '~> 1.4'
26
- gem.add_dependency 'ohai', '~> 7.2.0.rc'
26
+ gem.add_dependency 'ohai', '~> 7.2'
27
27
  gem.add_dependency 'fpm', '~> 0.4'
28
28
  gem.add_dependency 'uber-s3'
29
29
  gem.add_dependency 'thor', '~> 0.18'
@@ -22,7 +22,7 @@ homepage "http://www.opscode.com"
22
22
  # NOTE: Ruby DevKit fundamentally CANNOT be installed into "Program Files"
23
23
  # Native gems will use gcc which will barf on files with spaces,
24
24
  # which is only fixable if everyone in the world fixes their Makefiles
25
- install_dir "c:\\opscode\\chef"
25
+ install_dir "C:/opscode/chef"
26
26
  build_version '1.0.0'
27
27
  build_iteration 4
28
28
  package_name "chef-client"
@@ -22,7 +22,7 @@ homepage "http://www.opscode.com"
22
22
  # NOTE: Ruby DevKit fundamentally CANNOT be installed into "Program Files"
23
23
  # Native gems will use gcc which will barf on files with spaces,
24
24
  # which is only fixable if everyone in the world fixes their Makefiles
25
- install_dir "c:\\opscode\\chefdk"
25
+ install_dir "C:/opscode/chefdk"
26
26
  build_version '1.0.0'
27
27
  build_iteration 1
28
28
 
@@ -27,10 +27,10 @@ build do
27
27
  block do
28
28
  FileUtils.mkdir_p(File.expand_path("embedded/ssl/certs", install_dir))
29
29
 
30
- # There is a bug in omnibus-ruby that may or may not have been fixed. Since the source url
31
- # does not point to an archive, omnibus-ruby tries to copy cacert.pem into the project working
30
+ # There is a bug in omnibus that may or may not have been fixed. Since the source url
31
+ # does not point to an archive, omnibus tries to copy cacert.pem into the project working
32
32
  # directory. However, it fails and copies to '/var/cache/omnibus/src/cacerts-2012.12.19\' instead
33
- # There is supposed to be a fix in omnibus-ruby, but under further testing, it was unsure if the
33
+ # There is supposed to be a fix in omnibus, but under further testing, it was unsure if the
34
34
  # fix worked. Rather than trying to fix this now, we're filing a bug and copying the cacert.pem
35
35
  # directly from the cache instead.
36
36
 
@@ -45,8 +45,7 @@ build do
45
45
  @build_version = build_version.split("-")[1] || self.project.build_iteration
46
46
 
47
47
  # Find path in which chef gem is installed to.
48
- # Note that install_dir is something like: c:\\opscode\\chef
49
- chef_path_regex = "#{install_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR)}/**/gems/chef-[0-9]*"
48
+ chef_path_regex = "#{install_dir}/**/gems/chef-[0-9]*"
50
49
  chef_gem_paths = Dir[chef_path_regex].select{ |path| File.directory?(path) }
51
50
  raise "Expected one but found #{chef_gem_paths.length} installation directories for chef gem using: #{chef_path_regex}. Found paths: #{chef_gem_paths.inspect}." unless chef_gem_paths.length == 1
52
51
  @chef_gem_path = chef_gem_paths.first
@@ -36,11 +36,11 @@ build do
36
36
  #
37
37
  #####################################################################
38
38
  #
39
- # since omnibus-ruby is not architected to intentionally let the
39
+ # since omnibus is not architected to intentionally let the
40
40
  # software definitions define the #build_version and
41
41
  # #build_iteration of the package artifact, we're going to implement
42
42
  # a temporary hack here that lets us do so. this type of use case
43
- # will become a feature of omnibus-ruby in the future, but in order
43
+ # will become a feature of omnibus in the future, but in order
44
44
  # to get things shipped, we'll hack it up here.
45
45
  #
46
46
  # <3 Stephen
@@ -57,11 +57,11 @@ build do
57
57
  #
58
58
  #####################################################################
59
59
  #
60
- # since omnibus-ruby is not architected to intentionally let the
60
+ # since omnibus is not architected to intentionally let the
61
61
  # software definitions define the #build_version and
62
62
  # #build_iteration of the package artifact, we're going to implement
63
63
  # a temporary hack here that lets us do so. this type of use case
64
- # will become a feature of omnibus-ruby in the future, but in order
64
+ # will become a feature of omnibus in the future, but in order
65
65
  # to get things shipped, we'll hack it up here.
66
66
  #
67
67
  # <3 Stephen
@@ -48,7 +48,7 @@ env = {
48
48
 
49
49
  build do
50
50
  # Nasty hack to set the artifact version until this gets fixed:
51
- # https://github.com/opscode/omnibus-ruby/issues/134
51
+ # https://github.com/opscode/omnibus/issues/134
52
52
  block do
53
53
  project = self.project
54
54
  if project.name == "chefdk"
@@ -140,7 +140,7 @@ build do
140
140
  # openssl build process uses a `makedepend` tool that we build inside the bundle.
141
141
  env["PATH"] = "#{install_dir}/embedded/bin" + File::PATH_SEPARATOR + ENV["PATH"]
142
142
 
143
- # @todo: move into omnibus-ruby
143
+ # @todo: move into omnibus
144
144
  has_gmake = system("gmake --version")
145
145
 
146
146
  if has_gmake
@@ -146,7 +146,7 @@ build do
146
146
  "GEM_HOME" => nil
147
147
  })
148
148
 
149
- # @todo: move into omnibus-ruby
149
+ # @todo: move into omnibus
150
150
  has_gmake = system("gmake --version")
151
151
 
152
152
  if has_gmake
@@ -237,6 +237,16 @@ module Omnibus
237
237
 
238
238
  expect(File.file?(path)).to be_truthy
239
239
  end
240
+
241
+ it 'creates the containing directory' do
242
+ path = File.join(tmp_path, 'foo', 'bar', 'file')
243
+ FileUtils.rm_rf(path)
244
+
245
+ subject.touch(path)
246
+ subject.build
247
+
248
+ expect(File.file?(path)).to be_truthy
249
+ end
240
250
  end
241
251
 
242
252
  describe '#delete' do
@@ -259,6 +269,19 @@ module Omnibus
259
269
 
260
270
  expect(File.exist?(path)).to be_falsey
261
271
  end
272
+
273
+ it 'accepts a glob pattern' do
274
+ path_a = File.join(tmp_path, 'file_a')
275
+ path_b = File.join(tmp_path, 'file_b')
276
+ FileUtils.touch(path_a)
277
+ FileUtils.touch(path_b)
278
+
279
+ subject.delete("#{tmp_path}/**/file_*")
280
+ subject.build
281
+
282
+ expect(File.exist?(path_a)).to be_falsey
283
+ expect(File.exist?(path_b)).to be_falsey
284
+ end
262
285
  end
263
286
 
264
287
  describe '#copy' do
@@ -273,6 +296,45 @@ module Omnibus
273
296
  expect(File.file?(path_b)).to be_truthy
274
297
  expect(File.read(path_b)).to eq(File.read(path_a))
275
298
  end
299
+
300
+ it 'copies the directory and entries' do
301
+ destination = File.join(tmp_path, 'destination')
302
+
303
+ directory = File.join(tmp_path, 'scratch')
304
+ FileUtils.mkdir_p(directory)
305
+
306
+ path_a = File.join(directory, 'file_a')
307
+ path_b = File.join(directory, 'file_b')
308
+ FileUtils.touch(path_a)
309
+ FileUtils.touch(path_b)
310
+
311
+ subject.copy(directory, destination)
312
+ subject.build
313
+
314
+ expect(File.exist?(destination)).to be_truthy
315
+ expect(File.exist?("#{destination}/file_a")).to be_truthy
316
+ expect(File.exist?("#{destination}/file_b")).to be_truthy
317
+ end
318
+
319
+ it 'accepts a glob pattern' do
320
+ destination = File.join(tmp_path, 'destination')
321
+ FileUtils.mkdir_p(destination)
322
+
323
+ directory = File.join(tmp_path, 'scratch')
324
+ FileUtils.mkdir_p(directory)
325
+
326
+ path_a = File.join(directory, 'file_a')
327
+ path_b = File.join(directory, 'file_b')
328
+ FileUtils.touch(path_a)
329
+ FileUtils.touch(path_b)
330
+
331
+ subject.copy("#{directory}/*", destination)
332
+ subject.build
333
+
334
+ expect(File.exist?(destination)).to be_truthy
335
+ expect(File.exist?("#{destination}/file_a")).to be_truthy
336
+ expect(File.exist?("#{destination}/file_b")).to be_truthy
337
+ end
276
338
  end
277
339
 
278
340
  describe '#move' do
@@ -287,6 +349,49 @@ module Omnibus
287
349
  expect(File.file?(path_b)).to be_truthy
288
350
  expect(File.file?(path_a)).to be_falsey
289
351
  end
352
+
353
+ it 'moves the directory and entries' do
354
+ destination = File.join(tmp_path, 'destination')
355
+
356
+ directory = File.join(tmp_path, 'scratch')
357
+ FileUtils.mkdir_p(directory)
358
+
359
+ path_a = File.join(directory, 'file_a')
360
+ path_b = File.join(directory, 'file_b')
361
+ FileUtils.touch(path_a)
362
+ FileUtils.touch(path_b)
363
+
364
+ subject.move(directory, destination)
365
+ subject.build
366
+
367
+ expect(File.exist?(destination)).to be_truthy
368
+ expect(File.exist?("#{destination}/file_a")).to be_truthy
369
+ expect(File.exist?("#{destination}/file_b")).to be_truthy
370
+
371
+ expect(File.exist?(directory)).to be_falsey
372
+ end
373
+
374
+ it 'accepts a glob pattern' do
375
+ destination = File.join(tmp_path, 'destination')
376
+ FileUtils.mkdir_p(destination)
377
+
378
+ directory = File.join(tmp_path, 'scratch')
379
+ FileUtils.mkdir_p(directory)
380
+
381
+ path_a = File.join(directory, 'file_a')
382
+ path_b = File.join(directory, 'file_b')
383
+ FileUtils.touch(path_a)
384
+ FileUtils.touch(path_b)
385
+
386
+ subject.move("#{directory}/*", destination)
387
+ subject.build
388
+
389
+ expect(File.exist?(destination)).to be_truthy
390
+ expect(File.exist?("#{destination}/file_a")).to be_truthy
391
+ expect(File.exist?("#{destination}/file_b")).to be_truthy
392
+
393
+ expect(File.exist?(directory)).to be_truthy
394
+ end
290
395
  end
291
396
 
292
397
  describe '#link' do
@@ -300,6 +405,139 @@ module Omnibus
300
405
 
301
406
  expect(File.symlink?(path_b)).to be_truthy
302
407
  end
408
+
409
+ it 'links the directory' do
410
+ destination = File.join(tmp_path, 'destination')
411
+ directory = File.join(tmp_path, 'scratch')
412
+ FileUtils.mkdir_p(directory)
413
+
414
+ subject.link(directory, destination)
415
+ subject.build
416
+
417
+ expect(File.symlink?(destination)).to be_truthy
418
+ end
419
+
420
+ it 'accepts a glob pattern' do
421
+ destination = File.join(tmp_path, 'destination')
422
+ FileUtils.mkdir_p(destination)
423
+
424
+ directory = File.join(tmp_path, 'scratch')
425
+ FileUtils.mkdir_p(directory)
426
+
427
+ path_a = File.join(directory, 'file_a')
428
+ path_b = File.join(directory, 'file_b')
429
+ FileUtils.touch(path_a)
430
+ FileUtils.touch(path_b)
431
+
432
+ subject.link("#{directory}/*", destination)
433
+ subject.build
434
+
435
+ expect(File.symlink?("#{destination}/file_a")).to be_truthy
436
+ expect(File.symlink?("#{destination}/file_b")).to be_truthy
437
+ end
438
+ end
439
+
440
+ describe '#sync' do
441
+ let(:source) do
442
+ source = File.join(tmp_path, 'source')
443
+ FileUtils.mkdir_p(source)
444
+
445
+ FileUtils.touch(File.join(source, 'file_a'))
446
+ FileUtils.touch(File.join(source, 'file_b'))
447
+ FileUtils.touch(File.join(source, 'file_c'))
448
+
449
+ FileUtils.mkdir_p(File.join(source, 'folder'))
450
+ FileUtils.touch(File.join(source, 'folder', 'file_d'))
451
+ FileUtils.touch(File.join(source, 'folder', 'file_e'))
452
+
453
+ FileUtils.mkdir_p(File.join(source, '.dot_folder'))
454
+ FileUtils.touch(File.join(source, '.dot_folder', 'file_f'))
455
+
456
+ FileUtils.touch(File.join(source, '.file_g'))
457
+ source
458
+ end
459
+
460
+ let(:destination) { File.join(tmp_path, 'destination') }
461
+
462
+ context 'when the destination is empty' do
463
+ it 'syncs the directories' do
464
+ subject.sync(source, destination)
465
+ subject.build
466
+
467
+ expect(File.file?("#{destination}/file_a")).to be_truthy
468
+ expect(File.file?("#{destination}/file_b")).to be_truthy
469
+ expect(File.file?("#{destination}/file_c")).to be_truthy
470
+ expect(File.file?("#{destination}/folder/file_d")).to be_truthy
471
+ expect(File.file?("#{destination}/folder/file_e")).to be_truthy
472
+ expect(File.file?("#{destination}/.dot_folder/file_f")).to be_truthy
473
+ expect(File.file?("#{destination}/.file_g")).to be_truthy
474
+ end
475
+ end
476
+
477
+ context 'when the directory exists' do
478
+ before { FileUtils.mkdir_p(destination) }
479
+
480
+ it 'deletes existing files and folders' do
481
+ FileUtils.mkdir_p("#{destination}/existing_folder")
482
+ FileUtils.mkdir_p("#{destination}/.existing_folder")
483
+ FileUtils.touch("#{destination}/existing_file")
484
+ FileUtils.touch("#{destination}/.existing_file")
485
+
486
+ subject.sync(source, destination)
487
+ subject.build
488
+
489
+ expect(File.file?("#{destination}/file_a")).to be_truthy
490
+ expect(File.file?("#{destination}/file_b")).to be_truthy
491
+ expect(File.file?("#{destination}/file_c")).to be_truthy
492
+ expect(File.file?("#{destination}/folder/file_d")).to be_truthy
493
+ expect(File.file?("#{destination}/folder/file_e")).to be_truthy
494
+ expect(File.file?("#{destination}/.dot_folder/file_f")).to be_truthy
495
+ expect(File.file?("#{destination}/.file_g")).to be_truthy
496
+
497
+ expect(File.exist?("#{destination}/existing_folder")).to be_falsey
498
+ expect(File.exist?("#{destination}/.existing_folder")).to be_falsey
499
+ expect(File.exist?("#{destination}/existing_file")).to be_falsey
500
+ expect(File.exist?("#{destination}/.existing_file")).to be_falsey
501
+ end
502
+ end
503
+
504
+ context 'when :exclude is given' do
505
+ it 'does not copy files and folders that match the pattern' do
506
+ subject.sync(source, destination, exclude: '.dot_folder')
507
+ subject.build
508
+
509
+ expect(File.file?("#{destination}/file_a")).to be_truthy
510
+ expect(File.file?("#{destination}/file_b")).to be_truthy
511
+ expect(File.file?("#{destination}/file_c")).to be_truthy
512
+ expect(File.file?("#{destination}/folder/file_d")).to be_truthy
513
+ expect(File.file?("#{destination}/folder/file_e")).to be_truthy
514
+ expect(File.exist?("#{destination}/.dot_folder")).to be_falsey
515
+ expect(File.file?("#{destination}/.dot_folder/file_f")).to be_falsey
516
+ expect(File.file?("#{destination}/.file_g")).to be_truthy
517
+ end
518
+
519
+ it 'removes existing files and folders in destination' do
520
+ FileUtils.mkdir_p("#{destination}/existing_folder")
521
+ FileUtils.touch("#{destination}/existing_file")
522
+ FileUtils.mkdir_p("#{destination}/.dot_folder")
523
+ FileUtils.touch("#{destination}/.dot_folder/file_f")
524
+
525
+ subject.sync(source, destination, exclude: '.dot_folder')
526
+ subject.build
527
+
528
+ expect(File.file?("#{destination}/file_a")).to be_truthy
529
+ expect(File.file?("#{destination}/file_b")).to be_truthy
530
+ expect(File.file?("#{destination}/file_c")).to be_truthy
531
+ expect(File.file?("#{destination}/folder/file_d")).to be_truthy
532
+ expect(File.file?("#{destination}/folder/file_e")).to be_truthy
533
+ expect(File.exist?("#{destination}/.dot_folder")).to be_falsey
534
+ expect(File.file?("#{destination}/.dot_folder/file_f")).to be_falsey
535
+ expect(File.file?("#{destination}/.file_g")).to be_truthy
536
+
537
+ expect(File.exist?("#{destination}/existing_folder")).to be_falsey
538
+ expect(File.exist?("#{destination}/existing_file")).to be_falsey
539
+ end
540
+ end
303
541
  end
304
542
  end
305
543
  end
@@ -39,7 +39,9 @@ module Omnibus
39
39
  it_behaves_like 'a cleanroom setter', :copy, %|copy 'file', 'file2'|
40
40
  it_behaves_like 'a cleanroom setter', :move, %|move 'file', 'file2'|
41
41
  it_behaves_like 'a cleanroom setter', :link, %|link 'file', 'file2'|
42
+ it_behaves_like 'a cleanroom setter', :sync, %|link 'a/', 'b/'|
42
43
  it_behaves_like 'a cleanroom getter', :project_root, %|puts project_root|
44
+ it_behaves_like 'a cleanroom getter', :windows_safe_path, %|puts windows_safe_path('foo')|
43
45
 
44
46
  # From software
45
47
  it_behaves_like 'a cleanroom getter', :project_dir
@@ -10,7 +10,7 @@ module Omnibus
10
10
 
11
11
  before do
12
12
  # Don't expand paths on the build system. Otherwise, you will end up with
13
- # paths like +\\Users\\you\\Development\\omnibus-ruby\\C:\\omnibus-ruby+
13
+ # paths like +\\Users\\you\\Development\\omnibus-ruby\\C:/omnibus-ruby+
14
14
  # when testing on "other" operating systems
15
15
  allow(File).to receive(:expand_path) { |arg| arg }
16
16
  end
@@ -57,14 +57,14 @@ module Omnibus
57
57
  stub_const('File::ALT_SEPARATOR', '\\')
58
58
  end
59
59
 
60
- include_examples 'a configurable', :base_dir, 'C:\\omnibus-ruby'
61
- include_examples 'a configurable', :cache_dir, 'C:\\omnibus-ruby\\cache'
62
- include_examples 'a configurable', :git_cache_dir, 'C:\\omnibus-ruby\\cache\\git_cache'
63
- include_examples 'a configurable', :install_path_cache_dir, 'C:\\omnibus-ruby\\cache\\git_cache'
64
- include_examples 'a configurable', :source_dir, 'C:\\omnibus-ruby\\src'
65
- include_examples 'a configurable', :build_dir, 'C:\\omnibus-ruby\\build'
66
- include_examples 'a configurable', :package_dir, 'C:\\omnibus-ruby\\pkg'
67
- include_examples 'a configurable', :package_tmp, 'C:\\omnibus-ruby\\pkg-tmp'
60
+ include_examples 'a configurable', :base_dir, 'C:/omnibus-ruby'
61
+ include_examples 'a configurable', :cache_dir, 'C:/omnibus-ruby/cache'
62
+ include_examples 'a configurable', :git_cache_dir, 'C:/omnibus-ruby/cache/git_cache'
63
+ include_examples 'a configurable', :install_path_cache_dir, 'C:/omnibus-ruby/cache/git_cache'
64
+ include_examples 'a configurable', :source_dir, 'C:/omnibus-ruby/src'
65
+ include_examples 'a configurable', :build_dir, 'C:/omnibus-ruby/build'
66
+ include_examples 'a configurable', :package_dir, 'C:/omnibus-ruby/pkg'
67
+ include_examples 'a configurable', :package_tmp, 'C:/omnibus-ruby/pkg-tmp'
68
68
  end
69
69
 
70
70
  context 'when base_dir is changed' do
@@ -94,6 +94,7 @@ module Omnibus
94
94
  it_behaves_like 'a version manipulator', 'windows', '6.1.7601', '2008r2'
95
95
  it_behaves_like 'a version manipulator', 'windows', '6.2.9200', '8'
96
96
  it_behaves_like 'a version manipulator', 'windows', '6.3.9200', '8.1'
97
+ it_behaves_like 'a version manipulator', 'windows', '6.3.9600', '8.1'
97
98
 
98
99
  context 'given an unknown platform' do
99
100
  before do
@@ -144,6 +145,13 @@ module Omnibus
144
145
  expect(instance[:platform]).to eq('ubuntu')
145
146
  end
146
147
 
148
+ it 'ensures platform version is properly truncated' do
149
+ allow(File).to receive(:read).and_return('{ "platform": "el", "platform_version": "5.10" }')
150
+ instance = described_class.for_package(package)
151
+
152
+ expect(instance[:platform_version]).to eq('5')
153
+ end
154
+
147
155
  it 'ensures an iteration exists' do
148
156
  allow(File).to receive(:read).and_return('{}')
149
157
  instance = described_class.for_package(package)
@@ -44,7 +44,10 @@ module Omnibus
44
44
  subject { described_class.new(path, repository: repository) }
45
45
 
46
46
  describe '#publish' do
47
- before { allow(subject).to receive(:packages).and_return(packages) }
47
+ before do
48
+ allow(subject).to receive(:packages).and_return(packages)
49
+ Config.artifactory_base_path('com/getchef')
50
+ end
48
51
 
49
52
  it 'validates the package' do
50
53
  expect(package).to receive(:validate!).once
@@ -61,14 +64,6 @@ module Omnibus
61
64
  subject.publish
62
65
  end
63
66
 
64
- context 'when the metadata is from an older version of Omnibus' do
65
- before { allow(package.metadata).to receive(:[]).with(:homepage).and_return(nil) }
66
-
67
- it 'raises an exception' do
68
- expect { subject.publish }.to raise_error(OldMetadata)
69
- end
70
- end
71
-
72
67
  context 'when a block is given' do
73
68
  it 'yields the package to the block' do
74
69
  block = ->(package) { package.do_something! }
@@ -39,18 +39,6 @@ module Omnibus
39
39
 
40
40
  subject { described_class.new(path) }
41
41
 
42
- describe '#initialize' do
43
- it 'raises an exception when publish_s3_access_key is missing' do
44
- expect { Config.publish_s3_access_key }
45
- .to raise_error(MissingConfigOption)
46
- end
47
-
48
- it 'raises an exception when release_s3_secret_key is missing' do
49
- expect { Config.publish_s3_secret_key }
50
- .to raise_error(MissingConfigOption)
51
- end
52
- end
53
-
54
42
  describe '#publish' do
55
43
  before { allow(subject).to receive(:packages).and_return(packages) }
56
44