omnibus 5.4.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +8 -5
  5. data/README.md +3 -1
  6. data/Rakefile +20 -13
  7. data/appveyor.yml +4 -3
  8. data/bin/omnibus +3 -3
  9. data/features/commands/manifest.feature +19 -5
  10. data/features/step_definitions/generator_steps.rb +5 -6
  11. data/features/support/env.rb +4 -4
  12. data/lib/omnibus/build_version.rb +14 -14
  13. data/lib/omnibus/build_version_dsl.rb +3 -3
  14. data/lib/omnibus/builder.rb +50 -61
  15. data/lib/omnibus/changelog.rb +2 -2
  16. data/lib/omnibus/changelog_printer.rb +4 -4
  17. data/lib/omnibus/cleaner.rb +4 -4
  18. data/lib/omnibus/cli/base.rb +15 -15
  19. data/lib/omnibus/cli/cache.rb +13 -13
  20. data/lib/omnibus/cli/changelog.rb +8 -9
  21. data/lib/omnibus/cli/publish.rb +12 -13
  22. data/lib/omnibus/cli.rb +26 -27
  23. data/lib/omnibus/compressor.rb +6 -6
  24. data/lib/omnibus/compressors/base.rb +7 -2
  25. data/lib/omnibus/compressors/dmg.rb +12 -12
  26. data/lib/omnibus/compressors/null.rb +1 -1
  27. data/lib/omnibus/compressors/tgz.rb +8 -8
  28. data/lib/omnibus/config.rb +37 -26
  29. data/lib/omnibus/core_extensions/open_uri.rb +3 -3
  30. data/lib/omnibus/core_extensions.rb +1 -1
  31. data/lib/omnibus/digestable.rb +5 -4
  32. data/lib/omnibus/download_helpers.rb +7 -6
  33. data/lib/omnibus/exceptions.rb +29 -13
  34. data/lib/omnibus/fetcher.rb +0 -1
  35. data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
  36. data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
  37. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  38. data/lib/omnibus/file_syncer.rb +3 -3
  39. data/lib/omnibus/generator.rb +60 -47
  40. data/lib/omnibus/git_cache.rb +33 -22
  41. data/lib/omnibus/git_repository.rb +5 -5
  42. data/lib/omnibus/health_check.rb +122 -119
  43. data/lib/omnibus/instrumentation.rb +1 -1
  44. data/lib/omnibus/licensing.rb +348 -60
  45. data/lib/omnibus/logger.rb +12 -9
  46. data/lib/omnibus/logging.rb +1 -1
  47. data/lib/omnibus/manifest.rb +4 -4
  48. data/lib/omnibus/manifest_diff.rb +6 -7
  49. data/lib/omnibus/manifest_entry.rb +1 -1
  50. data/lib/omnibus/metadata.rb +36 -36
  51. data/lib/omnibus/ohai.rb +6 -7
  52. data/lib/omnibus/package.rb +1 -1
  53. data/lib/omnibus/packager.rb +37 -28
  54. data/lib/omnibus/packagers/appx.rb +86 -0
  55. data/lib/omnibus/packagers/base.rb +21 -18
  56. data/lib/omnibus/packagers/bff.rb +22 -24
  57. data/lib/omnibus/packagers/deb.rb +20 -20
  58. data/lib/omnibus/packagers/ips.rb +18 -17
  59. data/lib/omnibus/packagers/makeself.rb +7 -7
  60. data/lib/omnibus/packagers/msi.rb +38 -193
  61. data/lib/omnibus/packagers/pkg.rb +16 -16
  62. data/lib/omnibus/packagers/rpm.rb +53 -54
  63. data/lib/omnibus/packagers/solaris.rb +14 -14
  64. data/lib/omnibus/packagers/windows_base.rb +192 -0
  65. data/lib/omnibus/project.rb +45 -43
  66. data/lib/omnibus/publisher.rb +3 -3
  67. data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
  68. data/lib/omnibus/publishers/s3_publisher.rb +7 -7
  69. data/lib/omnibus/reports.rb +10 -10
  70. data/lib/omnibus/s3_cache.rb +7 -7
  71. data/lib/omnibus/s3_helpers.rb +8 -7
  72. data/lib/omnibus/semantic_version.rb +1 -1
  73. data/lib/omnibus/software.rb +131 -81
  74. data/lib/omnibus/sugarable.rb +10 -10
  75. data/lib/omnibus/templating.rb +5 -5
  76. data/lib/omnibus/thread_pool.rb +1 -1
  77. data/lib/omnibus/util.rb +5 -5
  78. data/lib/omnibus/version.rb +1 -1
  79. data/lib/omnibus.rb +65 -65
  80. data/omnibus.gemspec +34 -32
  81. data/resources/appx/AppxManifest.xml.erb +18 -0
  82. data/resources/appx/assets/clear.png +0 -0
  83. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
  84. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
  85. data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
  86. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
  87. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
  88. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
  89. data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
  90. data/spec/functional/builder_spec.rb +149 -150
  91. data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
  92. data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
  93. data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
  94. data/spec/functional/file_syncer_spec.rb +74 -74
  95. data/spec/functional/licensing_spec.rb +344 -35
  96. data/spec/functional/templating_spec.rb +17 -17
  97. data/spec/spec_helper.rb +20 -20
  98. data/spec/support/examples.rb +21 -15
  99. data/spec/support/file_helpers.rb +1 -1
  100. data/spec/support/git_helpers.rb +37 -37
  101. data/spec/support/matchers.rb +3 -3
  102. data/spec/support/ohai_helpers.rb +4 -4
  103. data/spec/support/path_helpers.rb +2 -2
  104. data/spec/support/shell_helpers.rb +2 -2
  105. data/spec/unit/build_version_dsl_spec.rb +5 -5
  106. data/spec/unit/build_version_spec.rb +63 -63
  107. data/spec/unit/builder_spec.rb +86 -70
  108. data/spec/unit/changelog_spec.rb +4 -4
  109. data/spec/unit/changelogprinter_spec.rb +130 -0
  110. data/spec/unit/cleanroom_spec.rb +11 -11
  111. data/spec/unit/compressor_spec.rb +16 -16
  112. data/spec/unit/compressors/base_spec.rb +6 -6
  113. data/spec/unit/compressors/dmg_spec.rb +76 -76
  114. data/spec/unit/compressors/null_spec.rb +4 -4
  115. data/spec/unit/compressors/tgz_spec.rb +20 -20
  116. data/spec/unit/config_spec.rb +44 -43
  117. data/spec/unit/digestable_spec.rb +13 -13
  118. data/spec/unit/fetcher_spec.rb +11 -12
  119. data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
  120. data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
  121. data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
  122. data/spec/unit/generator_spec.rb +38 -38
  123. data/spec/unit/git_cache_spec.rb +56 -54
  124. data/spec/unit/git_repository_spec.rb +2 -2
  125. data/spec/unit/health_check_spec.rb +40 -40
  126. data/spec/unit/library_spec.rb +35 -35
  127. data/spec/unit/manifest_diff_spec.rb +10 -11
  128. data/spec/unit/manifest_spec.rb +17 -17
  129. data/spec/unit/metadata_spec.rb +152 -152
  130. data/spec/unit/ohai_spec.rb +5 -5
  131. data/spec/unit/omnibus_spec.rb +31 -31
  132. data/spec/unit/package_spec.rb +20 -20
  133. data/spec/unit/packager_spec.rb +48 -42
  134. data/spec/unit/packagers/appx_spec.rb +165 -0
  135. data/spec/unit/packagers/base_spec.rb +34 -34
  136. data/spec/unit/packagers/bff_spec.rb +60 -60
  137. data/spec/unit/packagers/deb_spec.rb +71 -71
  138. data/spec/unit/packagers/ips_spec.rb +45 -45
  139. data/spec/unit/packagers/makeself_spec.rb +22 -22
  140. data/spec/unit/packagers/msi_spec.rb +141 -147
  141. data/spec/unit/packagers/pkg_spec.rb +59 -60
  142. data/spec/unit/packagers/rpm_spec.rb +125 -126
  143. data/spec/unit/packagers/solaris_spec.rb +52 -52
  144. data/spec/unit/project_spec.rb +137 -135
  145. data/spec/unit/publisher_spec.rb +70 -70
  146. data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
  147. data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
  148. data/spec/unit/s3_cacher_spec.rb +34 -34
  149. data/spec/unit/s3_helpers_spec.rb +6 -6
  150. data/spec/unit/semantic_version_spec.rb +2 -2
  151. data/spec/unit/software_spec.rb +346 -384
  152. data/spec/unit/sugarable_spec.rb +10 -10
  153. data/spec/unit/util_spec.rb +60 -60
  154. metadata +54 -6
  155. data/.rubocop.yml +0 -48
@@ -1,23 +1,23 @@
1
- require 'spec_helper'
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: 'https://get.example.com/file.tar.gz', md5: 'abcd1234' }
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: 'file',
14
+ name: "file",
15
15
  locked_version: "1.2.3",
16
- described_version: '1.2.3',
16
+ described_version: "1.2.3",
17
17
  locked_source: source)
18
18
  end
19
19
 
20
- let(:cache_dir) { '/cache' }
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 'when file is not downloaded' do
29
+ context "when file is not downloaded" do
30
30
  before { allow(File).to receive(:exist?).and_return(false) }
31
31
 
32
- it 'returns true' do
32
+ it "returns true" do
33
33
  expect(subject.fetch_required?).to be_truthy
34
34
  end
35
35
  end
36
36
 
37
- context 'when the file is downloaded' do
37
+ context "when the file is downloaded" do
38
38
  before { allow(File).to receive(:exist?).and_return(true) }
39
39
 
40
- context 'when the shasums differ' do
40
+ context "when the shasums differ" do
41
41
  before do
42
- allow(subject).to receive(:digest).and_return('abcd1234')
43
- allow(subject).to receive(:checksum).and_return('efgh5678')
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 'returns true' do
46
+ it "returns true" do
47
47
  expect(subject.fetch_required?).to be_truthy
48
48
  end
49
49
  end
50
50
 
51
- context 'when the shasums are the same' do
51
+ context "when the shasums are the same" do
52
52
  before do
53
- allow(subject).to receive(:digest).and_return('abcd1234')
54
- allow(subject).to receive(:checksum).and_return('abcd1234')
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 'returns true' do
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 'source with md5' do
66
- it 'returns the shasum' do
67
- expect(subject.version_guid).to eq('md5:abcd1234')
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 'source with sha1' do
71
+ context "source with sha1" do
72
72
  let(:source) do
73
- { url: 'https://get.example.com/file.tar.gz', sha1: 'abcd1234' }
73
+ { url: "https://get.example.com/file.tar.gz", sha1: "abcd1234" }
74
74
  end
75
75
 
76
- it 'returns the shasum' do
77
- expect(subject.version_guid).to eq('sha1:abcd1234')
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 'source with sha256' do
81
+ context "source with sha256" do
82
82
  let(:source) do
83
- { url: 'https://get.example.com/file.tar.gz', sha256: 'abcd1234' }
83
+ { url: "https://get.example.com/file.tar.gz", sha256: "abcd1234" }
84
84
  end
85
85
 
86
- it 'returns the shasum' do
87
- expect(subject.version_guid).to eq('sha256:abcd1234')
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 'source with sha512' do
91
+ context "source with sha512" do
92
92
  let(:source) do
93
- { url: 'https://get.example.com/file.tar.gz', sha512: 'abcd1234' }
93
+ { url: "https://get.example.com/file.tar.gz", sha512: "abcd1234" }
94
94
  end
95
95
 
96
- it 'returns the shasum' do
97
- expect(subject.version_guid).to eq('sha512:abcd1234')
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 'when the project directory exists' do
109
+ context "when the project directory exists" do
110
110
  before { allow(File).to receive(:exist?).and_return(true) }
111
111
 
112
- it 'deploys the archive' do
112
+ it "deploys the archive" do
113
113
  expect(subject).to receive(:deploy)
114
114
  subject.clean
115
115
  end
116
116
 
117
- it 'returns true' do
117
+ it "returns true" do
118
118
  expect(subject.clean).to be_truthy
119
119
  end
120
120
 
121
- it 'removes the project directory' do
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 'when the project directory does not exist' do
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 'deploys the archive' do
130
+ it "deploys the archive" do
131
131
  expect(subject).to receive(:deploy)
132
132
  subject.clean
133
133
  end
134
134
 
135
- it 'returns false' do
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 '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')
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 'source with sha1' do
148
+ context "source with sha1" do
149
149
  let(:source) do
150
- { url: 'https://get.example.com/file.tar.gz', sha1: 'abcd1234' }
150
+ { url: "https://get.example.com/file.tar.gz", sha1: "abcd1234" }
151
151
  end
152
152
 
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')
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 'source with sha256' do
158
+ context "source with sha256" do
159
159
  let(:source) do
160
- { url: 'https://get.example.com/file.tar.gz', sha256: 'abcd1234' }
160
+ { url: "https://get.example.com/file.tar.gz", sha256: "abcd1234" }
161
161
  end
162
162
 
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')
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 'source with sha512' do
168
+ context "source with sha512" do
169
169
  let(:source) do
170
- { url: 'https://get.example.com/file.tar.gz', sha512: 'abcd1234' }
170
+ { url: "https://get.example.com/file.tar.gz", sha512: "abcd1234" }
171
171
  end
172
172
 
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')
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 'an extractor' do |extension, source_options, commands|
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: 'file',
255
+ name: "file",
257
256
  locked_version: "1.2.3",
258
- described_version: '1.2.3',
259
- locked_source: { url: "https://get.example.com/file.#{extension}", md5: 'abcd1234' }.merge(source_options)
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 'shells out with the right commands' do
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 'when the downloaded file is a folder' do
282
+ context "when the downloaded file is a folder" do
284
283
  let(:manifest_entry) do
285
284
  double(Omnibus::ManifestEntry,
286
- name: 'file',
285
+ name: "file",
287
286
  locked_version: "1.2.3",
288
- described_version: '1.2.3',
289
- locked_source: { url: "https://get.example.com/folder", md5: 'abcd1234' })
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 'copies the entire directory to project_dir' do
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 'when the downloaded file is a regular file' do
303
+ context "when the downloaded file is a regular file" do
305
304
  let(:manifest_entry) do
306
305
  double(Omnibus::ManifestEntry,
307
- name: 'file',
306
+ name: "file",
308
307
  locked_version: "1.2.3",
309
- described_version: '1.2.3',
310
- locked_source: { url: "https://get.example.com/file", md5: 'abcd1234' })
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 'copies the file into the project_dir' do
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 'on Windows' do
329
- let(:root_prefix) { 'C:' }
327
+ context "on Windows" do
328
+ let(:root_prefix) { "C:" }
330
329
 
331
330
  before do
332
- Config.cache_dir('C:/')
333
- stub_ohai(platform: 'windows', version: '2012')
334
- allow(Dir).to receive(:mktmpdir).and_yield('C:/tmp_dir')
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 'when no extract overrides are present' do
338
- it_behaves_like 'an extractor', '7z', {},
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 'an extractor', 'zip', {},
339
+ it_behaves_like "an extractor", "zip", {},
341
340
  ['7z.exe x C:\\file.zip -oC:\\tmp\\project -r -y']
342
- it_behaves_like 'an extractor', 'tar', {},
343
- [['tar.exe xf C:\\file.tar -CC:\\tmp\\project', {returns: [0]}]]
344
- it_behaves_like 'an extractor', 'tgz', {},
345
- [['tar.exe zxf C:\\file.tgz -CC:\\tmp\\project', {returns: [0]}]]
346
- it_behaves_like 'an extractor', 'tar.gz', {},
347
- [['tar.exe zxf C:\\file.tar.gz -CC:\\tmp\\project', {returns: [0]}]]
348
- it_behaves_like 'an extractor', 'tar.bz2', {},
349
- [['tar.exe jxf C:\\file.tar.bz2 -CC:\\tmp\\project', {returns: [0]}]]
350
- it_behaves_like 'an extractor', 'txz', {},
351
- [['tar.exe Jxf C:\\file.txz -CC:\\tmp\\project', {returns: [0]}]]
352
- it_behaves_like 'an extractor', 'tar.xz', {},
353
- [['tar.exe Jxf C:\\file.tar.xz -CC:\\tmp\\project', {returns: [0]}]]
354
- it_behaves_like 'an extractor', 'tar.lzma', {},
355
- [['tar.exe --lzma -xf C:\\file.tar.lzma -CC:\\tmp\\project', {returns: [0]}]]
356
- end
357
-
358
- context 'when seven_zip extract strategy is chosen' do
359
- it_behaves_like 'an extractor', '7z', { extract: :seven_zip },
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 'an extractor', 'zip', { extract: :seven_zip },
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 'an extractor', 'tar', { extract: :seven_zip },
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 'an extractor', 'tgz', { extract: :seven_zip },
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 'an extractor', 'tar.gz', { extract: :seven_zip },
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 'an extractor', 'tar.bz2', { extract: :seven_zip },
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 'an extractor', 'txz', { extract: :seven_zip },
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 'an extractor', 'tar.xz', { extract: :seven_zip },
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 'an extractor', 'tar.lzma', { extract: :seven_zip },
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 'when lax_tar extract strategy is chosen' do
386
- it_behaves_like 'an extractor', '7z', { extract: :lax_tar },
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 'an extractor', 'zip', { extract: :lax_tar },
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 'an extractor', 'tar', { extract: :lax_tar },
391
- [['tar.exe xf C:\\file.tar -CC:\\tmp\\project', {returns: [0, 1]}]]
392
- it_behaves_like 'an extractor', 'tgz', { extract: :lax_tar },
393
- [['tar.exe zxf C:\\file.tgz -CC:\\tmp\\project', {returns: [0, 1]}]]
394
- it_behaves_like 'an extractor', 'tar.gz', { extract: :lax_tar },
395
- [['tar.exe zxf C:\\file.tar.gz -CC:\\tmp\\project', {returns: [0, 1]}]]
396
- it_behaves_like 'an extractor', 'tar.bz2', { extract: :lax_tar },
397
- [['tar.exe jxf C:\\file.tar.bz2 -CC:\\tmp\\project', {returns: [0, 1]}]]
398
- it_behaves_like 'an extractor', 'txz', { extract: :lax_tar },
399
- [['tar.exe Jxf C:\\file.txz -CC:\\tmp\\project', {returns: [0, 1]}]]
400
- it_behaves_like 'an extractor', 'tar.xz', { extract: :lax_tar },
401
- [['tar.exe Jxf C:\\file.tar.xz -CC:\\tmp\\project', {returns: [0, 1]}]]
402
- it_behaves_like 'an extractor', 'tar.lzma', { extract: :lax_tar },
403
- [['tar.exe --lzma -xf C:\\file.tar.lzma -CC:\\tmp\\project', {returns: [0, 1]}]]
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 'on Linux' do
406
+ context "on Linux" do
408
407
  before do
409
- Config.cache_dir('/')
410
- stub_ohai(platform: 'ubuntu', version: '12.04')
411
- stub_const('File::ALT_SEPARATOR', nil)
412
- end
413
-
414
- context 'when gtar is not present' do
415
- it_behaves_like 'an extractor', '7z', {},
416
- ['7z x /file.7z -o/tmp/project -r -y']
417
- it_behaves_like 'an extractor', 'zip', {},
418
- ['unzip /file.zip -d /tmp/project']
419
- it_behaves_like 'an extractor', 'tar', {},
420
- ['tar xf /file.tar -C/tmp/project']
421
- it_behaves_like 'an extractor', 'tgz', {},
422
- ['tar zxf /file.tgz -C/tmp/project']
423
- it_behaves_like 'an extractor', 'tar.gz', {},
424
- ['tar zxf /file.tar.gz -C/tmp/project']
425
- it_behaves_like 'an extractor', 'tar.bz2', {},
426
- ['tar jxf /file.tar.bz2 -C/tmp/project']
427
- it_behaves_like 'an extractor', 'txz', {},
428
- ['tar Jxf /file.txz -C/tmp/project']
429
- it_behaves_like 'an extractor', 'tar.xz', {},
430
- ['tar Jxf /file.tar.xz -C/tmp/project']
431
- it_behaves_like 'an extractor', 'tar.lzma', {},
432
- ['tar --lzma -xf /file.tar.lzma -C/tmp/project']
433
- end
434
-
435
- context 'when gtar is present' do
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: 'ubuntu', version: '12.04')
440
- stub_const('File::ALT_SEPARATOR', nil)
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('gtar')
444
- .and_return('/path/to/gtar')
442
+ .with("gtar")
443
+ .and_return("/path/to/gtar")
445
444
  end
446
445
 
447
- it_behaves_like 'an extractor', '7z', {},
448
- ['7z x /file.7z -o/tmp/project -r -y']
449
- it_behaves_like 'an extractor', 'zip', {},
450
- ['unzip /file.zip -d /tmp/project']
451
- it_behaves_like 'an extractor', 'tar', {},
452
- ['gtar xf /file.tar -C/tmp/project']
453
- it_behaves_like 'an extractor', 'tgz', {},
454
- ['gtar zxf /file.tgz -C/tmp/project']
455
- it_behaves_like 'an extractor', 'tar.gz', {},
456
- ['gtar zxf /file.tar.gz -C/tmp/project']
457
- it_behaves_like 'an extractor', 'tar.bz2', {},
458
- ['gtar jxf /file.tar.bz2 -C/tmp/project']
459
- it_behaves_like 'an extractor', 'txz', {},
460
- ['gtar Jxf /file.txz -C/tmp/project']
461
- it_behaves_like 'an extractor', 'tar.xz', {},
462
- ['gtar Jxf /file.tar.xz -C/tmp/project']
463
- it_behaves_like 'an extractor', 'tar.lzma', {},
464
- ['gtar --lzma -xf /file.tar.lzma -C/tmp/project']
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