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,8 +1,8 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Builder do
5
- include_examples 'a software'
5
+ include_examples "a software"
6
6
 
7
7
  #
8
8
  # Fakes the embedded bin path to whatever exists in bundler. This is useful
@@ -19,11 +19,11 @@ module Omnibus
19
19
  # corresponding to the system installation and hope it all works out.
20
20
  def fake_embedded_bin(name)
21
21
  if windows?
22
- ext = name == 'ruby' ? '.exe' : '.bat'
22
+ ext = name == "ruby" ? ".exe" : ".bat"
23
23
  source = Bundler.which(name + ext)
24
24
  raise "Could not find #{name} in bundler environment" unless source
25
- File.open(File.join(embedded_bin_dir, name + '.bat'), 'w') do |f|
26
- f.write <<-EOH.gsub(/^ {12}/, '')
25
+ File.open(File.join(embedded_bin_dir, name + ".bat"), "w") do |f|
26
+ f.write <<-EOH.gsub(/^ {12}/, "")
27
27
  @"#{source}" %*
28
28
  EOH
29
29
  end
@@ -40,18 +40,17 @@ module Omnibus
40
40
  # Pass GEM_HOME and GEM_PATH to subprocess so our fake bin works
41
41
  options = {}
42
42
  options[:env] = {
43
- 'GEM_HOME' => ENV['GEM_HOME'],
44
- 'GEM_PATH' => ENV['GEM_PATH'],
43
+ "GEM_HOME" => ENV["GEM_HOME"],
44
+ "GEM_PATH" => ENV["GEM_PATH"],
45
45
  }
46
46
  options[:env].merge!(subject.with_embedded_path)
47
47
  options
48
48
  end
49
49
 
50
-
51
50
  def make_gemspec()
52
51
  gemspec = File.join(project_dir, "#{project_name}.gemspec")
53
- File.open(gemspec, 'w') do |f|
54
- f.write <<-EOH.gsub(/^ {12}/, '')
52
+ File.open(gemspec, "w") do |f|
53
+ f.write <<-EOH.gsub(/^ {12}/, "")
55
54
  Gem::Specification.new do |gem|
56
55
  gem.name = '#{project_name}'
57
56
  gem.version = '1.0.0'
@@ -66,9 +65,9 @@ module Omnibus
66
65
  end
67
66
 
68
67
  def make_gemfile()
69
- gemfile = File.join(project_dir, 'Gemfile')
70
- File.open(gemfile, 'w') do |f|
71
- f.write <<-EOH.gsub(/^ {12}/, '')
68
+ gemfile = File.join(project_dir, "Gemfile")
69
+ File.open(gemfile, "w") do |f|
70
+ f.write <<-EOH.gsub(/^ {12}/, "")
72
71
  gemspec
73
72
  EOH
74
73
  end
@@ -76,9 +75,9 @@ module Omnibus
76
75
  end
77
76
 
78
77
  def make_gemfile_lock()
79
- gemfile_lock = File.join(project_dir, 'Gemfile.lock')
80
- File.open(gemfile_lock, 'w') do |f|
81
- f.write <<-EOH.gsub(/^ {12}/, '')
78
+ gemfile_lock = File.join(project_dir, "Gemfile.lock")
79
+ File.open(gemfile_lock, "w") do |f|
80
+ f.write <<-EOH.gsub(/^ {12}/, "")
82
81
  PATH
83
82
  remote: .
84
83
  specs:
@@ -98,37 +97,37 @@ module Omnibus
98
97
  end
99
98
 
100
99
  subject { described_class.new(software) }
101
- let(:project_name) { 'example' }
100
+ let(:project_name) { "example" }
102
101
  let(:project_dir) { File.join(source_dir, project_name) }
103
102
 
104
103
  describe '#command' do
105
- it 'executes the command' do
104
+ it "executes the command" do
106
105
  subject.command("echo 'Hello World!'")
107
106
 
108
107
  output = capture_logging { subject.build }
109
- expect(output).to include('Hello World')
108
+ expect(output).to include("Hello World")
110
109
  end
111
110
  end
112
111
 
113
112
  describe '#make' do
114
- it 'is waiting for a good samaritan to write tests' do
113
+ it "is waiting for a good samaritan to write tests" do
115
114
  skip
116
115
  end
117
116
  end
118
117
 
119
118
  describe '#patch' do
120
- it 'applies the patch' do
121
- configure = File.join(project_dir, 'configure')
122
- File.open(configure, 'w') do |f|
123
- f.write <<-EOH.gsub(/^ {12}/, '')
119
+ it "applies the patch" do
120
+ configure = File.join(project_dir, "configure")
121
+ File.open(configure, "w") do |f|
122
+ f.write <<-EOH.gsub(/^ {12}/, "")
124
123
  THING="-e foo"
125
124
  ZIP="zap"
126
125
  EOH
127
126
  end
128
127
 
129
- patch = File.join(patches_dir, 'apply.patch')
130
- File.open(patch, 'w') do |f|
131
- f.write <<-EOH.gsub(/^ {12}/, '')
128
+ patch = File.join(patches_dir, "apply.patch")
129
+ File.open(patch, "w") do |f|
130
+ f.write <<-EOH.gsub(/^ {12}/, "")
132
131
  --- a/configure
133
132
  +++ b/configure
134
133
  @@ -1,2 +1,3 @@
@@ -139,41 +138,41 @@ module Omnibus
139
138
  end
140
139
 
141
140
  if windows?
142
- bash_path = Bundler.which('bash.exe')
141
+ bash_path = Bundler.which("bash.exe")
143
142
  allow(subject).to receive(:embedded_msys_bin)
144
- .with('bash.exe')
143
+ .with("bash.exe")
145
144
  .and_return("#{bash_path}")
146
145
  end
147
146
 
148
- subject.patch(source: 'apply.patch')
147
+ subject.patch(source: "apply.patch")
149
148
  subject.build
150
149
  end
151
150
  end
152
151
 
153
152
  describe '#ruby' do
154
- it 'executes the command as the embdedded ruby' do
155
- ruby = File.join(scripts_dir, 'setup.rb')
156
- File.open(ruby, 'w') do |f|
157
- f.write <<-EOH.gsub(/^ {12}/, '')
153
+ it "executes the command as the embdedded ruby" do
154
+ ruby = File.join(scripts_dir, "setup.rb")
155
+ File.open(ruby, "w") do |f|
156
+ f.write <<-EOH.gsub(/^ {12}/, "")
158
157
  File.write("#{software.install_dir}/test.txt", 'This is content!')
159
158
  EOH
160
159
  end
161
160
 
162
- fake_embedded_bin('ruby')
161
+ fake_embedded_bin("ruby")
163
162
 
164
163
  subject.ruby(ruby, env: subject.with_embedded_path)
165
164
  subject.build
166
165
 
167
166
  path = "#{software.install_dir}/test.txt"
168
167
  expect(path).to be_a_file
169
- expect(File.read(path)).to eq('This is content!')
168
+ expect(File.read(path)).to eq("This is content!")
170
169
  end
171
170
  end
172
171
 
173
172
  describe '#gem' do
174
- it 'executes the command as the embedded gem' do
173
+ it "executes the command as the embedded gem" do
175
174
  make_gemspec
176
- fake_embedded_bin('gem')
175
+ fake_embedded_bin("gem")
177
176
  gem_file = "#{project_name}-1.0.0.gem"
178
177
 
179
178
  subject.gem("build #{project_name}.gemspec", shellout_opts(subject))
@@ -181,36 +180,36 @@ module Omnibus
181
180
  output = capture_logging { subject.build }
182
181
 
183
182
  expect(File.join(project_dir, gem_file)).to be_a_file
184
- expect(output).to include('gem build')
185
- expect(output).to include('gem install')
183
+ expect(output).to include("gem build")
184
+ expect(output).to include("gem install")
186
185
 
187
186
  end
188
187
  end
189
188
 
190
189
  describe '#bundler' do
191
- it 'executes the command as the embedded bundler' do
190
+ it "executes the command as the embedded bundler" do
192
191
  make_gemspec
193
192
  make_gemfile
194
- fake_embedded_bin('bundle')
193
+ fake_embedded_bin("bundle")
195
194
 
196
- subject.bundle('install', shellout_opts(subject))
195
+ subject.bundle("install", shellout_opts(subject))
197
196
  output = capture_logging { subject.build }
198
197
 
199
- expect(File.join(project_dir, 'Gemfile.lock')).to be_a_file
200
- expect(output).to include('bundle install')
198
+ expect(File.join(project_dir, "Gemfile.lock")).to be_a_file
199
+ expect(output).to include("bundle install")
201
200
  end
202
201
  end
203
202
 
204
203
  describe '#appbundle' do
205
204
  let(:project) { double("Project") }
206
205
  let(:project_softwares) { [ double("Software", name: project_name, project_dir: project_dir) ] }
207
- it 'executes the command as the embedded appbundler' do
206
+ it "executes the command as the embedded appbundler" do
208
207
  make_gemspec
209
208
  make_gemfile
210
209
  make_gemfile_lock
211
210
 
212
- fake_embedded_bin('gem')
213
- fake_embedded_bin('appbundler')
211
+ fake_embedded_bin("gem")
212
+ fake_embedded_bin("appbundler")
214
213
 
215
214
  subject.gem("build #{project_name}.gemspec", shellout_opts(subject))
216
215
  subject.gem("install #{project_name}-1.0.0.gem", shellout_opts(subject))
@@ -221,60 +220,60 @@ module Omnibus
221
220
 
222
221
  output = capture_logging { subject.build }
223
222
 
224
- appbundler_path = File.join(embedded_bin_dir, 'appbundler')
225
- appbundler_path.gsub!(/\//,'\\') if windows?
223
+ appbundler_path = File.join(embedded_bin_dir, "appbundler")
224
+ appbundler_path.gsub!(/\//, '\\') if windows?
226
225
  expect(output).to include("#{appbundler_path} '#{project_dir}' '#{bin_dir}'")
227
226
  end
228
227
  end
229
228
 
230
229
  describe '#rake' do
231
- it 'executes the command as the embedded rake' do
232
- rakefile = File.join(project_dir, 'Rakefile')
233
- File.open(rakefile, 'w') do |f|
234
- f.write <<-EOH.gsub(/^ {12}/, '')
230
+ it "executes the command as the embedded rake" do
231
+ rakefile = File.join(project_dir, "Rakefile")
232
+ File.open(rakefile, "w") do |f|
233
+ f.write <<-EOH.gsub(/^ {12}/, "")
235
234
  task(:foo) { }
236
235
  EOH
237
236
  end
238
237
 
239
- fake_embedded_bin('rake')
238
+ fake_embedded_bin("rake")
240
239
 
241
- subject.rake('-T', shellout_opts(subject))
242
- subject.rake('foo', shellout_opts(subject))
240
+ subject.rake("-T", shellout_opts(subject))
241
+ subject.rake("foo", shellout_opts(subject))
243
242
  output = capture_logging { subject.build }
244
243
 
245
- expect(output).to include('rake -T')
246
- expect(output).to include('rake foo')
244
+ expect(output).to include("rake -T")
245
+ expect(output).to include("rake foo")
247
246
  end
248
247
  end
249
248
 
250
249
  describe '#block' do
251
- it 'executes the command as a block' do
252
- subject.block('A complex operation') do
250
+ it "executes the command as a block" do
251
+ subject.block("A complex operation") do
253
252
  FileUtils.touch("#{project_dir}/bacon")
254
253
  end
255
254
  output = capture_logging { subject.build }
256
255
 
257
- expect(output).to include('A complex operation')
256
+ expect(output).to include("A complex operation")
258
257
  expect("#{software.project_dir}/bacon").to be_a_file
259
258
  end
260
259
  end
261
260
 
262
261
  describe '#erb' do
263
- it 'renders the erb' do
264
- erb = File.join(templates_dir, 'example.erb')
265
- File.open(erb, 'w') do |f|
266
- f.write <<-EOH.gsub(/^ {12}/, '')
262
+ it "renders the erb" do
263
+ erb = File.join(templates_dir, "example.erb")
264
+ File.open(erb, "w") do |f|
265
+ f.write <<-EOH.gsub(/^ {12}/, "")
267
266
  <%= a %>
268
267
  <%= b %>
269
268
  EOH
270
269
  end
271
270
 
272
- destination = File.join(tmp_path, 'rendered')
271
+ destination = File.join(tmp_path, "rendered")
273
272
 
274
273
  subject.erb(
275
- source: 'example.erb',
274
+ source: "example.erb",
276
275
  dest: destination,
277
- vars: { a: 'foo', b: 'bar' },
276
+ vars: { a: "foo", b: "bar" }
278
277
  )
279
278
  subject.build
280
279
 
@@ -284,8 +283,8 @@ module Omnibus
284
283
  end
285
284
 
286
285
  describe '#mkdir' do
287
- it 'creates the directory' do
288
- path = File.join(tmp_path, 'scratch')
286
+ it "creates the directory" do
287
+ path = File.join(tmp_path, "scratch")
289
288
  remove_directory(path)
290
289
 
291
290
  subject.mkdir(path)
@@ -296,8 +295,8 @@ module Omnibus
296
295
  end
297
296
 
298
297
  describe '#touch' do
299
- it 'creates the file' do
300
- path = File.join(tmp_path, 'file')
298
+ it "creates the file" do
299
+ path = File.join(tmp_path, "file")
301
300
  remove_file(path)
302
301
 
303
302
  subject.touch(path)
@@ -306,8 +305,8 @@ module Omnibus
306
305
  expect(path).to be_a_file
307
306
  end
308
307
 
309
- it 'creates the containing directory' do
310
- path = File.join(tmp_path, 'foo', 'bar', 'file')
308
+ it "creates the containing directory" do
309
+ path = File.join(tmp_path, "foo", "bar", "file")
311
310
  FileUtils.rm_rf(path)
312
311
 
313
312
  subject.touch(path)
@@ -318,8 +317,8 @@ module Omnibus
318
317
  end
319
318
 
320
319
  describe '#delete' do
321
- it 'deletes the directory' do
322
- path = File.join(tmp_path, 'scratch')
320
+ it "deletes the directory" do
321
+ path = File.join(tmp_path, "scratch")
323
322
  create_directory(path)
324
323
 
325
324
  subject.delete(path)
@@ -328,8 +327,8 @@ module Omnibus
328
327
  expect(path).to_not be_a_directory
329
328
  end
330
329
 
331
- it 'deletes the file' do
332
- path = File.join(tmp_path, 'file')
330
+ it "deletes the file" do
331
+ path = File.join(tmp_path, "file")
333
332
  create_file(path)
334
333
 
335
334
  subject.delete(path)
@@ -338,9 +337,9 @@ module Omnibus
338
337
  expect(path).to_not be_a_file
339
338
  end
340
339
 
341
- it 'accepts a glob pattern' do
342
- path_a = File.join(tmp_path, 'file_a')
343
- path_b = File.join(tmp_path, 'file_b')
340
+ it "accepts a glob pattern" do
341
+ path_a = File.join(tmp_path, "file_a")
342
+ path_b = File.join(tmp_path, "file_b")
344
343
  FileUtils.touch(path_a)
345
344
  FileUtils.touch(path_b)
346
345
 
@@ -353,9 +352,9 @@ module Omnibus
353
352
  end
354
353
 
355
354
  describe '#copy' do
356
- it 'copies the file' do
357
- path_a = File.join(tmp_path, 'file1')
358
- path_b = File.join(tmp_path, 'file2')
355
+ it "copies the file" do
356
+ path_a = File.join(tmp_path, "file1")
357
+ path_b = File.join(tmp_path, "file2")
359
358
  create_file(path_a)
360
359
 
361
360
  subject.copy(path_a, path_b)
@@ -365,14 +364,14 @@ module Omnibus
365
364
  expect(File.read(path_b)).to eq(File.read(path_a))
366
365
  end
367
366
 
368
- it 'copies the directory and entries' do
369
- destination = File.join(tmp_path, 'destination')
367
+ it "copies the directory and entries" do
368
+ destination = File.join(tmp_path, "destination")
370
369
 
371
- directory = File.join(tmp_path, 'scratch')
370
+ directory = File.join(tmp_path, "scratch")
372
371
  FileUtils.mkdir_p(directory)
373
372
 
374
- path_a = File.join(directory, 'file_a')
375
- path_b = File.join(directory, 'file_b')
373
+ path_a = File.join(directory, "file_a")
374
+ path_b = File.join(directory, "file_b")
376
375
  FileUtils.touch(path_a)
377
376
  FileUtils.touch(path_b)
378
377
 
@@ -384,15 +383,15 @@ module Omnibus
384
383
  expect("#{destination}/file_b").to be_a_file
385
384
  end
386
385
 
387
- it 'accepts a glob pattern' do
388
- destination = File.join(tmp_path, 'destination')
386
+ it "accepts a glob pattern" do
387
+ destination = File.join(tmp_path, "destination")
389
388
  FileUtils.mkdir_p(destination)
390
389
 
391
- directory = File.join(tmp_path, 'scratch')
390
+ directory = File.join(tmp_path, "scratch")
392
391
  FileUtils.mkdir_p(directory)
393
392
 
394
- path_a = File.join(directory, 'file_a')
395
- path_b = File.join(directory, 'file_b')
393
+ path_a = File.join(directory, "file_a")
394
+ path_b = File.join(directory, "file_b")
396
395
  FileUtils.touch(path_a)
397
396
  FileUtils.touch(path_b)
398
397
 
@@ -406,9 +405,9 @@ module Omnibus
406
405
  end
407
406
 
408
407
  describe '#move' do
409
- it 'moves the file' do
410
- path_a = File.join(tmp_path, 'file1')
411
- path_b = File.join(tmp_path, 'file2')
408
+ it "moves the file" do
409
+ path_a = File.join(tmp_path, "file1")
410
+ path_b = File.join(tmp_path, "file2")
412
411
  create_file(path_a)
413
412
 
414
413
  subject.move(path_a, path_b)
@@ -418,14 +417,14 @@ module Omnibus
418
417
  expect(path_a).to_not be_a_file
419
418
  end
420
419
 
421
- it 'moves the directory and entries' do
422
- destination = File.join(tmp_path, 'destination')
420
+ it "moves the directory and entries" do
421
+ destination = File.join(tmp_path, "destination")
423
422
 
424
- directory = File.join(tmp_path, 'scratch')
423
+ directory = File.join(tmp_path, "scratch")
425
424
  FileUtils.mkdir_p(directory)
426
425
 
427
- path_a = File.join(directory, 'file_a')
428
- path_b = File.join(directory, 'file_b')
426
+ path_a = File.join(directory, "file_a")
427
+ path_b = File.join(directory, "file_b")
429
428
  FileUtils.touch(path_a)
430
429
  FileUtils.touch(path_b)
431
430
 
@@ -439,15 +438,15 @@ module Omnibus
439
438
  expect(directory).to_not be_a_directory
440
439
  end
441
440
 
442
- it 'accepts a glob pattern' do
443
- destination = File.join(tmp_path, 'destination')
441
+ it "accepts a glob pattern" do
442
+ destination = File.join(tmp_path, "destination")
444
443
  FileUtils.mkdir_p(destination)
445
444
 
446
- directory = File.join(tmp_path, 'scratch')
445
+ directory = File.join(tmp_path, "scratch")
447
446
  FileUtils.mkdir_p(directory)
448
447
 
449
- path_a = File.join(directory, 'file_a')
450
- path_b = File.join(directory, 'file_b')
448
+ path_a = File.join(directory, "file_a")
449
+ path_b = File.join(directory, "file_b")
451
450
  FileUtils.touch(path_a)
452
451
  FileUtils.touch(path_b)
453
452
 
@@ -463,9 +462,9 @@ module Omnibus
463
462
  end
464
463
 
465
464
  describe '#link', :not_supported_on_windows do
466
- it 'links the file' do
467
- path_a = File.join(tmp_path, 'file1')
468
- path_b = File.join(tmp_path, 'file2')
465
+ it "links the file" do
466
+ path_a = File.join(tmp_path, "file1")
467
+ path_b = File.join(tmp_path, "file2")
469
468
  create_file(path_a)
470
469
 
471
470
  subject.link(path_a, path_b)
@@ -474,9 +473,9 @@ module Omnibus
474
473
  expect(path_b).to be_a_symlink
475
474
  end
476
475
 
477
- it 'links the directory' do
478
- destination = File.join(tmp_path, 'destination')
479
- directory = File.join(tmp_path, 'scratch')
476
+ it "links the directory" do
477
+ destination = File.join(tmp_path, "destination")
478
+ directory = File.join(tmp_path, "scratch")
480
479
  FileUtils.mkdir_p(directory)
481
480
 
482
481
  subject.link(directory, destination)
@@ -485,15 +484,15 @@ module Omnibus
485
484
  expect(destination).to be_a_symlink
486
485
  end
487
486
 
488
- it 'accepts a glob pattern' do
489
- destination = File.join(tmp_path, 'destination')
487
+ it "accepts a glob pattern" do
488
+ destination = File.join(tmp_path, "destination")
490
489
  FileUtils.mkdir_p(destination)
491
490
 
492
- directory = File.join(tmp_path, 'scratch')
491
+ directory = File.join(tmp_path, "scratch")
493
492
  FileUtils.mkdir_p(directory)
494
493
 
495
- path_a = File.join(directory, 'file_a')
496
- path_b = File.join(directory, 'file_b')
494
+ path_a = File.join(directory, "file_a")
495
+ path_b = File.join(directory, "file_b")
497
496
  FileUtils.touch(path_a)
498
497
  FileUtils.touch(path_b)
499
498
 
@@ -507,28 +506,28 @@ module Omnibus
507
506
 
508
507
  describe '#sync' do
509
508
  let(:source) do
510
- source = File.join(tmp_path, 'source')
509
+ source = File.join(tmp_path, "source")
511
510
  FileUtils.mkdir_p(source)
512
511
 
513
- FileUtils.touch(File.join(source, 'file_a'))
514
- FileUtils.touch(File.join(source, 'file_b'))
515
- FileUtils.touch(File.join(source, 'file_c'))
512
+ FileUtils.touch(File.join(source, "file_a"))
513
+ FileUtils.touch(File.join(source, "file_b"))
514
+ FileUtils.touch(File.join(source, "file_c"))
516
515
 
517
- FileUtils.mkdir_p(File.join(source, 'folder'))
518
- FileUtils.touch(File.join(source, 'folder', 'file_d'))
519
- FileUtils.touch(File.join(source, 'folder', 'file_e'))
516
+ FileUtils.mkdir_p(File.join(source, "folder"))
517
+ FileUtils.touch(File.join(source, "folder", "file_d"))
518
+ FileUtils.touch(File.join(source, "folder", "file_e"))
520
519
 
521
- FileUtils.mkdir_p(File.join(source, '.dot_folder'))
522
- FileUtils.touch(File.join(source, '.dot_folder', 'file_f'))
520
+ FileUtils.mkdir_p(File.join(source, ".dot_folder"))
521
+ FileUtils.touch(File.join(source, ".dot_folder", "file_f"))
523
522
 
524
- FileUtils.touch(File.join(source, '.file_g'))
523
+ FileUtils.touch(File.join(source, ".file_g"))
525
524
  source
526
525
  end
527
526
 
528
- let(:destination) { File.join(tmp_path, 'destination') }
527
+ let(:destination) { File.join(tmp_path, "destination") }
529
528
 
530
- context 'when the destination is empty' do
531
- it 'syncs the directories' do
529
+ context "when the destination is empty" do
530
+ it "syncs the directories" do
532
531
  subject.sync(source, destination)
533
532
  subject.build
534
533
 
@@ -542,10 +541,10 @@ module Omnibus
542
541
  end
543
542
  end
544
543
 
545
- context 'when the directory exists' do
544
+ context "when the directory exists" do
546
545
  before { FileUtils.mkdir_p(destination) }
547
546
 
548
- it 'deletes existing files and folders' do
547
+ it "deletes existing files and folders" do
549
548
  FileUtils.mkdir_p("#{destination}/existing_folder")
550
549
  FileUtils.mkdir_p("#{destination}/.existing_folder")
551
550
  FileUtils.touch("#{destination}/existing_file")
@@ -569,9 +568,9 @@ module Omnibus
569
568
  end
570
569
  end
571
570
 
572
- context 'when :exclude is given' do
573
- it 'does not copy files and folders that match the pattern' do
574
- subject.sync(source, destination, exclude: '.dot_folder')
571
+ context "when :exclude is given" do
572
+ it "does not copy files and folders that match the pattern" do
573
+ subject.sync(source, destination, exclude: ".dot_folder")
575
574
  subject.build
576
575
 
577
576
  expect("#{destination}/file_a").to be_a_file
@@ -584,13 +583,13 @@ module Omnibus
584
583
  expect("#{destination}/.file_g").to be_a_file
585
584
  end
586
585
 
587
- it 'removes existing files and folders in destination' do
586
+ it "removes existing files and folders in destination" do
588
587
  FileUtils.mkdir_p("#{destination}/existing_folder")
589
588
  FileUtils.touch("#{destination}/existing_file")
590
589
  FileUtils.mkdir_p("#{destination}/.dot_folder")
591
590
  FileUtils.touch("#{destination}/.dot_folder/file_f")
592
591
 
593
- subject.sync(source, destination, exclude: '.dot_folder')
592
+ subject.sync(source, destination, exclude: ".dot_folder")
594
593
  subject.build
595
594
 
596
595
  expect("#{destination}/file_a").to be_a_file
@@ -615,33 +614,33 @@ module Omnibus
615
614
  FileUtils.mkdir_p(config_guess_dir)
616
615
  end
617
616
 
618
- context 'with no config.guess' do
617
+ context "with no config.guess" do
619
618
  before do
620
619
  File.open("#{config_guess_dir}/config.sub", "w+") do |f|
621
620
  f.write("This is config.sub")
622
621
  end
623
622
  end
624
623
 
625
- it 'fails' do
624
+ it "fails" do
626
625
  subject.update_config_guess
627
- expect{subject.build}.to raise_error(RuntimeError)
626
+ expect { subject.build }.to raise_error(RuntimeError)
628
627
  end
629
628
  end
630
629
 
631
- context 'with no config.sub' do
630
+ context "with no config.sub" do
632
631
  before do
633
632
  File.open("#{config_guess_dir}/config.guess", "w+") do |f|
634
633
  f.write("This is config.guess")
635
634
  end
636
635
  end
637
636
 
638
- it 'fails' do
637
+ it "fails" do
639
638
  subject.update_config_guess
640
- expect{subject.build}.to raise_error(RuntimeError)
639
+ expect { subject.build }.to raise_error(RuntimeError)
641
640
  end
642
641
  end
643
642
 
644
- context 'with config_guess dependency' do
643
+ context "with config_guess dependency" do
645
644
  before do
646
645
  File.open("#{config_guess_dir}/config.guess", "w+") do |f|
647
646
  f.write("This is config.guess")
@@ -652,28 +651,28 @@ module Omnibus
652
651
  end
653
652
  end
654
653
 
655
- it 'update config_guess with defaults' do
654
+ it "update config_guess with defaults" do
656
655
  subject.update_config_guess
657
656
  subject.build
658
657
  expect(File.read("#{project_dir}/config.guess")).to match /config.guess/
659
658
  expect(File.read("#{project_dir}/config.sub")).to match /config.sub/
660
659
  end
661
660
 
662
- it 'honors :target option' do
661
+ it "honors :target option" do
663
662
  subject.update_config_guess(target: "sub_dir")
664
663
  subject.build
665
664
  expect(File.read("#{project_dir}/sub_dir/config.guess")).to match /config.guess/
666
665
  expect(File.read("#{project_dir}/sub_dir/config.sub")).to match /config.sub/
667
666
  end
668
667
 
669
- it 'honors :config_guess in :install option' do
668
+ it "honors :config_guess in :install option" do
670
669
  subject.update_config_guess(install: [:config_guess])
671
670
  subject.build
672
671
  expect(File.read("#{project_dir}/config.guess")).to match /config.guess/
673
672
  expect(File.exist?("#{project_dir}/config.sub")).to be false
674
673
  end
675
674
 
676
- it 'honors :config_sub in :install option' do
675
+ it "honors :config_sub in :install option" do
677
676
  subject.update_config_guess(install: [:config_sub])
678
677
  subject.build
679
678
  expect(File.read("#{project_dir}/config.sub")).to match /config.sub/