omnibus 1.3.0 → 2.0.0.rc1

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.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -1
  3. data/.rubocop.yml +30 -0
  4. data/.travis.yml +14 -3
  5. data/CHANGELOG.md +72 -49
  6. data/Gemfile +8 -5
  7. data/NOTICE +2 -2
  8. data/README.md +65 -7
  9. data/Rakefile +12 -3
  10. data/bin/makeself-header.sh +1 -1
  11. data/bin/makeself.sh +2 -2
  12. data/bin/omnibus +2 -2
  13. data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/background.png +0 -0
  14. data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/license.html +1 -0
  15. data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/welcome.html +1 -0
  16. data/functional/fixtures/mac_pkg/package-scripts/functional-test-project/postinstall +4 -0
  17. data/functional/packagers/mac_pkg_spec.rb +72 -0
  18. data/lib/omnibus/artifact.rb +11 -13
  19. data/lib/omnibus/build_version.rb +18 -21
  20. data/lib/omnibus/builder.rb +37 -48
  21. data/lib/omnibus/clean_tasks.rb +3 -5
  22. data/lib/omnibus/cli/application.rb +46 -53
  23. data/lib/omnibus/cli/base.rb +16 -19
  24. data/lib/omnibus/cli/build.rb +13 -13
  25. data/lib/omnibus/cli/cache.rb +13 -15
  26. data/lib/omnibus/cli/release.rb +4 -9
  27. data/lib/omnibus/cli.rb +2 -4
  28. data/lib/omnibus/config.rb +43 -23
  29. data/lib/omnibus/exceptions.rb +35 -1
  30. data/lib/omnibus/fetcher.rb +9 -13
  31. data/lib/omnibus/fetchers/git_fetcher.rb +15 -19
  32. data/lib/omnibus/fetchers/net_fetcher.rb +34 -38
  33. data/lib/omnibus/fetchers/path_fetcher.rb +7 -9
  34. data/lib/omnibus/fetchers/s3_cache_fetcher.rb +3 -4
  35. data/lib/omnibus/fetchers.rb +3 -3
  36. data/lib/omnibus/health_check.rb +126 -127
  37. data/lib/omnibus/library.rb +11 -12
  38. data/lib/omnibus/overrides.rb +6 -8
  39. data/lib/omnibus/package_release.rb +20 -22
  40. data/lib/omnibus/packagers/mac_pkg.rb +285 -0
  41. data/lib/omnibus/project.rb +215 -110
  42. data/lib/omnibus/reports.rb +16 -24
  43. data/lib/omnibus/s3_cacher.rb +15 -21
  44. data/lib/omnibus/software.rb +178 -88
  45. data/lib/omnibus/util.rb +25 -13
  46. data/lib/omnibus/version.rb +2 -2
  47. data/lib/omnibus.rb +11 -13
  48. data/omnibus.gemspec +20 -18
  49. data/spec/artifact_spec.rb +55 -52
  50. data/spec/build_version_spec.rb +121 -129
  51. data/spec/config_spec.rb +40 -0
  52. data/spec/data/projects/chefdk.rb +41 -0
  53. data/spec/data/projects/sample.rb +10 -0
  54. data/spec/data/software/erchef.rb +12 -12
  55. data/spec/data/software/zlib.rb +67 -0
  56. data/spec/fetchers/git_fetcher_spec.rb +55 -48
  57. data/spec/fetchers/net_fetcher_spec.rb +72 -78
  58. data/spec/omnibus_spec.rb +59 -0
  59. data/spec/overrides_spec.rb +64 -64
  60. data/spec/package_release_spec.rb +65 -64
  61. data/spec/packagers/mac_pkg_spec.rb +261 -0
  62. data/spec/project_spec.rb +138 -0
  63. data/spec/s3_cacher_spec.rb +9 -10
  64. data/spec/software_spec.rb +71 -50
  65. data/spec/spec_helper.rb +14 -7
  66. metadata +68 -60
  67. data/.rspec +0 -1
  68. data/.yardopts +0 -6
  69. data/spec/software_dirs_spec.rb +0 -34
data/lib/omnibus.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2012 Opscode, Inc.
2
+ # Copyright:: Copyright (c) 2012-2014 Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,7 +38,6 @@ require 'omnibus/version'
38
38
  require 'pathname'
39
39
 
40
40
  module Omnibus
41
-
42
41
  DEFAULT_CONFIG_FILENAME = 'omnibus.rb'.freeze
43
42
 
44
43
  # Configure Omnibus.
@@ -71,7 +70,7 @@ module Omnibus
71
70
  # @param file [String] path to a configuration file to load
72
71
  #
73
72
  # @return [void]
74
- def self.load_configuration(file=nil)
73
+ def self.load_configuration(file = nil)
75
74
  if file
76
75
  Config.from_file(file)
77
76
  end
@@ -98,7 +97,7 @@ module Omnibus
98
97
  #
99
98
  # @return [Array<String>]
100
99
  def self.project_names
101
- projects.map{|p| p.name}
100
+ projects.map { |p| p.name }
102
101
  end
103
102
 
104
103
  # Load the {Omnibus::Project} instance with the given name.
@@ -106,7 +105,7 @@ module Omnibus
106
105
  # @param name [String]
107
106
  # @return {Omnibus::Project}
108
107
  def self.project(name)
109
- projects.find{ |p| p.name == name}
108
+ projects.find { |p| p.name == name }
110
109
  end
111
110
 
112
111
  # The absolute path to the Omnibus project/repository directory.
@@ -123,7 +122,7 @@ module Omnibus
123
122
  #
124
123
  # @return [Pathname]
125
124
  def self.source_root
126
- @source_root ||= Pathname.new(File.expand_path("../..", __FILE__))
125
+ @source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
127
126
  end
128
127
 
129
128
  # The source root is the path to the root directory of the `omnibus-software`
@@ -132,7 +131,7 @@ module Omnibus
132
131
  # @return [Pathname]
133
132
  def self.omnibus_software_root
134
133
  @omnibus_software_root ||= begin
135
- if spec = Gem::Specification.find_all_by_name('omnibus-software').first
134
+ if (spec = Gem::Specification.find_all_by_name(Config.software_gem).first)
136
135
  Pathname.new(spec.gem_dir)
137
136
  else
138
137
  nil
@@ -169,7 +168,7 @@ module Omnibus
169
168
  #
170
169
  # @todo print a deprecation message
171
170
  class << self
172
- alias :root :project_root
171
+ alias_method :root, :project_root
173
172
  end
174
173
 
175
174
  private
@@ -197,7 +196,7 @@ module Omnibus
197
196
  # @see Omnibus::Overrides#overrides
198
197
  def self.expand_software(overrides, software_map)
199
198
  unless overrides.is_a? Hash
200
- raise ArgumentError, "Overrides argument must be a hash! You passed #{overrides.inspect}."
199
+ fail ArgumentError, "Overrides argument must be a hash! You passed #{overrides.inspect}."
201
200
  end
202
201
 
203
202
  Omnibus.projects.each do |project|
@@ -216,8 +215,7 @@ module Omnibus
216
215
  expand_projects
217
216
 
218
217
  # Then do software
219
- final_software_map = prefer_local_software(omnibus_software_files,
220
- software_files)
218
+ final_software_map = prefer_local_software(omnibus_software_files, software_files)
221
219
 
222
220
  overrides = Config.override_file ? Omnibus::Overrides.overrides : {}
223
221
 
@@ -281,7 +279,7 @@ module Omnibus
281
279
  # @return [Hash<String, String>]
282
280
  def self.software_map(files)
283
281
  files.each_with_object({}) do |file, collection|
284
- software_name = File.basename(file, ".*")
282
+ software_name = File.basename(file, '.*')
285
283
  collection[software_name] = file
286
284
  end
287
285
  end
@@ -299,7 +297,7 @@ module Omnibus
299
297
  dep_file = software_map[dependency_name]
300
298
 
301
299
  unless dep_file
302
- raise MissingProjectDependency.new(dependency_name, software_dirs)
300
+ fail MissingProjectDependency.new(dependency_name, software_dirs)
303
301
  end
304
302
 
305
303
  dep_software = Omnibus::Software.load(dep_file, project, overrides)
data/omnibus.gemspec CHANGED
@@ -4,31 +4,33 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'omnibus/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "omnibus"
7
+ gem.name = 'omnibus'
8
8
  gem.version = Omnibus::VERSION
9
- gem.license = "Apache 2.0"
10
- gem.author = "Opscode"
11
- gem.email = "info@opscode.com"
12
- gem.description = "Omnibus helps you build self-installing, full-stack software builds."
9
+ gem.license = 'Apache 2.0'
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
13
  gem.summary = gem.description
14
- gem.homepage = "https://github.com/opscode/omnibus-ruby"
14
+ gem.homepage = 'https://github.com/opscode/omnibus-ruby'
15
15
 
16
- gem.required_ruby_version = ">= 1.9.1"
16
+ gem.required_ruby_version = '>= 1.9.1'
17
17
 
18
18
  gem.files = `git ls-files`.split($/)
19
- gem.bindir = "bin"
19
+ gem.bindir = 'bin'
20
20
  gem.executables = %w(omnibus)
21
21
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
22
- gem.require_paths = ["lib"]
22
+ gem.require_paths = ['lib']
23
23
 
24
- gem.add_dependency "mixlib-shellout", "~> 1.3.0"
25
- gem.add_dependency "mixlib-config", "~> 2.1.0"
26
- gem.add_dependency "ohai", ">= 0.6.12"
27
- gem.add_dependency "rake", ">= 0.9"
28
- gem.add_dependency "fpm", "~> 1.0.0"
29
- gem.add_dependency "uber-s3"
30
- gem.add_dependency "thor", ">= 0.16.0"
24
+ gem.add_dependency 'mixlib-shellout', '~> 1.3'
25
+ gem.add_dependency 'mixlib-config', '~> 2.1'
26
+ gem.add_dependency 'ohai', '~> 6.12'
27
+ gem.add_dependency 'rake'
28
+ gem.add_dependency 'fpm', '~> 1.0.0'
29
+ gem.add_dependency 'uber-s3'
30
+ gem.add_dependency 'thor', '>= 0.16.0'
31
31
 
32
- gem.add_development_dependency "rspec"
33
- gem.add_development_dependency "rspec_junit_formatter"
32
+ gem.add_development_dependency 'rspec', '~> 2.14'
33
+ gem.add_development_dependency 'rubocop', '~> 0.18'
34
+
35
+ gem.add_development_dependency 'bundler'
34
36
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2012 Opscode, Inc.
2
+ # Copyright:: Copyright (c) 2012-2014 Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,87 +20,90 @@ require 'spec_helper'
20
20
 
21
21
  describe Omnibus::Artifact do
22
22
 
23
- let(:path) { "build_os=centos-5,machine_architecture=x86,role=oss-builder/pkg/demoproject-11.4.0-1.el5.x86_64.rpm" }
23
+ let(:path) { 'build_os=centos-5,machine_architecture=x86,role=oss-builder/pkg/demoproject-11.4.0-1.el5.x86_64.rpm' }
24
24
 
25
25
  let(:content) { StringIO.new("this is the package content\n") }
26
26
 
27
- let(:md5) { "d41d8cd98f00b204e9800998ecf8427e" }
27
+ let(:md5) { 'd41d8cd98f00b204e9800998ecf8427e' }
28
28
 
29
- let(:sha256) { "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
29
+ let(:sha256) { 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' }
30
30
 
31
- let(:platforms) { [ [ "el", "5", "x86_64" ], [ "sles","11.2","x86_64" ] ] }
31
+ let(:platforms) { [%w(el 5 x86_64), ['sles', '11.2', 'x86_64']] }
32
32
 
33
- let(:artifact) { Omnibus::Artifact.new(path, platforms, { :version => "11.4.0-1" }) }
33
+ let(:artifact) { Omnibus::Artifact.new(path, platforms, version: '11.4.0-1') }
34
34
 
35
- it "has the path to the package" do
36
- artifact.path.should == path
35
+ it 'has the path to the package' do
36
+ expect(artifact.path).to eq(path)
37
37
  end
38
38
 
39
- it "has a list of platforms the package supports" do
40
- artifact.platforms.should == platforms
39
+ it 'has a list of platforms the package supports' do
40
+ expect(artifact.platforms).to eq(platforms)
41
41
  end
42
42
 
43
- it "generates a MD5 of an artifact" do
44
- File.should_receive(:open).with(path).and_return(content)
45
- artifact.md5.should == md5
43
+ it 'generates a MD5 of an artifact' do
44
+ expect(File).to receive(:open).with(path).and_return(content)
45
+ expect(artifact.md5).to eq(md5)
46
46
  end
47
47
 
48
- it "generates a SHA256 of an artifact" do
49
- File.should_receive(:open).with(path).and_return(content)
50
- artifact.sha256.should == sha256
48
+ it 'generates a SHA256 of an artifact' do
49
+ expect(File).to receive(:open).with(path).and_return(content)
50
+ expect(artifact.sha256).to eq(sha256)
51
51
  end
52
52
 
53
53
  it "generates 'flat' metadata" do
54
- File.should_receive(:open).twice.with(path).and_return(content)
54
+ expect(File).to receive(:open).twice.with(path).and_return(content)
55
55
  flat_metadata = artifact.flat_metadata
56
- flat_metadata["platform"].should == "el"
57
- flat_metadata["platform_version"].should == "5"
58
- flat_metadata["arch"].should == "x86_64"
59
- flat_metadata["version"].should == "11.4.0-1"
60
- flat_metadata["basename"].should == "demoproject-11.4.0-1.el5.x86_64.rpm"
61
- flat_metadata["md5"].should == md5
62
- flat_metadata["sha256"].should == sha256
56
+ expect(flat_metadata['platform']).to eq('el')
57
+ expect(flat_metadata['platform_version']).to eq('5')
58
+ expect(flat_metadata['arch']).to eq('x86_64')
59
+ expect(flat_metadata['version']).to eq('11.4.0-1')
60
+ expect(flat_metadata['basename']).to eq('demoproject-11.4.0-1.el5.x86_64.rpm')
61
+ expect(flat_metadata['md5']).to eq(md5)
62
+ expect(flat_metadata['sha256']).to eq(sha256)
63
63
  end
64
64
 
65
- it "adds the package to a release manifest" do
65
+ it 'adds the package to a release manifest' do
66
66
  expected = {
67
- "el" => {
68
- "5" => { "x86_64" => { "11.4.0-1" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm" } }
67
+ 'el' => {
68
+ '5' => { 'x86_64' => { '11.4.0-1' => '/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm' } },
69
+ },
70
+ 'sles' => {
71
+ '11.2' => { 'x86_64' => { '11.4.0-1' => '/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm' } },
69
72
  },
70
- "sles" => {
71
- "11.2" => { "x86_64" => { "11.4.0-1" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm" } }
72
- }
73
73
  }
74
74
 
75
75
  manifest = artifact.add_to_release_manifest!({})
76
- manifest.should == expected
76
+ expect(manifest).to eq(expected)
77
77
  end
78
78
 
79
- it "adds the package to a v2 release manifest" do
80
- File.should_receive(:open).with(path).twice.and_return(content)
79
+ it 'adds the package to a v2 release manifest' do
80
+ expect(File).to receive(:open).with(path).twice.and_return(content)
81
81
  expected = {
82
- "el" => {
83
- "5" => { "x86_64" => { "11.4.0-1" => {
84
- "relpath" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm",
85
- "md5" => md5,
86
- "sha256" => sha256
87
- }
88
- }
89
- }
82
+ 'el' => {
83
+ '5' => {
84
+ 'x86_64' => {
85
+ '11.4.0-1' => {
86
+ 'relpath' => '/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm',
87
+ 'md5' => md5,
88
+ 'sha256' => sha256,
89
+ },
90
+ },
91
+ },
92
+ },
93
+ 'sles' => {
94
+ '11.2' => {
95
+ 'x86_64' => {
96
+ '11.4.0-1' => {
97
+ 'relpath' => '/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm',
98
+ 'md5' => md5,
99
+ 'sha256' => sha256,
100
+ },
101
+ },
102
+ },
90
103
  },
91
- "sles" => {
92
- "11.2" => { "x86_64" => { "11.4.0-1" => {
93
- "relpath" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm",
94
- "md5" => md5,
95
- "sha256" => sha256
96
- }
97
- }
98
- }
99
- }
100
104
  }
101
105
  v2_manifest = artifact.add_to_v2_release_manifest!({})
102
- v2_manifest.should == expected
106
+ expect(v2_manifest).to eq(expected)
103
107
  end
104
108
 
105
109
  end
106
-