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,23 +1,23 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe NetFetcher do
|
5
|
-
let(:root_prefix) {
|
5
|
+
let(:root_prefix) { "" }
|
6
6
|
let(:project_dir) { "#{root_prefix}/tmp/project" }
|
7
7
|
let(:build_dir) { "#{root_prefix}/tmp/build" }
|
8
8
|
let(:source) do
|
9
|
-
{ url:
|
9
|
+
{ url: "https://get.example.com/file.tar.gz", md5: "abcd1234" }
|
10
10
|
end
|
11
11
|
|
12
12
|
let(:manifest_entry) do
|
13
13
|
double(Omnibus::ManifestEntry,
|
14
|
-
name:
|
14
|
+
name: "file",
|
15
15
|
locked_version: "1.2.3",
|
16
|
-
described_version:
|
16
|
+
described_version: "1.2.3",
|
17
17
|
locked_source: source)
|
18
18
|
end
|
19
19
|
|
20
|
-
let(:cache_dir) {
|
20
|
+
let(:cache_dir) { "/cache" }
|
21
21
|
|
22
22
|
before do
|
23
23
|
Config.cache_dir(cache_dir)
|
@@ -26,35 +26,35 @@ module Omnibus
|
|
26
26
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
27
27
|
|
28
28
|
describe '#fetch_required?' do
|
29
|
-
context
|
29
|
+
context "when file is not downloaded" do
|
30
30
|
before { allow(File).to receive(:exist?).and_return(false) }
|
31
31
|
|
32
|
-
it
|
32
|
+
it "returns true" do
|
33
33
|
expect(subject.fetch_required?).to be_truthy
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context
|
37
|
+
context "when the file is downloaded" do
|
38
38
|
before { allow(File).to receive(:exist?).and_return(true) }
|
39
39
|
|
40
|
-
context
|
40
|
+
context "when the shasums differ" do
|
41
41
|
before do
|
42
|
-
allow(subject).to receive(:digest).and_return(
|
43
|
-
allow(subject).to receive(:checksum).and_return(
|
42
|
+
allow(subject).to receive(:digest).and_return("abcd1234")
|
43
|
+
allow(subject).to receive(:checksum).and_return("efgh5678")
|
44
44
|
end
|
45
45
|
|
46
|
-
it
|
46
|
+
it "returns true" do
|
47
47
|
expect(subject.fetch_required?).to be_truthy
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
context
|
51
|
+
context "when the shasums are the same" do
|
52
52
|
before do
|
53
|
-
allow(subject).to receive(:digest).and_return(
|
54
|
-
allow(subject).to receive(:checksum).and_return(
|
53
|
+
allow(subject).to receive(:digest).and_return("abcd1234")
|
54
|
+
allow(subject).to receive(:checksum).and_return("abcd1234")
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
57
|
+
it "returns true" do
|
58
58
|
expect(subject.fetch_required?).to be(false)
|
59
59
|
end
|
60
60
|
end
|
@@ -62,39 +62,39 @@ module Omnibus
|
|
62
62
|
end
|
63
63
|
|
64
64
|
describe '#version_guid' do
|
65
|
-
context
|
66
|
-
it
|
67
|
-
expect(subject.version_guid).to eq(
|
65
|
+
context "source with md5" do
|
66
|
+
it "returns the shasum" do
|
67
|
+
expect(subject.version_guid).to eq("md5:abcd1234")
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
context
|
71
|
+
context "source with sha1" do
|
72
72
|
let(:source) do
|
73
|
-
{ url:
|
73
|
+
{ url: "https://get.example.com/file.tar.gz", sha1: "abcd1234" }
|
74
74
|
end
|
75
75
|
|
76
|
-
it
|
77
|
-
expect(subject.version_guid).to eq(
|
76
|
+
it "returns the shasum" do
|
77
|
+
expect(subject.version_guid).to eq("sha1:abcd1234")
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
context
|
81
|
+
context "source with sha256" do
|
82
82
|
let(:source) do
|
83
|
-
{ url:
|
83
|
+
{ url: "https://get.example.com/file.tar.gz", sha256: "abcd1234" }
|
84
84
|
end
|
85
85
|
|
86
|
-
it
|
87
|
-
expect(subject.version_guid).to eq(
|
86
|
+
it "returns the shasum" do
|
87
|
+
expect(subject.version_guid).to eq("sha256:abcd1234")
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
context
|
91
|
+
context "source with sha512" do
|
92
92
|
let(:source) do
|
93
|
-
{ url:
|
93
|
+
{ url: "https://get.example.com/file.tar.gz", sha512: "abcd1234" }
|
94
94
|
end
|
95
95
|
|
96
|
-
it
|
97
|
-
expect(subject.version_guid).to eq(
|
96
|
+
it "returns the shasum" do
|
97
|
+
expect(subject.version_guid).to eq("sha512:abcd1234")
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
@@ -106,72 +106,72 @@ module Omnibus
|
|
106
106
|
allow(subject).to receive(:create_required_directories)
|
107
107
|
end
|
108
108
|
|
109
|
-
context
|
109
|
+
context "when the project directory exists" do
|
110
110
|
before { allow(File).to receive(:exist?).and_return(true) }
|
111
111
|
|
112
|
-
it
|
112
|
+
it "deploys the archive" do
|
113
113
|
expect(subject).to receive(:deploy)
|
114
114
|
subject.clean
|
115
115
|
end
|
116
116
|
|
117
|
-
it
|
117
|
+
it "returns true" do
|
118
118
|
expect(subject.clean).to be_truthy
|
119
119
|
end
|
120
120
|
|
121
|
-
it
|
121
|
+
it "removes the project directory" do
|
122
122
|
expect(FileUtils).to receive(:rm_rf).with(project_dir)
|
123
123
|
subject.clean
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
context
|
127
|
+
context "when the project directory does not exist" do
|
128
128
|
before { allow(File).to receive(:exist?).and_return(false) }
|
129
129
|
|
130
|
-
it
|
130
|
+
it "deploys the archive" do
|
131
131
|
expect(subject).to receive(:deploy)
|
132
132
|
subject.clean
|
133
133
|
end
|
134
134
|
|
135
|
-
it
|
135
|
+
it "returns false" do
|
136
136
|
expect(subject.clean).to be(false)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
describe '#version_for_cache' do
|
142
|
-
context
|
143
|
-
it
|
144
|
-
expect(subject.version_for_cache).to eq(
|
142
|
+
context "source with md5" do
|
143
|
+
it "returns the download URL and md5" do
|
144
|
+
expect(subject.version_for_cache).to eq("download_url:https://get.example.com/file.tar.gz|md5:abcd1234")
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
context
|
148
|
+
context "source with sha1" do
|
149
149
|
let(:source) do
|
150
|
-
{ url:
|
150
|
+
{ url: "https://get.example.com/file.tar.gz", sha1: "abcd1234" }
|
151
151
|
end
|
152
152
|
|
153
|
-
it
|
154
|
-
expect(subject.version_for_cache).to eq(
|
153
|
+
it "returns the download URL and sha1" do
|
154
|
+
expect(subject.version_for_cache).to eq("download_url:https://get.example.com/file.tar.gz|sha1:abcd1234")
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
-
context
|
158
|
+
context "source with sha256" do
|
159
159
|
let(:source) do
|
160
|
-
{ url:
|
160
|
+
{ url: "https://get.example.com/file.tar.gz", sha256: "abcd1234" }
|
161
161
|
end
|
162
162
|
|
163
|
-
it
|
164
|
-
expect(subject.version_for_cache).to eq(
|
163
|
+
it "returns the download URL and sha256" do
|
164
|
+
expect(subject.version_for_cache).to eq("download_url:https://get.example.com/file.tar.gz|sha256:abcd1234")
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
|
-
context
|
168
|
+
context "source with sha512" do
|
169
169
|
let(:source) do
|
170
|
-
{ url:
|
170
|
+
{ url: "https://get.example.com/file.tar.gz", sha512: "abcd1234" }
|
171
171
|
end
|
172
172
|
|
173
|
-
it
|
174
|
-
expect(subject.version_for_cache).to eq(
|
173
|
+
it "returns the download URL and sha1" do
|
174
|
+
expect(subject.version_for_cache).to eq("download_url:https://get.example.com/file.tar.gz|sha512:abcd1234")
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
@@ -183,7 +183,7 @@ module Omnibus
|
|
183
183
|
"Accept-Encoding" => "identity",
|
184
184
|
:read_timeout => 60,
|
185
185
|
:content_length_proc => an_instance_of(Proc),
|
186
|
-
:progress_proc => an_instance_of(Proc)
|
186
|
+
:progress_proc => an_instance_of(Proc),
|
187
187
|
}
|
188
188
|
end
|
189
189
|
|
@@ -206,7 +206,6 @@ module Omnibus
|
|
206
206
|
$stdout = old_stdout
|
207
207
|
end
|
208
208
|
|
209
|
-
|
210
209
|
before do
|
211
210
|
expect(subject).to receive(:open).with(source[:url], expected_open_opts) do |_url, open_uri_opts|
|
212
211
|
open_uri_opts[:content_length_proc].call(reported_content_length)
|
@@ -249,20 +248,20 @@ module Omnibus
|
|
249
248
|
|
250
249
|
end
|
251
250
|
|
252
|
-
shared_examples
|
251
|
+
shared_examples "an extractor" do |extension, source_options, commands|
|
253
252
|
context "when the file is a .#{extension}" do
|
254
253
|
let(:manifest_entry) do
|
255
254
|
double(Omnibus::ManifestEntry,
|
256
|
-
name:
|
255
|
+
name: "file",
|
257
256
|
locked_version: "1.2.3",
|
258
|
-
described_version:
|
259
|
-
locked_source: { url: "https://get.example.com/file.#{extension}", md5:
|
257
|
+
described_version: "1.2.3",
|
258
|
+
locked_source: { url: "https://get.example.com/file.#{extension}", md5: "abcd1234" }.merge(source_options)
|
260
259
|
)
|
261
260
|
end
|
262
261
|
|
263
262
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
264
263
|
|
265
|
-
it
|
264
|
+
it "shells out with the right commands" do
|
266
265
|
commands.each do |command|
|
267
266
|
if command.is_a?(String)
|
268
267
|
expect(subject).to receive(:shellout!).with(command)
|
@@ -280,13 +279,13 @@ module Omnibus
|
|
280
279
|
described_class.send(:public, :deploy)
|
281
280
|
end
|
282
281
|
|
283
|
-
context
|
282
|
+
context "when the downloaded file is a folder" do
|
284
283
|
let(:manifest_entry) do
|
285
284
|
double(Omnibus::ManifestEntry,
|
286
|
-
name:
|
285
|
+
name: "file",
|
287
286
|
locked_version: "1.2.3",
|
288
|
-
described_version:
|
289
|
-
locked_source: { url: "https://get.example.com/folder", md5:
|
287
|
+
described_version: "1.2.3",
|
288
|
+
locked_source: { url: "https://get.example.com/folder", md5: "abcd1234" })
|
290
289
|
end
|
291
290
|
|
292
291
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
@@ -295,19 +294,19 @@ module Omnibus
|
|
295
294
|
allow(File).to receive(:directory?).and_return(true)
|
296
295
|
end
|
297
296
|
|
298
|
-
it
|
297
|
+
it "copies the entire directory to project_dir" do
|
299
298
|
expect(FileUtils).to receive(:cp_r).with("#{cache_dir}/folder/.", project_dir)
|
300
299
|
subject.deploy
|
301
300
|
end
|
302
301
|
end
|
303
302
|
|
304
|
-
context
|
303
|
+
context "when the downloaded file is a regular file" do
|
305
304
|
let(:manifest_entry) do
|
306
305
|
double(Omnibus::ManifestEntry,
|
307
|
-
name:
|
306
|
+
name: "file",
|
308
307
|
locked_version: "1.2.3",
|
309
|
-
described_version:
|
310
|
-
locked_source: { url: "https://get.example.com/file", md5:
|
308
|
+
described_version: "1.2.3",
|
309
|
+
locked_source: { url: "https://get.example.com/file", md5: "abcd1234" })
|
311
310
|
end
|
312
311
|
|
313
312
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
@@ -316,7 +315,7 @@ module Omnibus
|
|
316
315
|
allow(File).to receive(:directory?).and_return(false)
|
317
316
|
end
|
318
317
|
|
319
|
-
it
|
318
|
+
it "copies the file into the project_dir" do
|
320
319
|
expect(FileUtils).to receive(:cp).with("#{cache_dir}/file", "#{project_dir}")
|
321
320
|
subject.deploy
|
322
321
|
end
|
@@ -325,143 +324,143 @@ module Omnibus
|
|
325
324
|
|
326
325
|
describe '#extract' do
|
327
326
|
|
328
|
-
context
|
329
|
-
let(:root_prefix) {
|
327
|
+
context "on Windows" do
|
328
|
+
let(:root_prefix) { "C:" }
|
330
329
|
|
331
330
|
before do
|
332
|
-
Config.cache_dir(
|
333
|
-
stub_ohai(platform:
|
334
|
-
allow(Dir).to receive(:mktmpdir).and_yield(
|
331
|
+
Config.cache_dir("C:/")
|
332
|
+
stub_ohai(platform: "windows", version: "2012")
|
333
|
+
allow(Dir).to receive(:mktmpdir).and_yield("C:/tmp_dir")
|
335
334
|
end
|
336
335
|
|
337
|
-
context
|
338
|
-
it_behaves_like
|
336
|
+
context "when no extract overrides are present" do
|
337
|
+
it_behaves_like "an extractor", "7z", {},
|
339
338
|
['7z.exe x C:\\file.7z -oC:\\tmp\\project -r -y']
|
340
|
-
it_behaves_like
|
339
|
+
it_behaves_like "an extractor", "zip", {},
|
341
340
|
['7z.exe x C:\\file.zip -oC:\\tmp\\project -r -y']
|
342
|
-
it_behaves_like
|
343
|
-
[['tar
|
344
|
-
it_behaves_like
|
345
|
-
[['tar
|
346
|
-
it_behaves_like
|
347
|
-
[['tar
|
348
|
-
it_behaves_like
|
349
|
-
[['tar
|
350
|
-
it_behaves_like
|
351
|
-
[['tar
|
352
|
-
it_behaves_like
|
353
|
-
[['tar
|
354
|
-
it_behaves_like
|
355
|
-
[['tar
|
356
|
-
end
|
357
|
-
|
358
|
-
context
|
359
|
-
it_behaves_like
|
341
|
+
it_behaves_like "an extractor", "tar", {},
|
342
|
+
[['tar xf C:\\file.tar -CC:\\tmp\\project', { returns: [0] }]]
|
343
|
+
it_behaves_like "an extractor", "tgz", {},
|
344
|
+
[['tar zxf C:\\file.tgz -CC:\\tmp\\project', { returns: [0] }]]
|
345
|
+
it_behaves_like "an extractor", "tar.gz", {},
|
346
|
+
[['tar zxf C:\\file.tar.gz -CC:\\tmp\\project', { returns: [0] }]]
|
347
|
+
it_behaves_like "an extractor", "tar.bz2", {},
|
348
|
+
[['tar jxf C:\\file.tar.bz2 -CC:\\tmp\\project', { returns: [0] }]]
|
349
|
+
it_behaves_like "an extractor", "txz", {},
|
350
|
+
[['tar Jxf C:\\file.txz -CC:\\tmp\\project', { returns: [0] }]]
|
351
|
+
it_behaves_like "an extractor", "tar.xz", {},
|
352
|
+
[['tar Jxf C:\\file.tar.xz -CC:\\tmp\\project', { returns: [0] }]]
|
353
|
+
it_behaves_like "an extractor", "tar.lzma", {},
|
354
|
+
[['tar --lzma -xf C:\\file.tar.lzma -CC:\\tmp\\project', { returns: [0] }]]
|
355
|
+
end
|
356
|
+
|
357
|
+
context "when seven_zip extract strategy is chosen" do
|
358
|
+
it_behaves_like "an extractor", "7z", { extract: :seven_zip },
|
360
359
|
['7z.exe x C:\\file.7z -oC:\\tmp\\project -r -y']
|
361
|
-
it_behaves_like
|
360
|
+
it_behaves_like "an extractor", "zip", { extract: :seven_zip },
|
362
361
|
['7z.exe x C:\\file.zip -oC:\\tmp\\project -r -y']
|
363
|
-
it_behaves_like
|
362
|
+
it_behaves_like "an extractor", "tar", { extract: :seven_zip },
|
364
363
|
['7z.exe x C:\\file.tar -oC:\\tmp\\project -r -y']
|
365
|
-
it_behaves_like
|
364
|
+
it_behaves_like "an extractor", "tgz", { extract: :seven_zip },
|
366
365
|
['7z.exe x C:\\file.tgz -oC:\\tmp_dir -r -y',
|
367
366
|
'7z.exe x C:\\tmp_dir\\file.tar -oC:\\tmp\\project -r -y']
|
368
|
-
it_behaves_like
|
367
|
+
it_behaves_like "an extractor", "tar.gz", { extract: :seven_zip },
|
369
368
|
['7z.exe x C:\\file.tar.gz -oC:\\tmp_dir -r -y',
|
370
369
|
'7z.exe x C:\\tmp_dir\\file.tar -oC:\\tmp\\project -r -y']
|
371
|
-
it_behaves_like
|
370
|
+
it_behaves_like "an extractor", "tar.bz2", { extract: :seven_zip },
|
372
371
|
['7z.exe x C:\\file.tar.bz2 -oC:\\tmp_dir -r -y',
|
373
372
|
'7z.exe x C:\\tmp_dir\\file.tar -oC:\\tmp\\project -r -y']
|
374
|
-
it_behaves_like
|
373
|
+
it_behaves_like "an extractor", "txz", { extract: :seven_zip },
|
375
374
|
['7z.exe x C:\\file.txz -oC:\\tmp_dir -r -y',
|
376
375
|
'7z.exe x C:\\tmp_dir\\file.tar -oC:\\tmp\\project -r -y']
|
377
|
-
it_behaves_like
|
376
|
+
it_behaves_like "an extractor", "tar.xz", { extract: :seven_zip },
|
378
377
|
['7z.exe x C:\\file.tar.xz -oC:\\tmp_dir -r -y',
|
379
378
|
'7z.exe x C:\\tmp_dir\\file.tar -oC:\\tmp\\project -r -y']
|
380
|
-
it_behaves_like
|
379
|
+
it_behaves_like "an extractor", "tar.lzma", { extract: :seven_zip },
|
381
380
|
['7z.exe x C:\\file.tar.lzma -oC:\\tmp_dir -r -y',
|
382
381
|
'7z.exe x C:\\tmp_dir\\file.tar -oC:\\tmp\\project -r -y']
|
383
382
|
end
|
384
383
|
|
385
|
-
context
|
386
|
-
it_behaves_like
|
384
|
+
context "when lax_tar extract strategy is chosen" do
|
385
|
+
it_behaves_like "an extractor", "7z", { extract: :lax_tar },
|
387
386
|
['7z.exe x C:\\file.7z -oC:\\tmp\\project -r -y']
|
388
|
-
it_behaves_like
|
387
|
+
it_behaves_like "an extractor", "zip", { extract: :lax_tar },
|
389
388
|
['7z.exe x C:\\file.zip -oC:\\tmp\\project -r -y']
|
390
|
-
it_behaves_like
|
391
|
-
[['tar
|
392
|
-
it_behaves_like
|
393
|
-
[['tar
|
394
|
-
it_behaves_like
|
395
|
-
[['tar
|
396
|
-
it_behaves_like
|
397
|
-
[['tar
|
398
|
-
it_behaves_like
|
399
|
-
[['tar
|
400
|
-
it_behaves_like
|
401
|
-
[['tar
|
402
|
-
it_behaves_like
|
403
|
-
[['tar
|
389
|
+
it_behaves_like "an extractor", "tar", { extract: :lax_tar },
|
390
|
+
[['tar xf C:\\file.tar -CC:\\tmp\\project', { returns: [0, 1] }]]
|
391
|
+
it_behaves_like "an extractor", "tgz", { extract: :lax_tar },
|
392
|
+
[['tar zxf C:\\file.tgz -CC:\\tmp\\project', { returns: [0, 1] }]]
|
393
|
+
it_behaves_like "an extractor", "tar.gz", { extract: :lax_tar },
|
394
|
+
[['tar zxf C:\\file.tar.gz -CC:\\tmp\\project', { returns: [0, 1] }]]
|
395
|
+
it_behaves_like "an extractor", "tar.bz2", { extract: :lax_tar },
|
396
|
+
[['tar jxf C:\\file.tar.bz2 -CC:\\tmp\\project', { returns: [0, 1] }]]
|
397
|
+
it_behaves_like "an extractor", "txz", { extract: :lax_tar },
|
398
|
+
[['tar Jxf C:\\file.txz -CC:\\tmp\\project', { returns: [0, 1] }]]
|
399
|
+
it_behaves_like "an extractor", "tar.xz", { extract: :lax_tar },
|
400
|
+
[['tar Jxf C:\\file.tar.xz -CC:\\tmp\\project', { returns: [0, 1] }]]
|
401
|
+
it_behaves_like "an extractor", "tar.lzma", { extract: :lax_tar },
|
402
|
+
[['tar --lzma -xf C:\\file.tar.lzma -CC:\\tmp\\project', { returns: [0, 1] }]]
|
404
403
|
end
|
405
404
|
end
|
406
405
|
|
407
|
-
context
|
406
|
+
context "on Linux" do
|
408
407
|
before do
|
409
|
-
Config.cache_dir(
|
410
|
-
stub_ohai(platform:
|
411
|
-
stub_const(
|
412
|
-
end
|
413
|
-
|
414
|
-
context
|
415
|
-
it_behaves_like
|
416
|
-
[
|
417
|
-
it_behaves_like
|
418
|
-
[
|
419
|
-
it_behaves_like
|
420
|
-
[
|
421
|
-
it_behaves_like
|
422
|
-
[
|
423
|
-
it_behaves_like
|
424
|
-
[
|
425
|
-
it_behaves_like
|
426
|
-
[
|
427
|
-
it_behaves_like
|
428
|
-
[
|
429
|
-
it_behaves_like
|
430
|
-
[
|
431
|
-
it_behaves_like
|
432
|
-
[
|
433
|
-
end
|
434
|
-
|
435
|
-
context
|
408
|
+
Config.cache_dir("/")
|
409
|
+
stub_ohai(platform: "ubuntu", version: "12.04")
|
410
|
+
stub_const("File::ALT_SEPARATOR", nil)
|
411
|
+
end
|
412
|
+
|
413
|
+
context "when gtar is not present" do
|
414
|
+
it_behaves_like "an extractor", "7z", {},
|
415
|
+
["7z x /file.7z -o/tmp/project -r -y"]
|
416
|
+
it_behaves_like "an extractor", "zip", {},
|
417
|
+
["unzip /file.zip -d /tmp/project"]
|
418
|
+
it_behaves_like "an extractor", "tar", {},
|
419
|
+
["tar xf /file.tar -C/tmp/project"]
|
420
|
+
it_behaves_like "an extractor", "tgz", {},
|
421
|
+
["tar zxf /file.tgz -C/tmp/project"]
|
422
|
+
it_behaves_like "an extractor", "tar.gz", {},
|
423
|
+
["tar zxf /file.tar.gz -C/tmp/project"]
|
424
|
+
it_behaves_like "an extractor", "tar.bz2", {},
|
425
|
+
["tar jxf /file.tar.bz2 -C/tmp/project"]
|
426
|
+
it_behaves_like "an extractor", "txz", {},
|
427
|
+
["tar Jxf /file.txz -C/tmp/project"]
|
428
|
+
it_behaves_like "an extractor", "tar.xz", {},
|
429
|
+
["tar Jxf /file.tar.xz -C/tmp/project"]
|
430
|
+
it_behaves_like "an extractor", "tar.lzma", {},
|
431
|
+
["tar --lzma -xf /file.tar.lzma -C/tmp/project"]
|
432
|
+
end
|
433
|
+
|
434
|
+
context "when gtar is present" do
|
436
435
|
before do
|
437
|
-
Config.cache_dir(
|
436
|
+
Config.cache_dir("/")
|
438
437
|
|
439
|
-
stub_ohai(platform:
|
440
|
-
stub_const(
|
438
|
+
stub_ohai(platform: "ubuntu", version: "12.04")
|
439
|
+
stub_const("File::ALT_SEPARATOR", nil)
|
441
440
|
|
442
441
|
allow(Omnibus).to receive(:which)
|
443
|
-
.with(
|
444
|
-
.and_return(
|
442
|
+
.with("gtar")
|
443
|
+
.and_return("/path/to/gtar")
|
445
444
|
end
|
446
445
|
|
447
|
-
it_behaves_like
|
448
|
-
[
|
449
|
-
it_behaves_like
|
450
|
-
[
|
451
|
-
it_behaves_like
|
452
|
-
[
|
453
|
-
it_behaves_like
|
454
|
-
[
|
455
|
-
it_behaves_like
|
456
|
-
[
|
457
|
-
it_behaves_like
|
458
|
-
[
|
459
|
-
it_behaves_like
|
460
|
-
[
|
461
|
-
it_behaves_like
|
462
|
-
[
|
463
|
-
it_behaves_like
|
464
|
-
[
|
446
|
+
it_behaves_like "an extractor", "7z", {},
|
447
|
+
["7z x /file.7z -o/tmp/project -r -y"]
|
448
|
+
it_behaves_like "an extractor", "zip", {},
|
449
|
+
["unzip /file.zip -d /tmp/project"]
|
450
|
+
it_behaves_like "an extractor", "tar", {},
|
451
|
+
["gtar xf /file.tar -C/tmp/project"]
|
452
|
+
it_behaves_like "an extractor", "tgz", {},
|
453
|
+
["gtar zxf /file.tgz -C/tmp/project"]
|
454
|
+
it_behaves_like "an extractor", "tar.gz", {},
|
455
|
+
["gtar zxf /file.tar.gz -C/tmp/project"]
|
456
|
+
it_behaves_like "an extractor", "tar.bz2", {},
|
457
|
+
["gtar jxf /file.tar.bz2 -C/tmp/project"]
|
458
|
+
it_behaves_like "an extractor", "txz", {},
|
459
|
+
["gtar Jxf /file.txz -C/tmp/project"]
|
460
|
+
it_behaves_like "an extractor", "tar.xz", {},
|
461
|
+
["gtar Jxf /file.tar.xz -C/tmp/project"]
|
462
|
+
it_behaves_like "an extractor", "tar.lzma", {},
|
463
|
+
["gtar --lzma -xf /file.tar.lzma -C/tmp/project"]
|
465
464
|
end
|
466
465
|
|
467
466
|
end
|