omnibus 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +8 -5
- data/README.md +3 -1
- data/Rakefile +20 -13
- data/appveyor.yml +4 -3
- data/bin/omnibus +3 -3
- data/features/commands/manifest.feature +19 -5
- data/features/step_definitions/generator_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/lib/omnibus/build_version.rb +14 -14
- data/lib/omnibus/build_version_dsl.rb +3 -3
- data/lib/omnibus/builder.rb +50 -61
- data/lib/omnibus/changelog.rb +2 -2
- data/lib/omnibus/changelog_printer.rb +4 -4
- data/lib/omnibus/cleaner.rb +4 -4
- data/lib/omnibus/cli/base.rb +15 -15
- data/lib/omnibus/cli/cache.rb +13 -13
- data/lib/omnibus/cli/changelog.rb +8 -9
- data/lib/omnibus/cli/publish.rb +12 -13
- data/lib/omnibus/cli.rb +26 -27
- data/lib/omnibus/compressor.rb +6 -6
- data/lib/omnibus/compressors/base.rb +7 -2
- data/lib/omnibus/compressors/dmg.rb +12 -12
- data/lib/omnibus/compressors/null.rb +1 -1
- data/lib/omnibus/compressors/tgz.rb +8 -8
- data/lib/omnibus/config.rb +37 -26
- data/lib/omnibus/core_extensions/open_uri.rb +3 -3
- data/lib/omnibus/core_extensions.rb +1 -1
- data/lib/omnibus/digestable.rb +5 -4
- data/lib/omnibus/download_helpers.rb +7 -6
- data/lib/omnibus/exceptions.rb +29 -13
- data/lib/omnibus/fetcher.rb +0 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +3 -3
- data/lib/omnibus/generator.rb +60 -47
- data/lib/omnibus/git_cache.rb +33 -22
- data/lib/omnibus/git_repository.rb +5 -5
- data/lib/omnibus/health_check.rb +122 -119
- data/lib/omnibus/instrumentation.rb +1 -1
- data/lib/omnibus/licensing.rb +348 -60
- data/lib/omnibus/logger.rb +12 -9
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/manifest.rb +4 -4
- data/lib/omnibus/manifest_diff.rb +6 -7
- data/lib/omnibus/manifest_entry.rb +1 -1
- data/lib/omnibus/metadata.rb +36 -36
- data/lib/omnibus/ohai.rb +6 -7
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +37 -28
- data/lib/omnibus/packagers/appx.rb +86 -0
- data/lib/omnibus/packagers/base.rb +21 -18
- data/lib/omnibus/packagers/bff.rb +22 -24
- data/lib/omnibus/packagers/deb.rb +20 -20
- data/lib/omnibus/packagers/ips.rb +18 -17
- data/lib/omnibus/packagers/makeself.rb +7 -7
- data/lib/omnibus/packagers/msi.rb +38 -193
- data/lib/omnibus/packagers/pkg.rb +16 -16
- data/lib/omnibus/packagers/rpm.rb +53 -54
- data/lib/omnibus/packagers/solaris.rb +14 -14
- data/lib/omnibus/packagers/windows_base.rb +192 -0
- data/lib/omnibus/project.rb +45 -43
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
- data/lib/omnibus/publishers/s3_publisher.rb +7 -7
- data/lib/omnibus/reports.rb +10 -10
- data/lib/omnibus/s3_cache.rb +7 -7
- data/lib/omnibus/s3_helpers.rb +8 -7
- data/lib/omnibus/semantic_version.rb +1 -1
- data/lib/omnibus/software.rb +131 -81
- data/lib/omnibus/sugarable.rb +10 -10
- data/lib/omnibus/templating.rb +5 -5
- data/lib/omnibus/thread_pool.rb +1 -1
- data/lib/omnibus/util.rb +5 -5
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus.rb +65 -65
- data/omnibus.gemspec +34 -32
- data/resources/appx/AppxManifest.xml.erb +18 -0
- data/resources/appx/assets/clear.png +0 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
- data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
- data/spec/functional/builder_spec.rb +149 -150
- data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
- data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
- data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
- data/spec/functional/file_syncer_spec.rb +74 -74
- data/spec/functional/licensing_spec.rb +344 -35
- data/spec/functional/templating_spec.rb +17 -17
- data/spec/spec_helper.rb +20 -20
- data/spec/support/examples.rb +21 -15
- data/spec/support/file_helpers.rb +1 -1
- data/spec/support/git_helpers.rb +37 -37
- data/spec/support/matchers.rb +3 -3
- data/spec/support/ohai_helpers.rb +4 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/support/shell_helpers.rb +2 -2
- data/spec/unit/build_version_dsl_spec.rb +5 -5
- data/spec/unit/build_version_spec.rb +63 -63
- data/spec/unit/builder_spec.rb +86 -70
- data/spec/unit/changelog_spec.rb +4 -4
- data/spec/unit/changelogprinter_spec.rb +130 -0
- data/spec/unit/cleanroom_spec.rb +11 -11
- data/spec/unit/compressor_spec.rb +16 -16
- data/spec/unit/compressors/base_spec.rb +6 -6
- data/spec/unit/compressors/dmg_spec.rb +76 -76
- data/spec/unit/compressors/null_spec.rb +4 -4
- data/spec/unit/compressors/tgz_spec.rb +20 -20
- data/spec/unit/config_spec.rb +44 -43
- data/spec/unit/digestable_spec.rb +13 -13
- data/spec/unit/fetcher_spec.rb +11 -12
- data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
- data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
- data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
- data/spec/unit/generator_spec.rb +38 -38
- data/spec/unit/git_cache_spec.rb +56 -54
- data/spec/unit/git_repository_spec.rb +2 -2
- data/spec/unit/health_check_spec.rb +40 -40
- data/spec/unit/library_spec.rb +35 -35
- data/spec/unit/manifest_diff_spec.rb +10 -11
- data/spec/unit/manifest_spec.rb +17 -17
- data/spec/unit/metadata_spec.rb +152 -152
- data/spec/unit/ohai_spec.rb +5 -5
- data/spec/unit/omnibus_spec.rb +31 -31
- data/spec/unit/package_spec.rb +20 -20
- data/spec/unit/packager_spec.rb +48 -42
- data/spec/unit/packagers/appx_spec.rb +165 -0
- data/spec/unit/packagers/base_spec.rb +34 -34
- data/spec/unit/packagers/bff_spec.rb +60 -60
- data/spec/unit/packagers/deb_spec.rb +71 -71
- data/spec/unit/packagers/ips_spec.rb +45 -45
- data/spec/unit/packagers/makeself_spec.rb +22 -22
- data/spec/unit/packagers/msi_spec.rb +141 -147
- data/spec/unit/packagers/pkg_spec.rb +59 -60
- data/spec/unit/packagers/rpm_spec.rb +125 -126
- data/spec/unit/packagers/solaris_spec.rb +52 -52
- data/spec/unit/project_spec.rb +137 -135
- data/spec/unit/publisher_spec.rb +70 -70
- data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
- data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
- data/spec/unit/s3_cacher_spec.rb +34 -34
- data/spec/unit/s3_helpers_spec.rb +6 -6
- data/spec/unit/semantic_version_spec.rb +2 -2
- data/spec/unit/software_spec.rb +346 -384
- data/spec/unit/sugarable_spec.rb +10 -10
- data/spec/unit/util_spec.rb +60 -60
- metadata +54 -6
- data/.rubocop.yml +0 -48
@@ -1,26 +1,26 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Packager::PKG do
|
5
5
|
let(:project) do
|
6
6
|
Project.new.tap do |project|
|
7
|
-
project.name(
|
8
|
-
project.homepage(
|
9
|
-
project.install_dir(
|
10
|
-
project.build_version(
|
11
|
-
project.build_iteration(
|
12
|
-
project.maintainer(
|
7
|
+
project.name("project-full-name")
|
8
|
+
project.homepage("https://example.com")
|
9
|
+
project.install_dir("/opt/project-full-name")
|
10
|
+
project.build_version("1.2.3")
|
11
|
+
project.build_iteration("2")
|
12
|
+
project.maintainer("Chef Software")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) { File.join(tmp_path,
|
19
|
-
let(:package_dir) { File.join(tmp_path,
|
20
|
-
let(:staging_dir) { File.join(tmp_path,
|
18
|
+
let(:project_root) { File.join(tmp_path, "project-full-name/root") }
|
19
|
+
let(:package_dir) { File.join(tmp_path, "package/dir") }
|
20
|
+
let(:staging_dir) { File.join(tmp_path, "staging/dir") }
|
21
21
|
|
22
22
|
before do
|
23
|
-
subject.identifier(
|
23
|
+
subject.identifier("com.getchef.project-full-name")
|
24
24
|
|
25
25
|
Config.project_root(project_root)
|
26
26
|
Config.package_dir(package_dir)
|
@@ -30,43 +30,43 @@ module Omnibus
|
|
30
30
|
create_directory("#{staging_dir}/Scripts")
|
31
31
|
end
|
32
32
|
|
33
|
-
describe
|
34
|
-
it
|
33
|
+
describe "DSL" do
|
34
|
+
it "exposes :identifier" do
|
35
35
|
expect(subject).to have_exposed_method(:identifier)
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
38
|
+
it "exposes :signing_identity" do
|
39
39
|
expect(subject).to have_exposed_method(:signing_identity)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe '#id' do
|
44
|
-
it
|
44
|
+
it "is :pkg" do
|
45
45
|
expect(subject.id).to eq(:pkg)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe '#package_name' do
|
50
|
-
it
|
51
|
-
expect(subject.package_name).to eq(
|
50
|
+
it "includes the name, version, and build iteration" do
|
51
|
+
expect(subject.package_name).to eq("project-full-name-1.2.3-2.pkg")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe '#resources_dir' do
|
56
|
-
it
|
56
|
+
it "is nested inside the staging_dir" do
|
57
57
|
expect(subject.resources_dir).to eq("#{staging_dir}/Resources")
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe '#scripts_dir' do
|
62
|
-
it
|
62
|
+
it "is nested inside the staging_dir" do
|
63
63
|
expect(subject.scripts_dir).to eq("#{staging_dir}/Scripts")
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe '#write_scripts' do
|
68
|
-
context
|
69
|
-
let(:scripts) { %w
|
68
|
+
context "when scripts are given" do
|
69
|
+
let(:scripts) { %w{ preinstall postinstall } }
|
70
70
|
before do
|
71
71
|
scripts.each do |script_name|
|
72
72
|
create_file("#{project_root}/package-scripts/project-full-name/#{script_name}") do
|
@@ -75,7 +75,7 @@ module Omnibus
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
it
|
78
|
+
it "writes the scripts into scripts staging dir" do
|
79
79
|
subject.write_scripts
|
80
80
|
|
81
81
|
scripts.each do |script_name|
|
@@ -86,8 +86,8 @@ module Omnibus
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
context
|
90
|
-
let(:default_scripts) { %w
|
89
|
+
context "when scripts with default omnibus naming are given" do
|
90
|
+
let(:default_scripts) { %w{ preinst postinst } }
|
91
91
|
before do
|
92
92
|
default_scripts.each do |script_name|
|
93
93
|
create_file("#{project_root}/package-scripts/project-full-name/#{script_name}") do
|
@@ -96,7 +96,7 @@ module Omnibus
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
it
|
99
|
+
it "writes the scripts into scripts staging dir" do
|
100
100
|
subject.write_scripts
|
101
101
|
|
102
102
|
default_scripts.each do |script_name|
|
@@ -109,10 +109,9 @@ module Omnibus
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
|
113
112
|
describe '#build_component_pkg' do
|
114
|
-
it
|
115
|
-
expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {10}/,
|
113
|
+
it "executes the pkgbuild command" do
|
114
|
+
expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {10}/, "")
|
116
115
|
pkgbuild \\
|
117
116
|
--identifier "com.getchef.project-full-name" \\
|
118
117
|
--version "1.2.3" \\
|
@@ -127,25 +126,25 @@ module Omnibus
|
|
127
126
|
end
|
128
127
|
|
129
128
|
describe '#write_distribution_file' do
|
130
|
-
it
|
129
|
+
it "generates the file" do
|
131
130
|
subject.write_distribution_file
|
132
131
|
expect("#{staging_dir}/Distribution").to be_a_file
|
133
132
|
end
|
134
133
|
|
135
|
-
it
|
134
|
+
it "has the correct content" do
|
136
135
|
subject.write_distribution_file
|
137
136
|
contents = File.read("#{staging_dir}/Distribution")
|
138
137
|
|
139
138
|
expect(contents).to include('<pkg-ref id="com.getchef.project-full-name"/>')
|
140
139
|
expect(contents).to include('<line choice="com.getchef.project-full-name"/>')
|
141
|
-
expect(contents).to include(
|
140
|
+
expect(contents).to include("project-full-name-core.pkg")
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
145
144
|
describe '#build_product_pkg' do
|
146
|
-
context
|
147
|
-
it
|
148
|
-
expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/,
|
145
|
+
context "when pkg signing is disabled" do
|
146
|
+
it "generates the distribution and runs productbuild" do
|
147
|
+
expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/, "")
|
149
148
|
productbuild \\
|
150
149
|
--distribution "#{staging_dir}/Distribution" \\
|
151
150
|
--resources "#{staging_dir}/Resources" \\
|
@@ -156,13 +155,13 @@ module Omnibus
|
|
156
155
|
end
|
157
156
|
end
|
158
157
|
|
159
|
-
context
|
158
|
+
context "when pkg signing is enabled" do
|
160
159
|
before do
|
161
|
-
subject.signing_identity(
|
160
|
+
subject.signing_identity("My Special Identity")
|
162
161
|
end
|
163
162
|
|
164
|
-
it
|
165
|
-
expect(subject).to receive(:shellout!).with
|
163
|
+
it "includes the signing parameters in the product build command" do
|
164
|
+
expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {12}/, "")
|
166
165
|
productbuild \\
|
167
166
|
--distribution "#{staging_dir}/Distribution" \\
|
168
167
|
--resources "#{staging_dir}/Resources" \\
|
@@ -179,32 +178,32 @@ module Omnibus
|
|
179
178
|
project.name('$Project#')
|
180
179
|
end
|
181
180
|
|
182
|
-
it
|
183
|
-
expect(subject.safe_identifier).to eq(
|
181
|
+
it "uses com.example.PROJECT_NAME as the identifier" do
|
182
|
+
expect(subject.safe_identifier).to eq("test.chefsoftware.pkg.project")
|
184
183
|
end
|
185
184
|
end
|
186
185
|
end
|
187
186
|
|
188
187
|
describe '#component_pkg' do
|
189
|
-
it
|
190
|
-
expect(subject.component_pkg).to eq(
|
188
|
+
it "returns the project name with -core.pkg" do
|
189
|
+
expect(subject.component_pkg).to eq("project-full-name-core.pkg")
|
191
190
|
end
|
192
191
|
end
|
193
192
|
|
194
193
|
describe '#safe_base_package_name' do
|
195
194
|
context 'when the project name is "safe"' do
|
196
|
-
it
|
197
|
-
expect(subject.safe_base_package_name).to eq(
|
195
|
+
it "returns the value without logging a message" do
|
196
|
+
expect(subject.safe_base_package_name).to eq("project-full-name")
|
198
197
|
expect(subject).to_not receive(:log)
|
199
198
|
end
|
200
199
|
end
|
201
200
|
|
202
|
-
context
|
201
|
+
context "when the project name has invalid characters" do
|
203
202
|
before { project.name("$Project123.for-realz_2") }
|
204
203
|
|
205
|
-
it
|
204
|
+
it "returns the value while logging a message" do
|
206
205
|
output = capture_logging do
|
207
|
-
expect(subject.safe_base_package_name).to eq(
|
206
|
+
expect(subject.safe_base_package_name).to eq("project123forrealz2")
|
208
207
|
end
|
209
208
|
|
210
209
|
expect(output).to include("The `name' component of Mac package names can only include")
|
@@ -214,18 +213,18 @@ module Omnibus
|
|
214
213
|
|
215
214
|
describe '#safe_identifier' do
|
216
215
|
context 'when Project#identifier is given' do
|
217
|
-
before { subject.identifier(
|
216
|
+
before { subject.identifier("com.apple.project") }
|
218
217
|
|
219
|
-
it
|
220
|
-
expect(subject.safe_identifier).to eq(
|
218
|
+
it "is used" do
|
219
|
+
expect(subject.safe_identifier).to eq("com.apple.project")
|
221
220
|
end
|
222
221
|
end
|
223
222
|
|
224
|
-
context
|
223
|
+
context "when no value in project is given" do
|
225
224
|
before { subject.identifier(nil) }
|
226
225
|
|
227
|
-
it
|
228
|
-
expect(subject.safe_identifier).to eq(
|
226
|
+
it "is interpreted" do
|
227
|
+
expect(subject.safe_identifier).to eq("test.chefsoftware.pkg.project-full-name")
|
229
228
|
end
|
230
229
|
end
|
231
230
|
|
@@ -237,31 +236,31 @@ module Omnibus
|
|
237
236
|
end
|
238
237
|
|
239
238
|
it 'uses the "safe" values' do
|
240
|
-
expect(subject.safe_identifier).to eq(
|
239
|
+
expect(subject.safe_identifier).to eq("test.thisissparta.pkg.project123forrealz2")
|
241
240
|
end
|
242
241
|
end
|
243
242
|
end
|
244
243
|
|
245
244
|
describe '#safe_build_iteration' do
|
246
|
-
it
|
245
|
+
it "returns the build iternation" do
|
247
246
|
expect(subject.safe_build_iteration).to eq(project.build_iteration)
|
248
247
|
end
|
249
248
|
end
|
250
249
|
|
251
250
|
describe '#safe_version' do
|
252
251
|
context 'when the project build_version is "safe"' do
|
253
|
-
it
|
254
|
-
expect(subject.safe_version).to eq(
|
252
|
+
it "returns the value without logging a message" do
|
253
|
+
expect(subject.safe_version).to eq("1.2.3")
|
255
254
|
expect(subject).to_not receive(:log)
|
256
255
|
end
|
257
256
|
end
|
258
257
|
|
259
|
-
context
|
258
|
+
context "when the project build_version has invalid characters" do
|
260
259
|
before { project.build_version("1.2$alpha.##__2") }
|
261
260
|
|
262
|
-
it
|
261
|
+
it "returns the value while logging a message" do
|
263
262
|
output = capture_logging do
|
264
|
-
expect(subject.safe_version).to eq(
|
263
|
+
expect(subject.safe_version).to eq("1.2-alpha.-2")
|
265
264
|
end
|
266
265
|
|
267
266
|
expect(output).to include("The `version' component of Mac package names can only include")
|