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,25 +1,25 @@
|
|
1
|
-
require
|
1
|
+
require "stringio"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Compressor::Base do
|
5
5
|
let(:packager) { double(Packager::Base) }
|
6
|
-
let(:project) { double(Project,
|
6
|
+
let(:project) { double(Project, packagers_for_system: [packager]) }
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe ".initialize" do
|
9
9
|
subject { described_class.new(project) }
|
10
10
|
|
11
|
-
it
|
11
|
+
it "sets the project" do
|
12
12
|
expect(subject.project).to eq(project)
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it "sets the packager" do
|
16
16
|
expect(subject.packager).to eq(packager)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
subject { described_class.new(project) }
|
21
21
|
|
22
|
-
it
|
22
|
+
it "inherits from Packager" do
|
23
23
|
expect(subject).to be_a(Packager::Base)
|
24
24
|
end
|
25
25
|
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Compressor::DMG 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")
|
8
|
+
project.homepage("https://example.com")
|
9
|
+
project.install_dir("/opt/project")
|
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/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
|
-
allow(project).to receive(:
|
24
|
-
.and_return(Packager::PKG.new(project))
|
23
|
+
allow(project).to receive(:packagers_for_system)
|
24
|
+
.and_return([Packager::PKG.new(project)])
|
25
25
|
|
26
26
|
Config.project_root(project_root)
|
27
27
|
Config.package_dir(package_dir)
|
@@ -34,56 +34,56 @@ module Omnibus
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '#window_bounds' do
|
37
|
-
it
|
37
|
+
it "is a DSL method" do
|
38
38
|
expect(subject).to have_exposed_method(:window_bounds)
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
42
|
-
expect(subject.window_bounds).to eq(
|
41
|
+
it "has a default value" do
|
42
|
+
expect(subject.window_bounds).to eq("100, 100, 750, 600")
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe '#pkg_position' do
|
47
|
-
it
|
47
|
+
it "is a DSL method" do
|
48
48
|
expect(subject).to have_exposed_method(:pkg_position)
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
52
|
-
expect(subject.pkg_position).to eq(
|
51
|
+
it "has a default value" do
|
52
|
+
expect(subject.pkg_position).to eq("535, 50")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
describe '#id' do
|
57
|
-
it
|
57
|
+
it "is :dmg" do
|
58
58
|
expect(subject.id).to eq(:dmg)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe '#resources_dir' do
|
63
|
-
it
|
63
|
+
it "is nested inside the staging_dir" do
|
64
64
|
expect(subject.resources_dir).to eq("#{staging_dir}/Resources")
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
describe '#clean_disks' do
|
69
|
-
it
|
69
|
+
it "logs a message" do
|
70
70
|
allow(subject).to receive(:shellout!)
|
71
|
-
.and_return(double(Mixlib::ShellOut, stdout:
|
71
|
+
.and_return(double(Mixlib::ShellOut, stdout: ""))
|
72
72
|
|
73
73
|
output = capture_logging { subject.clean_disks }
|
74
|
-
expect(output).to include(
|
74
|
+
expect(output).to include("Cleaning previously mounted disks")
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
describe '#create_writable_dmg' do
|
79
|
-
it
|
79
|
+
it "logs a message" do
|
80
80
|
output = capture_logging { subject.create_writable_dmg }
|
81
|
-
expect(output).to include(
|
81
|
+
expect(output).to include("Creating writable dmg")
|
82
82
|
end
|
83
83
|
|
84
|
-
it
|
84
|
+
it "runs the hdiutil command" do
|
85
85
|
expect(subject).to receive(:shellout!)
|
86
|
-
.with <<-EOH.gsub(/^ {12}/,
|
86
|
+
.with <<-EOH.gsub(/^ {12}/, "")
|
87
87
|
hdiutil create \\
|
88
88
|
-srcfolder "#{staging_dir}/Resources" \\
|
89
89
|
-volname "Project" \\
|
@@ -106,14 +106,14 @@ module Omnibus
|
|
106
106
|
|
107
107
|
let(:shellout) { double(Mixlib::ShellOut, stdout: "hello\n") }
|
108
108
|
|
109
|
-
it
|
109
|
+
it "logs a message" do
|
110
110
|
output = capture_logging { subject.attach_dmg }
|
111
|
-
expect(output).to include(
|
111
|
+
expect(output).to include("Attaching dmg as disk")
|
112
112
|
end
|
113
113
|
|
114
|
-
it
|
114
|
+
it "runs the hdiutil command" do
|
115
115
|
expect(subject).to receive(:shellout!)
|
116
|
-
.with <<-EOH.gsub(/^ {12}/,
|
116
|
+
.with <<-EOH.gsub(/^ {12}/, "")
|
117
117
|
hdiutil attach \\
|
118
118
|
-readwrite \\
|
119
119
|
-noverify \\
|
@@ -124,22 +124,22 @@ module Omnibus
|
|
124
124
|
subject.attach_dmg
|
125
125
|
end
|
126
126
|
|
127
|
-
it
|
128
|
-
expect(subject.attach_dmg).to eq(
|
127
|
+
it "returns the stripped stdout" do
|
128
|
+
expect(subject.attach_dmg).to eq("hello")
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
132
|
describe '#set_volume_icon' do
|
133
|
-
it
|
133
|
+
it "logs a message" do
|
134
134
|
output = capture_logging { subject.set_volume_icon }
|
135
|
-
expect(output).to include(
|
135
|
+
expect(output).to include("Setting volume icon")
|
136
136
|
end
|
137
137
|
|
138
|
-
it
|
139
|
-
icon = subject.resource_path(
|
138
|
+
it "runs the sips commands" do
|
139
|
+
icon = subject.resource_path("icon.png")
|
140
140
|
|
141
141
|
expect(subject).to receive(:shellout!)
|
142
|
-
.with <<-EOH.gsub(/^ {12}/,
|
142
|
+
.with <<-EOH.gsub(/^ {12}/, "")
|
143
143
|
# Generate the icns
|
144
144
|
mkdir tmp.iconset
|
145
145
|
sips -z 16 16 #{icon} --out tmp.iconset/icon_16x16.png
|
@@ -166,42 +166,42 @@ module Omnibus
|
|
166
166
|
end
|
167
167
|
|
168
168
|
describe '#prettify_dmg' do
|
169
|
-
it
|
169
|
+
it "logs a message" do
|
170
170
|
output = capture_logging { subject.prettify_dmg }
|
171
|
-
expect(output).to include(
|
171
|
+
expect(output).to include("Making the dmg all pretty and stuff")
|
172
172
|
end
|
173
173
|
|
174
|
-
it
|
174
|
+
it "renders the apple script template" do
|
175
175
|
subject.prettify_dmg
|
176
176
|
expect("#{staging_dir}/create_dmg.osascript").to be_a_file
|
177
177
|
end
|
178
178
|
|
179
|
-
it
|
179
|
+
it "has the correct content" do
|
180
180
|
subject.prettify_dmg
|
181
181
|
contents = File.read("#{staging_dir}/create_dmg.osascript")
|
182
182
|
|
183
183
|
expect(contents).to include('tell application "Finder"')
|
184
184
|
expect(contents).to include(' tell disk "Project"')
|
185
|
-
expect(contents).to include(
|
186
|
-
expect(contents).to include(
|
187
|
-
expect(contents).to include(
|
188
|
-
expect(contents).to include(
|
189
|
-
expect(contents).to include(
|
190
|
-
expect(contents).to include(
|
191
|
-
expect(contents).to include(
|
192
|
-
expect(contents).to include(
|
185
|
+
expect(contents).to include(" open")
|
186
|
+
expect(contents).to include(" set current view of container window to icon view")
|
187
|
+
expect(contents).to include(" set toolbar visible of container window to false")
|
188
|
+
expect(contents).to include(" set statusbar visible of container window to false")
|
189
|
+
expect(contents).to include(" set the bounds of container window to {100, 100, 750, 600}")
|
190
|
+
expect(contents).to include(" set theViewOptions to the icon view options of container window")
|
191
|
+
expect(contents).to include(" set arrangement of theViewOptions to not arranged")
|
192
|
+
expect(contents).to include(" set icon size of theViewOptions to 72")
|
193
193
|
expect(contents).to include(' set background picture of theViewOptions to file ".support:background.png"')
|
194
|
-
expect(contents).to include(
|
194
|
+
expect(contents).to include(" delay 5")
|
195
195
|
expect(contents).to include(' set position of item "project-1.2.3-2.pkg" of container window to {535, 50}')
|
196
|
-
expect(contents).to include(
|
197
|
-
expect(contents).to include(
|
198
|
-
expect(contents).to include(
|
199
|
-
expect(contents).to include(
|
196
|
+
expect(contents).to include(" update without registering applications")
|
197
|
+
expect(contents).to include(" delay 5")
|
198
|
+
expect(contents).to include(" end tell")
|
199
|
+
expect(contents).to include("end tell")
|
200
200
|
end
|
201
201
|
|
202
|
-
it
|
202
|
+
it "runs the apple script" do
|
203
203
|
expect(subject).to receive(:shellout!)
|
204
|
-
.with <<-EOH.gsub(/^ {12}/,
|
204
|
+
.with <<-EOH.gsub(/^ {12}/, "")
|
205
205
|
osascript "#{staging_dir}/create_dmg.osascript"
|
206
206
|
EOH
|
207
207
|
|
@@ -210,17 +210,17 @@ module Omnibus
|
|
210
210
|
end
|
211
211
|
|
212
212
|
describe '#compress_dmg' do
|
213
|
-
it
|
213
|
+
it "logs a message" do
|
214
214
|
output = capture_logging { subject.compress_dmg }
|
215
|
-
expect(output).to include(
|
215
|
+
expect(output).to include("Compressing dmg")
|
216
216
|
end
|
217
217
|
|
218
|
-
it
|
219
|
-
device =
|
218
|
+
it "runs the magical command series" do
|
219
|
+
device = "/dev/sda1"
|
220
220
|
subject.instance_variable_set(:@device, device)
|
221
221
|
|
222
222
|
expect(subject).to receive(:shellout!)
|
223
|
-
.with <<-EOH.gsub(/^ {12}/,
|
223
|
+
.with <<-EOH.gsub(/^ {12}/, "")
|
224
224
|
chmod -Rf go-w /Volumes/Project
|
225
225
|
sync
|
226
226
|
hdiutil detach "#{device}"
|
@@ -238,16 +238,16 @@ module Omnibus
|
|
238
238
|
end
|
239
239
|
|
240
240
|
describe '#set_dmg_icon' do
|
241
|
-
it
|
241
|
+
it "logs a message" do
|
242
242
|
output = capture_logging { subject.set_dmg_icon }
|
243
|
-
expect(output).to include(
|
243
|
+
expect(output).to include("Setting dmg icon")
|
244
244
|
end
|
245
245
|
|
246
|
-
it
|
247
|
-
icon = subject.resource_path(
|
246
|
+
it "runs the sips commands" do
|
247
|
+
icon = subject.resource_path("icon.png")
|
248
248
|
|
249
249
|
expect(subject).to receive(:shellout!)
|
250
|
-
.with <<-EOH.gsub(/^ {12}/,
|
250
|
+
.with <<-EOH.gsub(/^ {12}/, "")
|
251
251
|
# Convert the png to an icon
|
252
252
|
sips -i "#{icon}"
|
253
253
|
|
@@ -267,12 +267,12 @@ module Omnibus
|
|
267
267
|
|
268
268
|
describe '#package_name' do
|
269
269
|
it 'reflects the packager\'s unmodified package_name' do
|
270
|
-
expect(subject.package_name).to eq(
|
270
|
+
expect(subject.package_name).to eq("project-1.2.3-2.dmg")
|
271
271
|
end
|
272
272
|
|
273
273
|
it 'reflects the packager\'s modified package_name' do
|
274
|
-
package_basename =
|
275
|
-
allow(project.
|
274
|
+
package_basename = "projectsub-1.2.3-3"
|
275
|
+
allow(project.packagers_for_system[0]).to receive(:package_name)
|
276
276
|
.and_return("#{package_basename}.pkg")
|
277
277
|
|
278
278
|
expect(subject.package_name).to eq("#{package_basename}.dmg")
|
@@ -280,19 +280,19 @@ module Omnibus
|
|
280
280
|
end
|
281
281
|
|
282
282
|
describe '#writable_dmg' do
|
283
|
-
it
|
283
|
+
it "is in the staging_dir" do
|
284
284
|
expect(subject.writable_dmg).to include(staging_dir)
|
285
285
|
end
|
286
286
|
|
287
|
-
it
|
288
|
-
expect(subject.writable_dmg).to include(
|
287
|
+
it "is project-writable" do
|
288
|
+
expect(subject.writable_dmg).to include("project-writable.dmg")
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
292
|
describe '#volume_name' do
|
293
|
-
it
|
294
|
-
project.friendly_name(
|
295
|
-
expect(subject.volume_name).to eq(
|
293
|
+
it "is the project friendly_name" do
|
294
|
+
project.friendly_name("Friendly Bacon Bits")
|
295
|
+
expect(subject.volume_name).to eq("Friendly Bacon Bits")
|
296
296
|
end
|
297
297
|
end
|
298
298
|
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Compressor::Null do
|
5
5
|
let(:packager) { double(Packager::Base) }
|
6
|
-
let(:project) { double(Project,
|
6
|
+
let(:project) { double(Project, packagers_for_system: [packager]) }
|
7
7
|
|
8
8
|
subject { described_class.new(project) }
|
9
9
|
|
10
10
|
describe '#id' do
|
11
|
-
it
|
11
|
+
it "is :dmg" do
|
12
12
|
expect(subject.id).to eq(:null)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#run!' do
|
17
|
-
it
|
17
|
+
it "does nothing" do
|
18
18
|
expect(subject).to_not receive(:instance_eval)
|
19
19
|
subject.run!
|
20
20
|
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Compressor::TGZ 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")
|
8
|
+
project.homepage("https://example.com")
|
9
|
+
project.install_dir("/opt/project")
|
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/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
23
|
create_directory(project_root)
|
24
24
|
create_directory(package_dir)
|
25
25
|
create_directory(staging_dir)
|
26
26
|
|
27
|
-
allow(project).to receive(:
|
28
|
-
.and_return(Packager::PKG.new(project))
|
27
|
+
allow(project).to receive(:packagers_for_system)
|
28
|
+
.and_return([Packager::PKG.new(project)])
|
29
29
|
|
30
30
|
Config.project_root(project_root)
|
31
31
|
Config.package_dir(package_dir)
|
@@ -37,30 +37,30 @@ module Omnibus
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe '#package_name' do
|
40
|
-
it
|
41
|
-
expect(subject.package_name).to eq(
|
40
|
+
it "returns the name of the packager" do
|
41
|
+
expect(subject.package_name).to eq("project-1.2.3-2.pkg.tar.gz")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#write_tgz' do
|
46
46
|
before do
|
47
|
-
File.open("#{staging_dir}/project-1.2.3-2.pkg",
|
48
|
-
f.write " "*1_000_000
|
47
|
+
File.open("#{staging_dir}/project-1.2.3-2.pkg", "wb") do |f|
|
48
|
+
f.write " " * 1_000_000
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
it
|
52
|
+
it "generates the file" do
|
53
53
|
subject.write_tgz
|
54
54
|
expect("#{staging_dir}/project-1.2.3-2.pkg.tar.gz").to be_a_file
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
57
|
+
it "has the correct content" do
|
58
58
|
subject.write_tgz
|
59
|
-
file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz",
|
59
|
+
file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz", "rb")
|
60
60
|
contents = file.read
|
61
61
|
file.close
|
62
62
|
|
63
|
-
expect(contents).to include("\x1F\x8B\b\x00".force_encoding(
|
63
|
+
expect(contents).to include("\x1F\x8B\b\x00".force_encoding("ASCII-8BIT"))
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
data/spec/unit/config_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Config do
|
5
5
|
subject { described_class.instance }
|
6
6
|
|
7
|
-
it
|
7
|
+
it "extends Util" do
|
8
8
|
expect(subject).to be_a(Util)
|
9
9
|
end
|
10
10
|
|
@@ -16,7 +16,7 @@ module Omnibus
|
|
16
16
|
allow(File).to receive(:expand_path) { |arg| arg }
|
17
17
|
end
|
18
18
|
|
19
|
-
shared_examples
|
19
|
+
shared_examples "a configurable" do |id, default|
|
20
20
|
it "responds to .#{id}" do
|
21
21
|
expect(described_class).to respond_to(id)
|
22
22
|
end
|
@@ -25,71 +25,72 @@ module Omnibus
|
|
25
25
|
expect(described_class.send(id)).to eq(default)
|
26
26
|
end
|
27
27
|
|
28
|
-
it_behaves_like
|
29
|
-
it_behaves_like
|
28
|
+
it_behaves_like "a cleanroom getter", id, default
|
29
|
+
it_behaves_like "a cleanroom setter", id, %{#{id}(#{default.inspect})}
|
30
30
|
end
|
31
31
|
|
32
|
-
include_examples
|
33
|
-
include_examples
|
34
|
-
include_examples
|
35
|
-
include_examples
|
36
|
-
include_examples
|
37
|
-
include_examples
|
38
|
-
include_examples
|
39
|
-
include_examples
|
40
|
-
include_examples
|
41
|
-
include_examples
|
42
|
-
include_examples
|
43
|
-
include_examples
|
44
|
-
include_examples
|
45
|
-
include_examples
|
46
|
-
include_examples
|
32
|
+
include_examples "a configurable", :base_dir, "/var/cache/omnibus"
|
33
|
+
include_examples "a configurable", :cache_dir, "/var/cache/omnibus/cache"
|
34
|
+
include_examples "a configurable", :git_cache_dir, "/var/cache/omnibus/cache/git_cache"
|
35
|
+
include_examples "a configurable", :source_dir, "/var/cache/omnibus/src"
|
36
|
+
include_examples "a configurable", :build_dir, "/var/cache/omnibus/build"
|
37
|
+
include_examples "a configurable", :package_dir, "/var/cache/omnibus/pkg"
|
38
|
+
include_examples "a configurable", :project_root, Dir.pwd
|
39
|
+
include_examples "a configurable", :local_software_dirs, []
|
40
|
+
include_examples "a configurable", :software_gems, ["omnibus-software"]
|
41
|
+
include_examples "a configurable", :solaris_linker_mapfile, "files/mapfiles/solaris"
|
42
|
+
include_examples "a configurable", :append_timestamp, true
|
43
|
+
include_examples "a configurable", :build_retries, 0
|
44
|
+
include_examples "a configurable", :use_git_caching, true
|
45
|
+
include_examples "a configurable", :fetcher_read_timeout, 60
|
46
|
+
include_examples "a configurable", :fetcher_retries, 5
|
47
|
+
include_examples "a configurable", :fatal_licensing_warnings, false
|
47
48
|
|
48
49
|
describe '#workers' do
|
49
|
-
context
|
50
|
+
context "when the Ohai data is not present" do
|
50
51
|
before do
|
51
|
-
stub_ohai(platform:
|
52
|
-
data[
|
52
|
+
stub_ohai(platform: "ubuntu", version: "12.04") do |data|
|
53
|
+
data["cpu"] = nil
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
|
-
it
|
57
|
+
it "defaults to 3" do
|
57
58
|
expect(described_class.workers).to eq(3)
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
61
|
-
context
|
62
|
+
context "when the Ohai data is present" do
|
62
63
|
before do
|
63
|
-
stub_ohai(platform:
|
64
|
-
data[
|
64
|
+
stub_ohai(platform: "ubuntu", version: "12.04") do |data|
|
65
|
+
data["cpu"] = { "total" => "5" }
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
it
|
69
|
+
it "defaults to the value + 6" do
|
69
70
|
expect(described_class.workers).to eq(6)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
context
|
75
|
-
before { stub_ohai(platform:
|
75
|
+
context "on Windows" do
|
76
|
+
before { stub_ohai(platform: "windows", version: "2012") }
|
76
77
|
|
77
|
-
include_examples
|
78
|
-
include_examples
|
79
|
-
include_examples
|
80
|
-
include_examples
|
81
|
-
include_examples
|
82
|
-
include_examples
|
78
|
+
include_examples "a configurable", :base_dir, "C:/omnibus-ruby"
|
79
|
+
include_examples "a configurable", :cache_dir, "C:/omnibus-ruby/cache"
|
80
|
+
include_examples "a configurable", :git_cache_dir, "C:/omnibus-ruby/cache/git_cache"
|
81
|
+
include_examples "a configurable", :source_dir, "C:/omnibus-ruby/src"
|
82
|
+
include_examples "a configurable", :build_dir, "C:/omnibus-ruby/build"
|
83
|
+
include_examples "a configurable", :package_dir, "C:/omnibus-ruby/pkg"
|
83
84
|
end
|
84
85
|
|
85
|
-
context
|
86
|
-
before { described_class.base_dir(
|
86
|
+
context "when base_dir is changed" do
|
87
|
+
before { described_class.base_dir("/foo/bar") }
|
87
88
|
|
88
|
-
include_examples
|
89
|
-
include_examples
|
90
|
-
include_examples
|
91
|
-
include_examples
|
92
|
-
include_examples
|
89
|
+
include_examples "a configurable", :cache_dir, "/foo/bar/cache"
|
90
|
+
include_examples "a configurable", :git_cache_dir, "/foo/bar/cache/git_cache"
|
91
|
+
include_examples "a configurable", :source_dir, "/foo/bar/src"
|
92
|
+
include_examples "a configurable", :build_dir, "/foo/bar/build"
|
93
|
+
include_examples "a configurable", :package_dir, "/foo/bar/pkg"
|
93
94
|
end
|
94
95
|
end
|
95
96
|
end
|
@@ -1,37 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Digestable do
|
5
|
-
let(:path) {
|
5
|
+
let(:path) { "/path/to/file" }
|
6
6
|
let(:io) { StringIO.new }
|
7
7
|
|
8
8
|
subject { Class.new { include Digestable }.new }
|
9
9
|
|
10
10
|
describe '#digest' do
|
11
|
-
it
|
11
|
+
it "reads the IO in chunks" do
|
12
12
|
expect(File).to receive(:open).with(path).and_yield(io)
|
13
|
-
expect(subject.digest(path)).to eq(
|
13
|
+
expect(subject.digest(path)).to eq("d41d8cd98f00b204e9800998ecf8427e")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#digest_directory' do
|
18
|
-
let(:path) {
|
18
|
+
let(:path) { "/path/to/dir" }
|
19
19
|
let(:glob) { "#{path}/**/*" }
|
20
|
-
let(:subdir) {
|
21
|
-
let(:subfile) {
|
20
|
+
let(:subdir) { "/path/to/dir/subdir" }
|
21
|
+
let(:subfile) { "/path/to/dir/subfile" }
|
22
22
|
let(:io) { StringIO.new }
|
23
23
|
|
24
|
-
it
|
24
|
+
it "inspects the file types of glob entries" do
|
25
25
|
expect(FileSyncer).to receive(:glob).with(glob).and_return([subdir])
|
26
|
-
expect(File).to receive(:ftype).with(subdir).and_return(
|
27
|
-
expect(subject.digest_directory(path)).to eq(
|
26
|
+
expect(File).to receive(:ftype).with(subdir).and_return("directory")
|
27
|
+
expect(subject.digest_directory(path)).to eq("8b91792e7917b1152d8494670caaeb85")
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it "inspects the contents of the files" do
|
31
31
|
expect(FileSyncer).to receive(:glob).with(glob).and_return([subfile])
|
32
|
-
expect(File).to receive(:ftype).with(subfile).and_return(
|
32
|
+
expect(File).to receive(:ftype).with(subfile).and_return("file")
|
33
33
|
expect(File).to receive(:open).with(subfile).and_yield(io)
|
34
|
-
expect(subject.digest_directory(path)).to eq(
|
34
|
+
expect(subject.digest_directory(path)).to eq("c8f023976b95ace2ae3678540fd3b4f1")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|