omnibus 2.0.2 → 3.0.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.
- checksums.yaml +7 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +0 -2
- data/CHANGELOG.md +26 -6
- data/Gemfile +7 -0
- data/Guardfile +10 -0
- data/README.md +103 -160
- data/Rakefile +6 -1
- data/docs/Building on OSX.md +66 -0
- data/docs/omnibus-build-cache.md +75 -0
- data/lib/omnibus.rb +9 -13
- data/lib/omnibus/artifact.rb +1 -13
- data/lib/omnibus/assets/README-logo.png +0 -0
- data/lib/omnibus/assets/logo.psd +0 -0
- data/lib/omnibus/builder.rb +1 -0
- data/lib/omnibus/cli/application.rb +17 -4
- data/lib/omnibus/cli/build.rb +6 -4
- data/lib/omnibus/config.rb +33 -0
- data/lib/omnibus/exceptions.rb +20 -14
- data/lib/omnibus/health_check.rb +2 -0
- data/lib/omnibus/install_path_cache.rb +106 -0
- data/lib/omnibus/library.rb +18 -1
- data/lib/omnibus/packagers/base.rb +228 -0
- data/lib/omnibus/packagers/mac_dmg.rb +215 -0
- data/lib/omnibus/packagers/mac_pkg.rb +129 -253
- data/lib/omnibus/project.rb +89 -95
- data/lib/omnibus/s3_cacher.rb +4 -7
- data/lib/omnibus/software.rb +47 -83
- data/lib/omnibus/sugar.rb +49 -0
- data/lib/omnibus/templates/.kitchen.yml.erb +3 -0
- data/lib/omnibus/templates/Berksfile.erb +4 -0
- data/lib/omnibus/templates/Gemfile.erb +1 -1
- data/lib/omnibus/templates/mac_dmg/background.png +0 -0
- data/lib/omnibus/templates/mac_dmg/icon.png +0 -0
- data/lib/omnibus/templates/mac_pkg/background.png +0 -0
- data/lib/omnibus/templates/mac_pkg/license.html.erb +1 -0
- data/lib/omnibus/templates/mac_pkg/welcome.html.erb +9 -0
- data/lib/omnibus/templates/omnibus.rb.example.erb +31 -4
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +5 -4
- data/spec/fixtures/sample/files/mac_dmg/Resources/background.png +0 -0
- data/spec/fixtures/sample/files/mac_dmg/Resources/icon.png +0 -0
- data/spec/fixtures/sample/files/mac_pkg/Resources/background.png +0 -0
- data/spec/fixtures/sample/files/mac_pkg/Resources/license.html +1 -0
- data/spec/fixtures/sample/files/mac_pkg/Resources/welcome.html +9 -0
- data/{functional/fixtures/mac_pkg/package-scripts/functional-test-project → spec/fixtures/sample/package-scripts/sample}/postinstall +0 -0
- data/spec/functional/packagers/mac_spec.rb +74 -0
- data/spec/spec_helper.rb +14 -3
- data/spec/sugar_spec.rb +20 -0
- data/spec/{artifact_spec.rb → unit/artifact_spec.rb} +2 -3
- data/spec/{build_version_spec.rb → unit/build_version_spec.rb} +0 -0
- data/spec/{config_spec.rb → unit/config_spec.rb} +4 -0
- data/spec/{fetchers → unit/fetchers}/git_fetcher_spec.rb +0 -0
- data/spec/{fetchers → unit/fetchers}/net_fetcher_spec.rb +0 -0
- data/spec/unit/install_path_cache_spec.rb +175 -0
- data/spec/unit/library_spec.rb +67 -0
- data/spec/{omnibus_spec.rb → unit/omnibus_spec.rb} +0 -0
- data/spec/{overrides_spec.rb → unit/overrides_spec.rb} +0 -0
- data/spec/{package_release_spec.rb → unit/package_release_spec.rb} +0 -0
- data/spec/unit/packagers/base_spec.rb +221 -0
- data/spec/unit/packagers/mac_pkg_spec.rb +163 -0
- data/spec/{project_spec.rb → unit/project_spec.rb} +0 -14
- data/spec/{s3_cacher_spec.rb → unit/s3_cacher_spec.rb} +0 -0
- data/spec/{software_spec.rb → unit/software_spec.rb} +0 -1
- metadata +122 -103
- data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/background.png +0 -0
- data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/license.html +0 -1
- data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/welcome.html +0 -1
- data/functional/packagers/mac_pkg_spec.rb +0 -72
- data/lib/omnibus/clean_tasks.rb +0 -28
- data/spec/packagers/mac_pkg_spec.rb +0 -262
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
Apache 2 license
|
@@ -1 +0,0 @@
|
|
1
|
-
Demonstration package.
|
@@ -1,72 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require 'stringio'
|
19
|
-
require 'omnibus/packagers/mac_pkg'
|
20
|
-
require 'spec_helper'
|
21
|
-
|
22
|
-
describe Omnibus::Packagers::MacPkg do
|
23
|
-
|
24
|
-
let(:mac_pkg_identifier) { 'test.pkg.functional-test-project' }
|
25
|
-
|
26
|
-
let(:omnibus_root) { File.expand_path('../../fixtures/mac_pkg', __FILE__) }
|
27
|
-
|
28
|
-
let(:scripts_path) { "#{omnibus_root}/package-scripts" }
|
29
|
-
|
30
|
-
let(:files_path) { "#{omnibus_root}/files" }
|
31
|
-
|
32
|
-
let(:package_dir) { Dir.pwd }
|
33
|
-
|
34
|
-
let(:project) do
|
35
|
-
|
36
|
-
Omnibus.stub(:project_root).and_return(omnibus_root)
|
37
|
-
Omnibus.config.stub(:package_dir).and_return(package_dir)
|
38
|
-
|
39
|
-
project_file = <<-P
|
40
|
-
name "functional-test-project"
|
41
|
-
maintainer "YOU"
|
42
|
-
homepage "http://www.theonion.com/articles/drunken-man-careens-wildly-across-internet,35249/"
|
43
|
-
build_version "23.4.2"
|
44
|
-
install_path "/opt/functional-test-project"
|
45
|
-
mac_pkg_identifier "#{mac_pkg_identifier}"
|
46
|
-
P
|
47
|
-
Omnibus::Project.new(project_file, __FILE__)
|
48
|
-
end
|
49
|
-
|
50
|
-
let(:packager) do
|
51
|
-
Omnibus::Packagers::MacPkg.new(project)
|
52
|
-
end
|
53
|
-
|
54
|
-
def create_app_dir
|
55
|
-
FileUtils.mkdir('/opt/functional-test-project') unless File.directory?('/opt/functional-test-project')
|
56
|
-
File.open('/opt/functional-test-project/itworks.txt', 'w+') do |f|
|
57
|
-
f.puts 'hello world'
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# This will run the Omnibus::Packagers::MacPkg code without any stubs to
|
62
|
-
# verify it works. In order for this test to run correctly, you have to run
|
63
|
-
# as root or manually create the /opt/functional-test-project directory.
|
64
|
-
#
|
65
|
-
# There is no verification that the package was correctly created, you have
|
66
|
-
# to install it yourself to verify.
|
67
|
-
it 'builds a package' do
|
68
|
-
create_app_dir
|
69
|
-
packager.build
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
data/lib/omnibus/clean_tasks.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
# Adds source and build artifacts to Rake's CLEAN list, and install
|
19
|
-
# and cache artifacts to its CLOBBER list, ensuring that the `clean`
|
20
|
-
# and `clobber` Rake tasks do the right thing for Omnibus projects.
|
21
|
-
#
|
22
|
-
# @see https://github.com/jimweirich/rake/blob/master/lib/rake/clean.rb
|
23
|
-
|
24
|
-
require 'rake/clean'
|
25
|
-
|
26
|
-
::CLEAN.include("#{Omnibus.config.source_dir}/**/*", "#{Omnibus.config.build_dir}/**/*")
|
27
|
-
|
28
|
-
::CLOBBER.include("#{Omnibus.config.cache_dir}/**/*", "#{Omnibus.config.package_dir}/**/*")
|
@@ -1,262 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require 'stringio'
|
19
|
-
require 'omnibus/packagers/mac_pkg'
|
20
|
-
require 'spec_helper'
|
21
|
-
|
22
|
-
describe Omnibus::Packagers::MacPkg do
|
23
|
-
|
24
|
-
let(:project_name) { 'myproject' }
|
25
|
-
|
26
|
-
let(:mac_pkg_identifier) { 'com.mycorp.myproject' }
|
27
|
-
|
28
|
-
let(:omnibus_root) { '/omnibus/project/root' }
|
29
|
-
|
30
|
-
let(:scripts_path) { "#{omnibus_root}/scripts" }
|
31
|
-
|
32
|
-
let(:package_dir) { '/home/someuser/omnibus-myproject/pkg' }
|
33
|
-
|
34
|
-
let(:package_tmp) { '/var/cache/omnibus/pkg-tmp' }
|
35
|
-
|
36
|
-
let(:files_path) { "#{omnibus_root}/files" }
|
37
|
-
|
38
|
-
let(:expected_distribution_content) do
|
39
|
-
<<-EOH
|
40
|
-
<?xml version="1.0" standalone="no"?>
|
41
|
-
<installer-gui-script minSpecVersion="1">
|
42
|
-
<title>Myproject</title>
|
43
|
-
<background file="background.png" alignment="bottomleft" mime-type="image/png"/>
|
44
|
-
<welcome file="welcome.html" mime-type="text/html"/>
|
45
|
-
<license file="license.html" mime-type="text/html"/>
|
46
|
-
|
47
|
-
<!-- Generated by productbuild - - synthesize -->
|
48
|
-
<pkg-ref id="com.mycorp.myproject"/>
|
49
|
-
<options customize="never" require-scripts="false"/>
|
50
|
-
<choices-outline>
|
51
|
-
<line choice="default">
|
52
|
-
<line choice="com.mycorp.myproject"/>
|
53
|
-
</line>
|
54
|
-
</choices-outline>
|
55
|
-
<choice id="default"/>
|
56
|
-
<choice id="com.mycorp.myproject" visible="false">
|
57
|
-
<pkg-ref id="com.mycorp.myproject"/>
|
58
|
-
</choice>
|
59
|
-
<pkg-ref id="com.mycorp.myproject" version="23.4.2" onConclusion="none">myproject-core.pkg</pkg-ref>
|
60
|
-
</installer-gui-script>
|
61
|
-
EOH
|
62
|
-
end
|
63
|
-
|
64
|
-
let(:expected_distribution_path) { '/var/cache/omnibus/pkg-tmp/mac-pkg/Distribution' }
|
65
|
-
|
66
|
-
let(:productbuild_argv) do
|
67
|
-
%W(
|
68
|
-
productbuild
|
69
|
-
--distribution #{expected_distribution_path}
|
70
|
-
--resources /omnibus/project/root/files/mac_pkg/Resources
|
71
|
-
/home/someuser/omnibus-myproject/pkg/myproject-23.4.2-4.pkg
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
let(:pkgbuild_argv) do
|
76
|
-
%w(
|
77
|
-
pkgbuild
|
78
|
-
--identifier com.mycorp.myproject
|
79
|
-
--version 23.4.2
|
80
|
-
--scripts /omnibus/project/root/scripts
|
81
|
-
--root /opt/myproject
|
82
|
-
--install-location /opt/myproject
|
83
|
-
myproject-core.pkg
|
84
|
-
)
|
85
|
-
end
|
86
|
-
|
87
|
-
let(:shellout_opts) do
|
88
|
-
{
|
89
|
-
timeout: 3600,
|
90
|
-
cwd: File.join(package_tmp, 'mac-pkg'),
|
91
|
-
}
|
92
|
-
end
|
93
|
-
|
94
|
-
let(:project) do
|
95
|
-
double Omnibus::Project,
|
96
|
-
name: project_name,
|
97
|
-
build_version: '23.4.2',
|
98
|
-
iteration: 4,
|
99
|
-
maintainer: "Joe's Software",
|
100
|
-
install_path: '/opt/myproject',
|
101
|
-
package_scripts_path: scripts_path,
|
102
|
-
files_path: files_path,
|
103
|
-
package_dir: package_dir,
|
104
|
-
package_tmp: package_tmp,
|
105
|
-
mac_pkg_identifier: mac_pkg_identifier
|
106
|
-
end
|
107
|
-
|
108
|
-
let(:packager) do
|
109
|
-
Omnibus::Packagers::MacPkg.new(project)
|
110
|
-
end
|
111
|
-
|
112
|
-
it "uses the project's version" do
|
113
|
-
expect(packager.version).to eq(project.build_version)
|
114
|
-
end
|
115
|
-
|
116
|
-
it "uses the project's name" do
|
117
|
-
expect(packager.name).to eq(project.name)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "uses the project's mac_pkg_identifier" do
|
121
|
-
expect(packager.identifier).to eq(mac_pkg_identifier)
|
122
|
-
end
|
123
|
-
|
124
|
-
it "uses the project's install_path as the package root" do
|
125
|
-
expect(packager.pkg_root).to eq(project.install_path)
|
126
|
-
end
|
127
|
-
|
128
|
-
it "uses the project's install_path as the package install location" do
|
129
|
-
expect(packager.install_location).to eq(project.install_path)
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'names the component package PROJECT_NAME-core.pkg' do
|
133
|
-
expect(packager.component_pkg_name).to eq('myproject-core.pkg')
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'names the product package PROJECT_NAME.pkg' do
|
137
|
-
# NOTE: #package_name is used by Project, so it's part of the **PUBLIC**
|
138
|
-
# API.
|
139
|
-
expect(packager.package_name).to eq('myproject-23.4.2-4.pkg')
|
140
|
-
expect(packager.product_pkg_name).to eq('myproject-23.4.2-4.pkg')
|
141
|
-
end
|
142
|
-
|
143
|
-
it "use's the project's package_scripts_path" do
|
144
|
-
expect(packager.scripts).to eq(project.package_scripts_path)
|
145
|
-
end
|
146
|
-
|
147
|
-
it "makes a list of required files to generate the 'product' pkg file" do
|
148
|
-
project_file_path = '/omnibus/project/root/files/mac_pkg/Resources'
|
149
|
-
required_files = %w(background.png welcome.html license.html).map do |basename|
|
150
|
-
File.join(project_file_path, basename)
|
151
|
-
end
|
152
|
-
|
153
|
-
expect(packager.required_files).to match_array(required_files)
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'validates that all required files are present' do
|
157
|
-
expected_error_text = <<-E
|
158
|
-
Your omnibus repo is missing the following files required to build Mac
|
159
|
-
packages:
|
160
|
-
* /omnibus/project/root/files/mac_pkg/Resources/background.png
|
161
|
-
* /omnibus/project/root/files/mac_pkg/Resources/license.html
|
162
|
-
* /omnibus/project/root/files/mac_pkg/Resources/welcome.html
|
163
|
-
E
|
164
|
-
# RSpec 2.14.1 doesn't do nice diffs of expected error strings, so do this
|
165
|
-
# the hard way for now.
|
166
|
-
e = nil
|
167
|
-
begin
|
168
|
-
packager.validate_omnibus_project!
|
169
|
-
rescue => e
|
170
|
-
end
|
171
|
-
expect(e).to be_a(Omnibus::MissingMacPkgResource)
|
172
|
-
expect(e.to_s).to eq(expected_error_text)
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'clears and recreates the staging dir' do
|
176
|
-
expect(FileUtils).to receive(:rm_rf).with('/var/cache/omnibus/pkg-tmp/mac-pkg')
|
177
|
-
expect(FileUtils).to receive(:mkdir_p).with('/var/cache/omnibus/pkg-tmp/mac-pkg')
|
178
|
-
packager.setup_staging_dir!
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'generates a pkgbuild command' do
|
182
|
-
expect(packager.pkgbuild_command).to eq(pkgbuild_argv)
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'runs pkgbuild' do
|
186
|
-
expected_args = pkgbuild_argv + [shellout_opts]
|
187
|
-
expect(packager).to receive(:shellout!).with(*expected_args)
|
188
|
-
packager.build_component_pkg
|
189
|
-
end
|
190
|
-
|
191
|
-
it 'has a temporary staging location for the distribution file' do
|
192
|
-
expect(packager.staging_dir).to eq('/var/cache/omnibus/pkg-tmp/mac-pkg')
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'generates a Distribution file describing the product package content' do
|
196
|
-
expect(packager.distribution).to eq(expected_distribution_content)
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'generates a productbuild command' do
|
200
|
-
expect(packager.productbuild_command).to eq(productbuild_argv)
|
201
|
-
end
|
202
|
-
|
203
|
-
describe 'building the product package' do
|
204
|
-
|
205
|
-
let(:distribution_file) { StringIO.new }
|
206
|
-
|
207
|
-
before do
|
208
|
-
expect(File).to receive(:open)
|
209
|
-
.with(expected_distribution_path, File::RDWR | File::CREAT | File::EXCL, 0600)
|
210
|
-
.and_yield(distribution_file)
|
211
|
-
end
|
212
|
-
|
213
|
-
it 'writes the distribution file to the staging directory' do
|
214
|
-
packager.generate_distribution
|
215
|
-
expect(distribution_file.string).to eq(expected_distribution_content)
|
216
|
-
end
|
217
|
-
|
218
|
-
it 'generates the distribution and runs productbuild' do
|
219
|
-
expected_shellout_args = productbuild_argv + [shellout_opts]
|
220
|
-
|
221
|
-
expect(packager).to receive(:shellout!).with(*expected_shellout_args)
|
222
|
-
packager.build_product_pkg
|
223
|
-
expect(distribution_file.string).to eq(expected_distribution_content)
|
224
|
-
end
|
225
|
-
|
226
|
-
end
|
227
|
-
context "when the mac_pkg_identifier isn't specified by the project" do
|
228
|
-
|
229
|
-
let(:mac_pkg_identifier) { nil }
|
230
|
-
let(:project_name) { 'My $Project' }
|
231
|
-
|
232
|
-
it 'sanitizes the MAINTAINER name' do
|
233
|
-
expect(packager.sanitized_maintainer).to eq('joessoftware')
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'sanitizes the project name' do
|
237
|
-
expect(packager.sanitized_name).to eq('myproject')
|
238
|
-
end
|
239
|
-
|
240
|
-
it 'uses com.example.PROJECT_NAME as the identifier' do
|
241
|
-
expect(packager.identifier).to eq('test.joessoftware.pkg.myproject')
|
242
|
-
end
|
243
|
-
|
244
|
-
end
|
245
|
-
|
246
|
-
context 'when the project has the required Resource files' do
|
247
|
-
|
248
|
-
before do
|
249
|
-
project_file_path = '/omnibus/project/root/files/mac_pkg/Resources'
|
250
|
-
%w(background.png welcome.html license.html).each do |basename|
|
251
|
-
path = File.join(project_file_path, basename)
|
252
|
-
File.stub(:exist?).with(path).and_return(true)
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
it 'validates the presence of the required files' do
|
257
|
-
expect(packager.validate_omnibus_project!).to be_true
|
258
|
-
end
|
259
|
-
|
260
|
-
end
|
261
|
-
|
262
|
-
end
|