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
- RSpec.shared_examples 'a software' do |name = 'chefdk'|
2
- let(:project_root) { File.join(tmp_path, 'software') }
1
+ RSpec.shared_examples "a software" do |name = "chefdk"|
2
+ let(:project_root) { File.join(tmp_path, "software") }
3
3
 
4
4
  let(:name) { name }
5
5
  let(:source) { nil }
6
- let(:version) { '1.0.0' }
6
+ let(:version) { "1.0.0" }
7
7
 
8
- let(:build_dir) { File.join(project_root, 'local', 'build') }
9
- let(:cache_dir) { File.join(project_root, 'local', 'cache') }
10
- let(:source_dir) { File.join(project_root, 'local', 'source') }
11
- let(:project_dir) { File.join(source_dir, 'project_dir') }
8
+ let(:build_dir) { File.join(project_root, "local", "build") }
9
+ let(:cache_dir) { File.join(project_root, "local", "cache") }
10
+ let(:source_dir) { File.join(project_root, "local", "source") }
11
+ let(:project_dir) { File.join(source_dir, "project_dir") }
12
12
 
13
- let(:patches_dir) { File.join(project_root, 'config', 'patches', name) }
14
- let(:scripts_dir) { File.join(project_root, 'config', 'scripts', name) }
15
- let(:softwares_dir) { File.join(project_root, 'config', 'software', name) }
16
- let(:templates_dir) { File.join(project_root, 'config', 'templates', name) }
13
+ let(:patches_dir) { File.join(project_root, "config", "patches", name) }
14
+ let(:scripts_dir) { File.join(project_root, "config", "scripts", name) }
15
+ let(:softwares_dir) { File.join(project_root, "config", "software", name) }
16
+ let(:templates_dir) { File.join(project_root, "config", "templates", name) }
17
17
 
18
- let(:install_dir) { File.join(project_root, 'opt', name) }
19
- let(:bin_dir) { File.join(install_dir, 'bin') }
20
- let(:embedded_bin_dir) { File.join(install_dir, 'embedded', 'bin') }
18
+ let(:install_dir) { File.join(project_root, "opt", name) }
19
+ let(:bin_dir) { File.join(install_dir, "bin") }
20
+ let(:embedded_bin_dir) { File.join(install_dir, "embedded", "bin") }
21
21
 
22
22
  let(:software) do
23
23
  double(Omnibus::Software,
@@ -27,7 +27,7 @@ RSpec.shared_examples 'a software' do |name = 'chefdk'|
27
27
  install_dir: install_dir,
28
28
  project_dir: project_dir,
29
29
  source: source,
30
- overridden?: false,
30
+ overridden?: false
31
31
  )
32
32
  end
33
33
 
@@ -58,5 +58,11 @@ RSpec.shared_examples 'a software' do |name = 'chefdk'|
58
58
  allow(software).to receive(:with_embedded_path).and_return(
59
59
  "PATH" => "#{bin_dir}:#{embedded_bin_dir}:#{ENV['PATH']}"
60
60
  )
61
+
62
+ allow(software).to receive(:embedded_bin) do |binary|
63
+ p = File.join(embedded_bin_dir, binary)
64
+ p.gsub!(/\//, '\\') if windows?
65
+ p
66
+ end
61
67
  end
62
68
  end
@@ -31,7 +31,7 @@ module Omnibus
31
31
  FileUtils.rm(path) if File.exist?(path)
32
32
 
33
33
  if block
34
- File.open(path, 'wb') { |f| f.write(block.call) }
34
+ File.open(path, "wb") { |f| f.write(yield) }
35
35
  else
36
36
  FileUtils.touch(path)
37
37
  end
@@ -1,4 +1,4 @@
1
- require_relative 'shell_helpers'
1
+ require_relative "shell_helpers"
2
2
 
3
3
  module Omnibus
4
4
  module RSpec
@@ -9,41 +9,41 @@ module Omnibus
9
9
  "file://#{fake_git_remote("git://github.com/omnibus/#{repo}.git", options)}/.git"
10
10
  end
11
11
 
12
- def local_git_repo(name, options={})
12
+ def local_git_repo(name, options = {})
13
13
  path = git_scratch
14
14
  Dir.chdir(path) do
15
15
  # Create a bogus configure file
16
- File.open('configure', 'w') { |f| f.write('echo "Done!"') }
16
+ File.open("configure", "w") { |f| f.write('echo "Done!"') }
17
17
 
18
- git %|init .|
19
- git %|add .|
20
- git %|commit -am "Initial commit for #{name}..."|
21
- git %|remote add origin "#{options[:remote]}"| if options[:remote]
22
- git %|push origin master|
18
+ git %{init .}
19
+ git %{add .}
20
+ git %{commit -am "Initial commit for #{name}..."}
21
+ git %{remote add origin "#{options[:remote]}"} if options[:remote]
22
+ git %{push origin master}
23
23
 
24
24
  options[:annotated_tags].each do |tag|
25
- File.open('tag', 'w') { |f| f.write(tag) }
26
- git %|add tag|
27
- git %|commit -am "Create tag #{tag}"|
28
- git %|tag "#{tag}" -m "#{tag}"|
29
- git %|push origin "#{tag}"| if options[:remote]
25
+ File.open("tag", "w") { |f| f.write(tag) }
26
+ git %{add tag}
27
+ git %{commit -am "Create tag #{tag}"}
28
+ git %{tag "#{tag}" -m "#{tag}"}
29
+ git %{push origin "#{tag}"} if options[:remote]
30
30
  end if options[:annotated_tags]
31
31
 
32
32
  options[:tags].each do |tag|
33
- File.open('tag', 'w') { |f| f.write(tag) }
34
- git %|add tag|
35
- git %|commit -am "Create tag #{tag}"|
36
- git %|tag "#{tag}"|
37
- git %|push origin "#{tag}"| if options[:remote]
33
+ File.open("tag", "w") { |f| f.write(tag) }
34
+ git %{add tag}
35
+ git %{commit -am "Create tag #{tag}"}
36
+ git %{tag "#{tag}"}
37
+ git %{push origin "#{tag}"} if options[:remote]
38
38
  end if options[:tags]
39
39
 
40
40
  options[:branches].each do |branch|
41
- git %|checkout -b #{branch} master|
42
- File.open('branch', 'w') { |f| f.write(branch) }
43
- git %|add branch|
44
- git %|commit -am "Create branch #{branch}"|
45
- git %|push origin "#{branch}"| if options[:remote]
46
- git %|checkout master|
41
+ git %{checkout -b #{branch} master}
42
+ File.open("branch", "w") { |f| f.write(branch) }
43
+ git %{add branch}
44
+ git %{commit -am "Create branch #{branch}"}
45
+ git %{push origin "#{branch}"} if options[:remote]
46
+ git %{checkout master}
47
47
  end if options[:branches]
48
48
  end
49
49
  path
@@ -57,10 +57,10 @@ module Omnibus
57
57
  FileUtils.mkdir_p(path)
58
58
 
59
59
  Dir.chdir(path) do
60
- git %|init --bare|
61
- git %|config core.sharedrepository 1|
62
- git %|config receive.denyNonFastforwards true|
63
- git %|config receive.denyCurrentBranch ignore|
60
+ git %{init --bare}
61
+ git %{config core.sharedrepository 1}
62
+ git %{config receive.denyNonFastforwards true}
63
+ git %{config receive.denyCurrentBranch ignore}
64
64
  end
65
65
 
66
66
  local_git_repo(name, options)
@@ -87,13 +87,13 @@ module Omnibus
87
87
  #
88
88
  # @return [Pathname]
89
89
  def remotes
90
- path = File.join(tmp_path, 'git', 'remotes')
90
+ path = File.join(tmp_path, "git", "remotes")
91
91
  FileUtils.mkdir_p(path) unless File.directory?(path)
92
92
  path
93
93
  end
94
94
 
95
95
  def git_scratch
96
- path = File.join(tmp_path, 'git', 'scratch')
96
+ path = File.join(tmp_path, "git", "scratch")
97
97
  FileUtils.mkdir_p(path) unless File.directory?(path)
98
98
  path
99
99
  end
@@ -103,14 +103,14 @@ module Omnibus
103
103
  # We need to override some of the variable's git uses for generating
104
104
  # the SHASUM for testing purposes
105
105
  #
106
- time = Time.at(680227200).utc.strftime('%c %z')
106
+ time = Time.at(680227200).utc.strftime("%c %z")
107
107
  env = {
108
- 'GIT_AUTHOR_NAME' => 'omnibus',
109
- 'GIT_AUTHOR_EMAIL' => 'omnibus@getchef.com',
110
- 'GIT_AUTHOR_DATE' => time,
111
- 'GIT_COMMITTER_NAME' => 'omnibus',
112
- 'GIT_COMMITTER_EMAIL' => 'omnibus@gechef.com',
113
- 'GIT_COMMITTER_DATE' => time,
108
+ "GIT_AUTHOR_NAME" => "omnibus",
109
+ "GIT_AUTHOR_EMAIL" => "omnibus@getchef.com",
110
+ "GIT_AUTHOR_DATE" => time,
111
+ "GIT_COMMITTER_NAME" => "omnibus",
112
+ "GIT_COMMITTER_EMAIL" => "omnibus@gechef.com",
113
+ "GIT_COMMITTER_DATE" => time,
114
114
  }
115
115
 
116
116
  shellout!("git #{command}", env: env)
@@ -1,4 +1,4 @@
1
- require 'rspec/expectations'
1
+ require "rspec/expectations"
2
2
 
3
3
  # expect('/path/to/directory').to be_a_directory
4
4
  RSpec::Matchers.define :be_a_directory do
@@ -24,8 +24,8 @@ end
24
24
  # expect('/path/to/file').to have_permissions
25
25
  RSpec::Matchers.define :have_permissions do |perm|
26
26
  match do |actual|
27
- m = sprintf('%o', File.stat(actual).mode)
28
- m == perm
27
+ m = sprintf("%o", File.stat(actual).mode)
28
+ m == perm
29
29
  end
30
30
  end
31
31
 
@@ -1,5 +1,5 @@
1
- require 'fauxhai'
2
- require 'omnibus/ohai'
1
+ require "fauxhai"
2
+ require "omnibus/ohai"
3
3
 
4
4
  module Omnibus
5
5
  module RSpec
@@ -13,8 +13,8 @@ module Omnibus
13
13
 
14
14
  # If we asked for Windows, we should also specify that magical
15
15
  # +File::ALT_SEPARATOR+ variable
16
- if options[:platform] && options[:platform] == 'windows'
17
- stub_const('File::ALT_SEPARATOR', '\\')
16
+ if options[:platform] && options[:platform] == "windows"
17
+ stub_const("File::ALT_SEPARATOR", '\\')
18
18
  end
19
19
  end
20
20
  end
@@ -6,13 +6,13 @@ module Omnibus
6
6
  end
7
7
 
8
8
  def tmp_path
9
- File.expand_path('../../tmp', __FILE__)
9
+ File.expand_path("../../tmp", __FILE__)
10
10
  end
11
11
 
12
12
  private
13
13
 
14
14
  def fixtures_path
15
- File.expand_path('../../fixtures', __FILE__)
15
+ File.expand_path("../../fixtures", __FILE__)
16
16
  end
17
17
  end
18
18
  end
@@ -1,11 +1,11 @@
1
- require 'mixlib/shellout'
1
+ require "mixlib/shellout"
2
2
 
3
3
  module Omnibus
4
4
  module RSpec
5
5
  module ShellHelpers
6
6
  def shellout!(command, options = {})
7
7
  cmd = Mixlib::ShellOut.new(command, options)
8
- cmd.environment['HOME'] = '/tmp' unless ENV['HOME']
8
+ cmd.environment["HOME"] = "/tmp" unless ENV["HOME"]
9
9
  cmd.run_command
10
10
  cmd
11
11
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe BuildVersionDSL do
@@ -10,7 +10,7 @@ module Omnibus
10
10
  let(:today_string) { Time.now.utc.strftime(Omnibus::BuildVersion::TIMESTAMP_FORMAT) }
11
11
 
12
12
  let(:zoo_version) { double("BuildVersion", semver: "5.5.5", custom: "7.7.7", build_start_time: today_string) }
13
- let(:zoo_software) { double("software", name: 'zoo', project_dir: '/etc/zoo', version: "6.6.6") }
13
+ let(:zoo_software) { double("software", name: "zoo", project_dir: "/etc/zoo", version: "6.6.6") }
14
14
 
15
15
  describe "when given nil" do
16
16
  it "fails" do
@@ -27,7 +27,7 @@ module Omnibus
27
27
  describe "when Config.append_timestamp is true" do
28
28
  let(:description) do
29
29
  proc do
30
- source(:git, from_dependency: 'zoo')
30
+ source(:git, from_dependency: "zoo")
31
31
  end
32
32
  end
33
33
 
@@ -54,7 +54,7 @@ module Omnibus
54
54
  describe "when given a software as source" do
55
55
  let(:description) do
56
56
  proc do
57
- source(:git, from_dependency: 'zoo')
57
+ source(:git, from_dependency: "zoo")
58
58
  end
59
59
  end
60
60
 
@@ -110,7 +110,7 @@ module Omnibus
110
110
  describe "when given a software as source" do
111
111
  let(:description) do
112
112
  proc do
113
- source(:version, from_dependency: 'zoo')
113
+ source(:version, from_dependency: "zoo")
114
114
  end
115
115
  end
116
116
 
@@ -1,8 +1,8 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe BuildVersion do
5
- let(:git_describe) { '11.0.0-alpha1-207-g694b062' }
5
+ let(:git_describe) { "11.0.0-alpha1-207-g694b062" }
6
6
  let(:valid_semver_regex) { /^\d+\.\d+\.\d+(\-[\dA-Za-z\-\.]+)?(\+[\dA-Za-z\-\.]+)?$/ }
7
7
  let(:valid_git_describe_regex) { /^\d+\.\d+\.\d+(\-[A-Za-z0-9\-\.]+)?(\-\d+\-g[0-9a-f]+)?$/ }
8
8
 
@@ -11,17 +11,17 @@ module Omnibus
11
11
  before do
12
12
  Config.append_timestamp(true)
13
13
  allow_any_instance_of(described_class).to receive(:shellout)
14
- .and_return(double('ouput', stdout: git_describe, exitstatus: 0))
14
+ .and_return(double("ouput", stdout: git_describe, exitstatus: 0))
15
15
  end
16
16
 
17
- describe 'git describe parsing' do
17
+ describe "git describe parsing" do
18
18
 
19
19
  # we prefer our git tags to be SemVer compliant
20
20
 
21
21
  # release version
22
- context '11.0.1' do
23
- let(:git_describe) { '11.0.1' }
24
- its(:version_tag) { should == '11.0.1' }
22
+ context "11.0.1" do
23
+ let(:git_describe) { "11.0.1" }
24
+ its(:version_tag) { should == "11.0.1" }
25
25
  its(:prerelease_tag) { should be_nil }
26
26
  its(:git_sha_tag) { should be_nil }
27
27
  its(:commits_since_tag) { should == 0 }
@@ -29,21 +29,21 @@ module Omnibus
29
29
  end
30
30
 
31
31
  # SemVer compliant prerelease version
32
- context '11.0.0-alpha.2' do
33
- let(:git_describe) { '11.0.0-alpha.2' }
34
- its(:version_tag) { should == '11.0.0' }
35
- its(:prerelease_tag) { should == 'alpha.2' }
32
+ context "11.0.0-alpha.2" do
33
+ let(:git_describe) { "11.0.0-alpha.2" }
34
+ its(:version_tag) { should == "11.0.0" }
35
+ its(:prerelease_tag) { should == "alpha.2" }
36
36
  its(:git_sha_tag) { should be_nil }
37
37
  its(:commits_since_tag) { should == 0 }
38
38
  its(:prerelease_version?) { should be_truthy }
39
39
  end
40
40
 
41
41
  # full git describe string
42
- context '11.0.0-alpha.3-59-gf55b180' do
43
- let(:git_describe) { '11.0.0-alpha.3-59-gf55b180' }
44
- its(:version_tag) { should == '11.0.0' }
45
- its(:prerelease_tag) { should == 'alpha.3' }
46
- its(:git_sha_tag) { should == 'f55b180' }
42
+ context "11.0.0-alpha.3-59-gf55b180" do
43
+ let(:git_describe) { "11.0.0-alpha.3-59-gf55b180" }
44
+ its(:version_tag) { should == "11.0.0" }
45
+ its(:prerelease_tag) { should == "alpha.3" }
46
+ its(:git_sha_tag) { should == "f55b180" }
47
47
  its(:commits_since_tag) { should == 59 }
48
48
  its(:prerelease_version?) { should be_truthy }
49
49
  end
@@ -51,40 +51,40 @@ module Omnibus
51
51
  # Degenerate git tag formats
52
52
 
53
53
  # RubyGems compliant git tag
54
- context '10.16.0.rc.0' do
55
- let(:git_describe) { '10.16.0.rc.0' }
56
- its(:version_tag) { should == '10.16.0' }
57
- its(:prerelease_tag) { should == 'rc.0' }
54
+ context "10.16.0.rc.0" do
55
+ let(:git_describe) { "10.16.0.rc.0" }
56
+ its(:version_tag) { should == "10.16.0" }
57
+ its(:prerelease_tag) { should == "rc.0" }
58
58
  its(:git_sha_tag) { should be_nil }
59
59
  its(:commits_since_tag) { should == 0 }
60
60
  its(:prerelease_version?) { should be_truthy }
61
61
  end
62
62
 
63
63
  # dash seperated prerelease
64
- context '11.0.0-alpha-2' do
65
- let(:git_describe) { '11.0.0-alpha-2' }
66
- its(:version_tag) { should == '11.0.0' }
67
- its(:prerelease_tag) { should == 'alpha-2' }
64
+ context "11.0.0-alpha-2" do
65
+ let(:git_describe) { "11.0.0-alpha-2" }
66
+ its(:version_tag) { should == "11.0.0" }
67
+ its(:prerelease_tag) { should == "alpha-2" }
68
68
  its(:git_sha_tag) { should be_nil }
69
69
  its(:commits_since_tag) { should == 0 }
70
70
  its(:prerelease_version?) { should be_truthy }
71
71
  end
72
72
 
73
73
  # dash seperated prerelease full git describe string
74
- context '11.0.0-alpha-2-59-gf55b180' do
75
- let(:git_describe) { '11.0.0-alpha-2-59-gf55b180' }
76
- its(:version_tag) { should == '11.0.0' }
77
- its(:prerelease_tag) { should == 'alpha-2' }
78
- its(:git_sha_tag) { should == 'f55b180' }
74
+ context "11.0.0-alpha-2-59-gf55b180" do
75
+ let(:git_describe) { "11.0.0-alpha-2-59-gf55b180" }
76
+ its(:version_tag) { should == "11.0.0" }
77
+ its(:prerelease_tag) { should == "alpha-2" }
78
+ its(:git_sha_tag) { should == "f55b180" }
79
79
  its(:commits_since_tag) { should == 59 }
80
80
  its(:prerelease_version?) { should be_truthy }
81
81
  end
82
82
 
83
83
  # WTF git tag
84
- context '11.0.0-alpha2' do
85
- let(:git_describe) { '11.0.0-alpha2' }
86
- its(:version_tag) { should == '11.0.0' }
87
- its(:prerelease_tag) { should == 'alpha2' }
84
+ context "11.0.0-alpha2" do
85
+ let(:git_describe) { "11.0.0-alpha2" }
86
+ its(:version_tag) { should == "11.0.0" }
87
+ its(:prerelease_tag) { should == "alpha2" }
88
88
  its(:git_sha_tag) { should be_nil }
89
89
  its(:commits_since_tag) { should == 0 }
90
90
  its(:prerelease_version?) { should be_truthy }
@@ -101,10 +101,10 @@ module Omnibus
101
101
  end
102
102
  end
103
103
 
104
- describe 'semver output' do
105
- let(:today_string) { Time.now.utc.strftime('%Y%m%d') }
104
+ describe "semver output" do
105
+ let(:today_string) { Time.now.utc.strftime("%Y%m%d") }
106
106
 
107
- it 'generates a valid semver version' do
107
+ it "generates a valid semver version" do
108
108
  expect(build_version.semver).to match(valid_semver_regex)
109
109
  end
110
110
 
@@ -113,56 +113,56 @@ module Omnibus
113
113
  end
114
114
 
115
115
  it "uses ENV['BUILD_ID'] to generate timestamp if set" do
116
- stub_env('BUILD_ID', '2012-12-25_16-41-40')
117
- expect(build_version.semver).to eq('11.0.0-alpha1+20121225164140.git.207.694b062')
116
+ stub_env("BUILD_ID", "2012-12-25_16-41-40")
117
+ expect(build_version.semver).to eq("11.0.0-alpha1+20121225164140.git.207.694b062")
118
118
  end
119
119
 
120
120
  it "fails on invalid ENV['BUILD_ID'] values" do
121
- stub_env('BUILD_ID', 'AAAA')
121
+ stub_env("BUILD_ID", "AAAA")
122
122
  expect { build_version.semver }.to raise_error(ArgumentError)
123
123
  end
124
124
 
125
- context 'prerelease version with dashes' do
126
- let(:git_describe) { '11.0.0-alpha-3-207-g694b062' }
125
+ context "prerelease version with dashes" do
126
+ let(:git_describe) { "11.0.0-alpha-3-207-g694b062" }
127
127
 
128
- it 'converts all dashes to dots' do
128
+ it "converts all dashes to dots" do
129
129
  expect(build_version.semver).to match(/11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/)
130
130
  end
131
131
  end
132
132
 
133
- context 'exact version' do
134
- let(:git_describe) { '11.0.0-alpha2' }
133
+ context "exact version" do
134
+ let(:git_describe) { "11.0.0-alpha2" }
135
135
 
136
- it 'appends a timestamp with no git info' do
136
+ it "appends a timestamp with no git info" do
137
137
  expect(build_version.semver).to match(/11.0.0-alpha2\+#{today_string}[0-9]+/)
138
138
  end
139
139
  end
140
140
 
141
- describe 'appending a timestamp' do
142
- let(:git_describe) { '11.0.0-alpha-3-207-g694b062' }
143
- context 'by default' do
144
- it 'appends a timestamp' do
141
+ describe "appending a timestamp" do
142
+ let(:git_describe) { "11.0.0-alpha-3-207-g694b062" }
143
+ context "by default" do
144
+ it "appends a timestamp" do
145
145
  expect(build_version.semver).to match(/11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/)
146
146
  end
147
147
  end
148
148
 
149
- context 'when Config.append_timestamp is true' do
150
- it 'appends a timestamp' do
149
+ context "when Config.append_timestamp is true" do
150
+ it "appends a timestamp" do
151
151
  expect(build_version.semver).to match(/11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/)
152
152
  end
153
153
  end
154
154
 
155
- context 'when Config.append_timestamp is false' do
155
+ context "when Config.append_timestamp is false" do
156
156
  before { Config.append_timestamp(false) }
157
- it 'does not append a timestamp' do
157
+ it "does not append a timestamp" do
158
158
  expect(build_version.semver).to match(/11.0.0-alpha.3\+git.207.694b062/)
159
159
  end
160
160
  end
161
161
  end
162
162
  end
163
163
 
164
- describe 'git describe output' do
165
- it 'generates a valid git describe version' do
164
+ describe "git describe output" do
165
+ it "generates a valid git describe version" do
166
166
  expect(build_version.git_describe).to match(valid_git_describe_regex)
167
167
  end
168
168
 
@@ -171,28 +171,28 @@ module Omnibus
171
171
  end
172
172
  end
173
173
 
174
- describe '`git describe` command failure' do
174
+ describe "`git describe` command failure" do
175
175
  before do
176
176
  stderr = <<-STDERR
177
177
  fatal: No tags can describe '809ea1afcce67e1148c1bf0822d40a7ef12c380e'.
178
178
  Try --always, or create some tags.
179
179
  STDERR
180
180
  allow(build_version).to receive(:shellout)
181
- .and_return(double('ouput', stderr: stderr, exitstatus: 128))
181
+ .and_return(double("ouput", stderr: stderr, exitstatus: 128))
182
182
  end
183
- it 'sets the version to 0.0.0' do
184
- expect(build_version.git_describe).to eq('0.0.0')
183
+ it "sets the version to 0.0.0" do
184
+ expect(build_version.git_describe).to eq("0.0.0")
185
185
  end
186
186
  end
187
187
 
188
188
  describe '#initialize `path` parameter' do
189
- let(:path) { '/some/fake/path' }
189
+ let(:path) { "/some/fake/path" }
190
190
  subject(:build_version) { BuildVersion.new(path) }
191
191
 
192
- it 'runs `git describe` at an alternate path' do
192
+ it "runs `git describe` at an alternate path" do
193
193
  expect(build_version).to receive(:shellout)
194
- .with('git describe --tags', cwd: path)
195
- .and_return(double('ouput', stdout: git_describe, exitstatus: 0))
194
+ .with("git describe --tags", cwd: path)
195
+ .and_return(double("ouput", stdout: git_describe, exitstatus: 0))
196
196
  build_version.git_describe
197
197
  end
198
198
  end