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,386 +1,361 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Software do
5
5
  let(:project) do
6
6
  Project.new.evaluate do
7
- name 'project'
8
- install_dir '/opt/project'
7
+ name "project"
8
+ install_dir "/opt/project"
9
9
  end
10
10
  end
11
11
 
12
12
  let(:source) do
13
13
  {
14
- url: 'http://example.com/',
15
- md5: 'abcd1234'
14
+ url: "http://example.com/",
15
+ md5: "abcd1234",
16
16
  }
17
17
  end
18
18
 
19
- let(:rel_path) { 'software' }
19
+ let(:rel_path) { "software" }
20
20
 
21
21
  subject do
22
22
  local_source = source
23
23
  local_rel_path = rel_path
24
24
 
25
25
  described_class.new(project).evaluate do
26
- name 'software'
27
- default_version '1.2.3'
26
+ name "software"
27
+ default_version "1.2.3"
28
28
 
29
29
  source local_source
30
30
  relative_path local_rel_path
31
31
  end
32
32
  end
33
33
 
34
- it_behaves_like 'a cleanroom getter', :project
35
- it_behaves_like 'a cleanroom setter', :name, %|name 'libxml2'|
36
- it_behaves_like 'a cleanroom setter', :description, %|description 'The XML magician'|
37
- it_behaves_like 'a cleanroom setter', :maintainer, %|maintainer 'Captain Jack <sparrow@chef.io>'|
38
- it_behaves_like 'a cleanroom setter', :dependency, %|dependency 'libxslt'|
39
- it_behaves_like 'a cleanroom setter', :source, %|source url: 'https://source.example.com'|
40
- it_behaves_like 'a cleanroom setter', :default_version, %|default_version '1.2.3'|
41
- it_behaves_like 'a cleanroom setter', :version, %|version '1.2.3'|
42
- it_behaves_like 'a cleanroom setter', :license, %|license 'Apache 2.0'|
43
- it_behaves_like 'a cleanroom setter', :license_file, %|license_file 'LICENSES/artistic.txt'|
44
- it_behaves_like 'a cleanroom setter', :whitelist_file, %|whitelist_file '/opt/whatever'|
45
- it_behaves_like 'a cleanroom setter', :relative_path, %|relative_path '/path/to/extracted'|
46
- it_behaves_like 'a cleanroom setter', :build, %|build {}|
47
- it_behaves_like 'a cleanroom getter', :project_dir
48
- it_behaves_like 'a cleanroom getter', :build_dir
49
- it_behaves_like 'a cleanroom getter', :install_dir
50
- it_behaves_like 'a cleanroom getter', :with_standard_compiler_flags
51
- it_behaves_like 'a cleanroom setter', :with_embedded_path, %|with_embedded_path({ 'foo' => 'bar' })|
52
- it_behaves_like 'a cleanroom setter', :prepend_path, %|prepend_path({ 'foo' => 'bar' })|
53
-
54
- context 'when a source_uri is present' do
55
- let(:uri) { URI.parse('http://example.com/foo.tar.gz') }
34
+ it_behaves_like "a cleanroom getter", :project
35
+ it_behaves_like "a cleanroom setter", :name, %{name 'libxml2'}
36
+ it_behaves_like "a cleanroom setter", :description, %{description 'The XML magician'}
37
+ it_behaves_like "a cleanroom setter", :maintainer, %{maintainer 'Captain Jack <sparrow@chef.io>'}
38
+ it_behaves_like "a cleanroom setter", :dependency, %{dependency 'libxslt'}
39
+ it_behaves_like "a cleanroom setter", :source, %{source url: 'https://source.example.com'}
40
+ it_behaves_like "a cleanroom setter", :default_version, %{default_version '1.2.3'}
41
+ it_behaves_like "a cleanroom setter", :version, %{version '1.2.3'}
42
+ it_behaves_like "a cleanroom setter", :license, %{license 'Apache 2.0'}
43
+ it_behaves_like "a cleanroom setter", :license_file, %{license_file 'LICENSES/artistic.txt'}
44
+ it_behaves_like "a cleanroom setter", :skip_transitive_dependency_licensing, %{skip_transitive_dependency_licensing true}
45
+ it_behaves_like "a cleanroom setter", :whitelist_file, %{whitelist_file '/opt/whatever'}
46
+ it_behaves_like "a cleanroom setter", :relative_path, %{relative_path '/path/to/extracted'}
47
+ it_behaves_like "a cleanroom setter", :build, %|build {}|
48
+ it_behaves_like "a cleanroom getter", :project_dir
49
+ it_behaves_like "a cleanroom getter", :build_dir
50
+ it_behaves_like "a cleanroom getter", :install_dir
51
+ it_behaves_like "a cleanroom getter", :with_standard_compiler_flags
52
+ it_behaves_like "a cleanroom setter", :with_embedded_path, %|with_embedded_path({ 'foo' => 'bar' })|
53
+ it_behaves_like "a cleanroom setter", :prepend_path, %|prepend_path({ 'foo' => 'bar' })|
54
+
55
+ context "when a source_uri is present" do
56
+ let(:uri) { URI.parse("http://example.com/foo.tar.gz") }
56
57
  before { allow(subject).to receive(:source_uri).and_return(uri) }
57
58
 
58
- it_behaves_like 'a cleanroom getter', :project_file
59
+ it_behaves_like "a cleanroom getter", :project_file
59
60
  end
60
61
 
61
- context 'when no license is present' do
62
+ context "when no license is present" do
62
63
  it "sets the defaults" do
63
- expect(subject.license).to eq ('Unspecified')
64
+ expect(subject.license).to eq ("Unspecified")
64
65
  end
65
66
  end
66
67
 
67
68
  describe "with_standard_compiler_flags helper" do
68
69
  context "on ubuntu" do
69
- before { stub_ohai(platform: 'ubuntu', version: '12.04') }
70
+ before { stub_ohai(platform: "ubuntu", version: "12.04") }
70
71
 
71
72
  it "sets the defaults" do
72
73
  expect(subject.with_standard_compiler_flags).to eq(
73
- 'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
74
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
75
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
76
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
77
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
78
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
74
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
75
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
76
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
77
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
78
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
79
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
79
80
  )
80
81
  end
81
- it 'overrides LDFLAGS' do
82
- expect(subject.with_standard_compiler_flags('LDFLAGS' => 'foo')).to eq(
83
- 'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
84
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
85
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
86
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
87
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
88
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
82
+ it "overrides LDFLAGS" do
83
+ expect(subject.with_standard_compiler_flags("LDFLAGS" => "foo")).to eq(
84
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
85
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
86
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
87
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
88
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
89
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
89
90
  )
90
91
  end
91
- it 'overrides CFLAGS' do
92
- expect(subject.with_standard_compiler_flags('CFLAGS'=>'foo')).to eq(
93
- 'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
94
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
95
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
96
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
97
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
98
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
92
+ it "overrides CFLAGS" do
93
+ expect(subject.with_standard_compiler_flags("CFLAGS" => "foo")).to eq(
94
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
95
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
96
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
97
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
98
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
99
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
99
100
  )
100
101
  end
101
- it 'overrides CXXFLAGS' do
102
- expect(subject.with_standard_compiler_flags('CXXFLAGS'=>'foo')).to eq(
103
- 'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
104
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
105
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
106
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
107
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
108
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
102
+ it "overrides CXXFLAGS" do
103
+ expect(subject.with_standard_compiler_flags("CXXFLAGS" => "foo")).to eq(
104
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
105
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
106
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
107
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
108
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
109
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
109
110
  )
110
111
  end
111
- it 'overrides CPPFLAGS' do
112
- expect(subject.with_standard_compiler_flags('CPPFLAGS'=>'foo')).to eq(
113
- 'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
114
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
115
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
116
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
117
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
118
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
112
+ it "overrides CPPFLAGS" do
113
+ expect(subject.with_standard_compiler_flags("CPPFLAGS" => "foo")).to eq(
114
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
115
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
116
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
117
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
118
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
119
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
119
120
  )
120
121
  end
121
- it 'preserves anything else' do
122
- expect(subject.with_standard_compiler_flags('numberwang'=>4)).to eq(
123
- 'numberwang' => 4,
124
- 'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
125
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
126
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
127
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
128
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
129
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
122
+ it "preserves anything else" do
123
+ expect(subject.with_standard_compiler_flags("numberwang" => 4)).to eq(
124
+ "numberwang" => 4,
125
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
126
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
127
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
128
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
129
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
130
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
130
131
  )
131
132
  end
132
133
  end
133
134
 
134
- context 'on solaris_11' do
135
- before do
136
- stub_ohai(platform: 'solaris2', version: '5.11') do |data|
137
- # For some reason, this isn't set in Fauxhai
138
- data['platform'] = 'solaris2'
139
- end
140
- end
141
-
142
- it 'sets the defaults' do
143
- expect(subject.with_standard_compiler_flags).to eq(
144
- "CC" => "gcc -m64 -static-libgcc",
145
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
146
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
147
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
148
- "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc",
149
- "LD_OPTIONS" => "-R/opt/project/embedded/lib",
150
- "LD_RUN_PATH" => "/opt/project/embedded/lib",
151
- "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
152
- )
153
- end
154
-
155
- context 'when loader mapping file is specified' do
156
- # Let the unit tests run on windows where auto-path translation occurs.
157
- let(:project_root) { File.join(tmp_path, '/root/project') }
158
- before do
159
- stub_ohai(platform: 'solaris2', version: '5.11') do |data|
160
- # For some reason, this isn't set in Fauxhai
161
- data['platform'] = 'solaris2'
162
- end
163
- Config.project_root(project_root)
164
- Config.solaris_linker_mapfile('files/mapfile/solaris')
165
- allow(File).to receive(:exist?).and_return(true)
166
- end
167
-
168
- it 'sets LD_OPTIONS correctly' do
169
- expect(subject.with_standard_compiler_flags).to eq(
170
- "CC" => "gcc -m64 -static-libgcc",
171
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
172
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
173
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
174
- "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc",
175
- "LD_OPTIONS" => "-R/opt/project/embedded/lib",
176
- "LD_RUN_PATH" => "/opt/project/embedded/lib",
177
- "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
178
- )
179
- end
180
- end
135
+ context "on solaris_11" do
136
+ before do
137
+ stub_ohai(platform: "solaris2", version: "5.11") do |data|
138
+ # For some reason, this isn't set in Fauxhai
139
+ data["platform"] = "solaris2"
140
+ end
141
+ end
142
+
143
+ it "sets the defaults" do
144
+ expect(subject.with_standard_compiler_flags).to eq(
145
+ "CC" => "gcc -m64 -static-libgcc",
146
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
147
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
148
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
149
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc",
150
+ "LD_OPTIONS" => "-R/opt/project/embedded/lib",
151
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
152
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
153
+ )
154
+ end
155
+
156
+ context "when loader mapping file is specified" do
157
+ # Let the unit tests run on windows where auto-path translation occurs.
158
+ let(:project_root) { File.join(tmp_path, "/root/project") }
159
+ before do
160
+ stub_ohai(platform: "solaris2", version: "5.11") do |data|
161
+ # For some reason, this isn't set in Fauxhai
162
+ data["platform"] = "solaris2"
181
163
  end
164
+ Config.project_root(project_root)
165
+ Config.solaris_linker_mapfile("files/mapfile/solaris")
166
+ allow(File).to receive(:exist?).and_return(true)
167
+ end
168
+
169
+ it "sets LD_OPTIONS correctly" do
170
+ expect(subject.with_standard_compiler_flags).to eq(
171
+ "CC" => "gcc -m64 -static-libgcc",
172
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
173
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
174
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
175
+ "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc",
176
+ "LD_OPTIONS" => "-R/opt/project/embedded/lib",
177
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
178
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
179
+ )
180
+ end
181
+ end
182
+ end
182
183
 
183
- context 'on solaris_10' do
184
+ context "on solaris_10" do
184
185
  before do
185
- stub_ohai(platform: 'solaris2', version: '5.10') do |data|
186
+ stub_ohai(platform: "solaris2", version: "5.10") do |data|
186
187
  # For some reason, this isn't set in Fauxhai
187
- data['platform'] = 'solaris2'
188
+ data["platform"] = "solaris2"
188
189
  end
189
190
  end
190
191
 
191
- it 'sets the defaults' do
192
+ it "sets the defaults" do
192
193
  expect(subject.with_standard_compiler_flags).to eq(
193
- 'CC' => 'gcc -static-libgcc',
194
- 'LDFLAGS' => '-R/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc',
195
- 'CFLAGS' => '-I/opt/project/embedded/include',
194
+ "CC" => "gcc -static-libgcc",
195
+ "LDFLAGS" => "-R/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc",
196
+ "CFLAGS" => "-I/opt/project/embedded/include",
196
197
  "CXXFLAGS" => "-I/opt/project/embedded/include",
197
198
  "CPPFLAGS" => "-I/opt/project/embedded/include",
198
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
199
- 'LD_OPTIONS' => '-R/opt/project/embedded/lib',
200
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
199
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
200
+ "LD_OPTIONS" => "-R/opt/project/embedded/lib",
201
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
201
202
  )
202
203
  end
203
204
 
204
- context 'when loader mapping file is specified' do
205
+ context "when loader mapping file is specified" do
205
206
  # Let the unit tests run on windows where auto-path translation occurs.
206
- let(:project_root) { File.join(tmp_path, '/root/project') }
207
+ let(:project_root) { File.join(tmp_path, "/root/project") }
207
208
  before do
208
- stub_ohai(platform: 'solaris2', version: '5.10') do |data|
209
+ stub_ohai(platform: "solaris2", version: "5.10") do |data|
209
210
  # For some reason, this isn't set in Fauxhai
210
- data['platform'] = 'solaris2'
211
+ data["platform"] = "solaris2"
211
212
  end
212
213
  Config.project_root(project_root)
213
- Config.solaris_linker_mapfile('files/mapfile/solaris')
214
+ Config.solaris_linker_mapfile("files/mapfile/solaris")
214
215
  allow(File).to receive(:exist?).and_return(true)
215
216
  end
216
217
 
217
- it 'sets LD_OPTIONS correctly' do
218
+ it "sets LD_OPTIONS correctly" do
218
219
  expect(subject.with_standard_compiler_flags).to eq(
219
- 'CC' => 'gcc -static-libgcc',
220
- 'LDFLAGS' => '-R/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc',
221
- 'CFLAGS' => '-I/opt/project/embedded/include',
220
+ "CC" => "gcc -static-libgcc",
221
+ "LDFLAGS" => "-R/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc",
222
+ "CFLAGS" => "-I/opt/project/embedded/include",
222
223
  "CXXFLAGS" => "-I/opt/project/embedded/include",
223
224
  "CPPFLAGS" => "-I/opt/project/embedded/include",
224
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
225
- 'LD_OPTIONS' => "-R/opt/project/embedded/lib -M #{project_root}/files/mapfile/solaris",
226
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
225
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
226
+ "LD_OPTIONS" => "-R/opt/project/embedded/lib -M #{project_root}/files/mapfile/solaris",
227
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
227
228
  )
228
229
  end
229
230
  end
230
231
  end
231
232
 
232
- context 'on mac_os_x' do
233
- before { stub_ohai(platform: 'mac_os_x', version: '10.9.2') }
233
+ context "on mac_os_x" do
234
+ before { stub_ohai(platform: "mac_os_x", version: "10.9.2") }
234
235
 
235
- it 'sets the defaults' do
236
+ it "sets the defaults" do
236
237
  expect(subject.with_standard_compiler_flags).to eq(
237
- 'LDFLAGS' => '-L/opt/project/embedded/lib',
238
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
238
+ "LDFLAGS" => "-L/opt/project/embedded/lib",
239
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
239
240
  "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
240
241
  "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
241
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
242
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
242
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
243
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
243
244
  )
244
245
  end
245
246
  end
246
247
 
247
- context 'on aix' do
248
+ context "on aix" do
248
249
  before do
249
250
  # There's no AIX in Fauxhai :(
250
- stub_ohai(platform: 'solaris2', version: '5.11') do |data|
251
- data['platform'] = 'aix'
251
+ stub_ohai(platform: "solaris2", version: "5.11") do |data|
252
+ data["platform"] = "aix"
252
253
  end
253
254
  end
254
255
 
255
- it 'sets the defaults' do
256
+ it "sets the defaults" do
256
257
  expect(subject.with_standard_compiler_flags).to eq(
257
- 'CC' => 'xlc_r -q64',
258
- 'CXX' => 'xlC_r -q64',
259
- 'CFLAGS' => '-q64 -I/opt/project/embedded/include -D_LARGE_FILES -O',
258
+ "CC" => "xlc_r -q64",
259
+ "CXX" => "xlC_r -q64",
260
+ "CFLAGS" => "-q64 -I/opt/project/embedded/include -D_LARGE_FILES -O",
260
261
  "CXXFLAGS" => "-q64 -I/opt/project/embedded/include -D_LARGE_FILES -O",
261
262
  "CPPFLAGS" => "-q64 -I/opt/project/embedded/include -D_LARGE_FILES -O",
262
- 'LDFLAGS' => '-q64 -L/opt/project/embedded/lib -Wl,-blibpath:/opt/project/embedded/lib:/usr/lib:/lib',
263
- 'LD' => 'ld -b64',
264
- 'OBJECT_MODE' => '64',
265
- 'ARFLAGS' => '-X64 cru',
266
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
267
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
263
+ "LDFLAGS" => "-q64 -L/opt/project/embedded/lib -Wl,-blibpath:/opt/project/embedded/lib:/usr/lib:/lib",
264
+ "LD" => "ld -b64",
265
+ "OBJECT_MODE" => "64",
266
+ "ARFLAGS" => "-X64 cru",
267
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
268
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
268
269
  )
269
270
  end
270
271
  end
271
272
 
272
- context 'on freebsd 9' do
273
+ context "on freebsd 9" do
273
274
  before do
274
- stub_ohai(platform: 'freebsd', version: '9.2')
275
+ stub_ohai(platform: "freebsd", version: "9.2")
275
276
  end
276
277
 
277
- it 'sets the defaults' do
278
+ it "sets the defaults" do
278
279
  expect(subject.with_standard_compiler_flags).to eq(
279
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
280
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
281
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
282
- 'LDFLAGS' => '-L/opt/project/embedded/lib',
283
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
284
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
280
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
281
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
282
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
283
+ "LDFLAGS" => "-L/opt/project/embedded/lib",
284
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
285
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
285
286
  )
286
287
  end
287
288
 
288
- context 'with gcc 4.9 installed' do
289
+ context "with gcc 4.9 installed" do
289
290
  before do
290
- allow(subject).to receive(:which).and_return('/usr/local/bin/gcc49')
291
+ allow(subject).to receive(:which).and_return("/usr/local/bin/gcc49")
291
292
  end
292
293
 
293
- it 'sets the compiler args' do
294
+ it "sets the compiler args" do
294
295
  expect(subject.with_standard_compiler_flags).to eq(
295
- 'CC' => 'gcc49',
296
- 'CXX' => 'g++49',
297
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
298
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
299
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
300
- 'LDFLAGS' => '-L/opt/project/embedded/lib',
301
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
302
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig', )
296
+ "CC" => "gcc49",
297
+ "CXX" => "g++49",
298
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
299
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
300
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
301
+ "LDFLAGS" => "-L/opt/project/embedded/lib",
302
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
303
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig" )
303
304
  end
304
305
  end
305
306
  end
306
307
 
307
- context 'on freebsd 10' do
308
+ context "on freebsd 10" do
308
309
  before do
309
- stub_ohai(platform: 'freebsd', version: '10.0')
310
+ stub_ohai(platform: "freebsd", version: "10.0")
310
311
  end
311
312
 
312
- it 'Clang as the default compiler' do
313
+ it "Clang as the default compiler" do
313
314
  expect(subject.with_standard_compiler_flags).to eq(
314
- 'CC' => 'clang',
315
- 'CXX' => 'clang++',
316
- 'CFLAGS' => '-I/opt/project/embedded/include -O2',
317
- 'CXXFLAGS' => '-I/opt/project/embedded/include -O2',
318
- 'CPPFLAGS' => '-I/opt/project/embedded/include -O2',
319
- 'LDFLAGS' => '-L/opt/project/embedded/lib',
320
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
321
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
315
+ "CC" => "clang",
316
+ "CXX" => "clang++",
317
+ "CFLAGS" => "-I/opt/project/embedded/include -O2",
318
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
319
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
320
+ "LDFLAGS" => "-L/opt/project/embedded/lib",
321
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
322
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
322
323
  )
323
324
  end
324
325
  end
325
326
 
326
- context 'on Windows' do
327
+ context "on Windows" do
327
328
  let(:win_arch_i386) { true }
328
329
 
329
330
  before do
330
- stub_ohai(platform: 'windows', version: '2012')
331
+ stub_ohai(platform: "windows", version: "2012")
331
332
  allow(subject).to receive(:windows_arch_i386?).and_return(win_arch_i386)
332
333
  end
333
334
 
334
- context 'in 32-bit mode' do
335
- it 'sets the default' do
335
+ context "in 32-bit mode" do
336
+ it "sets the default" do
336
337
  expect(subject.with_standard_compiler_flags).to eq(
337
- 'CFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -march=i686',
338
- 'CXXFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -march=i686',
339
- 'CPPFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -march=i686',
340
- 'LDFLAGS' => '-L/opt/project/embedded/lib -m32',
341
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
342
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
343
- )
344
- end
345
-
346
- it 'sets BFD flags if requested' do
347
- expect(subject.with_standard_compiler_flags({}, bfd_flags: true)).to eq(
348
- 'CFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -march=i686',
349
- 'CXXFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -march=i686',
350
- 'CPPFLAGS' => '-I/opt/project/embedded/include -m32 -O3 -march=i686',
351
- 'LDFLAGS' => '-L/opt/project/embedded/lib -m32',
352
- 'RCFLAGS' => '--target=pe-i386',
353
- 'ARFLAGS' => '--target=pe-i386',
354
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
355
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
338
+ "CFLAGS" => "-I/opt/project/embedded/include -m32 -O2 -fno-lto -march=i686",
339
+ "CXXFLAGS" => "-I/opt/project/embedded/include -m32 -O2 -fno-lto -march=i686",
340
+ "CPPFLAGS" => "-I/opt/project/embedded/include -m32 -O2 -fno-lto -march=i686",
341
+ "LDFLAGS" => "-L/opt/project/embedded/lib -m32 -fno-lto",
342
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
343
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
356
344
  )
357
345
  end
358
346
  end
359
347
 
360
- context 'in 64-bit mode' do
348
+ context "in 64-bit mode" do
361
349
  let(:win_arch_i386) { false }
362
350
 
363
- it 'sets the default' do
351
+ it "sets the default" do
364
352
  expect(subject.with_standard_compiler_flags).to eq(
365
- 'CFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -march=x86-64',
366
- 'CXXFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -march=x86-64',
367
- 'CPPFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -march=x86-64',
368
- 'LDFLAGS' => '-L/opt/project/embedded/lib -m64',
369
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
370
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
371
- )
372
- end
373
-
374
- it 'sets BFD flags if requested' do
375
- expect(subject.with_standard_compiler_flags({}, bfd_flags: true)).to eq(
376
- 'CFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -march=x86-64',
377
- 'CXXFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -march=x86-64',
378
- 'CPPFLAGS' => '-I/opt/project/embedded/include -m64 -O3 -march=x86-64',
379
- 'LDFLAGS' => '-L/opt/project/embedded/lib -m64',
380
- 'RCFLAGS' => '--target=pe-x86-64',
381
- 'ARFLAGS' => '--target=pe-x86-64',
382
- 'LD_RUN_PATH' => '/opt/project/embedded/lib',
383
- 'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
353
+ "CFLAGS" => "-I/opt/project/embedded/include -m64 -O2 -fno-lto -march=x86-64",
354
+ "CXXFLAGS" => "-I/opt/project/embedded/include -m64 -O2 -fno-lto -march=x86-64",
355
+ "CPPFLAGS" => "-I/opt/project/embedded/include -m64 -O2 -fno-lto -march=x86-64",
356
+ "LDFLAGS" => "-L/opt/project/embedded/lib -m64 -fno-lto",
357
+ "LD_RUN_PATH" => "/opt/project/embedded/lib",
358
+ "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig"
384
359
  )
385
360
  end
386
361
  end
@@ -388,11 +363,11 @@ module Omnibus
388
363
 
389
364
  end
390
365
 
391
- describe 'path helpers' do
366
+ describe "path helpers" do
392
367
 
393
368
  before do
394
- stub_const('File::PATH_SEPARATOR', separator)
395
- stub_env('PATH', path)
369
+ stub_const("File::PATH_SEPARATOR", separator)
370
+ stub_env("PATH", path)
396
371
  allow(project).to receive(:install_dir).and_return(install_dir)
397
372
  end
398
373
 
@@ -400,109 +375,96 @@ module Omnibus
400
375
  ["#{install_dir}/bin", separator, "#{install_dir}/embedded/bin", separator, path].join
401
376
  end
402
377
 
403
- context 'on *Nix' do
404
- let(:separator) { ':' }
405
- let(:path) { '/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin' }
406
- let(:install_dir) { '/opt/project' }
378
+ context "on *Nix" do
379
+ let(:separator) { ":" }
380
+ let(:path) { "/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" }
381
+ let(:install_dir) { "/opt/project" }
407
382
 
408
- it 'prepends a path to PATH' do
409
- expect(subject.prepend_path('/foo/bar')).to eq(
410
- ['/foo/bar', separator, path].join
383
+ it "prepends a path to PATH" do
384
+ expect(subject.prepend_path("/foo/bar")).to eq(
385
+ ["/foo/bar", separator, path].join
411
386
  )
412
387
  end
413
388
 
414
- it 'prepends the embedded bin to PATH' do
389
+ it "prepends the embedded bin to PATH" do
415
390
  expect(subject.with_embedded_path).to eq(
416
- 'PATH' => prepended_path
391
+ "PATH" => prepended_path
417
392
  )
418
393
  end
419
394
 
420
- it 'with_embedded_path merges with a hash argument' do
421
- expect(subject.with_embedded_path('numberwang' => 4)).to eq(
422
- 'numberwang' => 4,
423
- 'PATH' => prepended_path
395
+ it "with_embedded_path merges with a hash argument" do
396
+ expect(subject.with_embedded_path("numberwang" => 4)).to eq(
397
+ "numberwang" => 4,
398
+ "PATH" => prepended_path
424
399
  )
425
400
  end
426
401
 
427
- it 'with_embedded_path ignores option to add msys to path' do
428
- expect(subject.with_embedded_path({}, msys: true)).to eq(
429
- 'PATH' => prepended_path
430
- )
431
- end
432
-
433
- it 'prepends multiple paths to PATH' do
434
- expect(subject.prepend_path('/foo/bar', '/foo/baz')).to eq(
435
- ['/foo/bar', separator, '/foo/baz', separator, path].join
402
+ it "prepends multiple paths to PATH" do
403
+ expect(subject.prepend_path("/foo/bar", "/foo/baz")).to eq(
404
+ ["/foo/bar", separator, "/foo/baz", separator, path].join
436
405
  )
437
406
  end
438
407
  end
439
408
 
440
- context 'on Windows' do
409
+ context "on Windows" do
441
410
  before do
442
- stub_ohai(platform: 'windows', version: '2012')
411
+ stub_ohai(platform: "windows", version: "2012")
443
412
  end
444
413
 
445
- let(:separator) { ';' }
446
- let(:path) { 'c:/Ruby193/bin;c:/Windows/system32;c:/Windows;c:/Windows/System32/Wbem' }
447
- let(:install_dir) { 'c:/opt/project' }
414
+ let(:separator) { ";" }
415
+ let(:path) { "c:/Ruby193/bin;c:/Windows/system32;c:/Windows;c:/Windows/System32/Wbem" }
416
+ let(:install_dir) { "c:/opt/project" }
448
417
  let(:prepended_path_msys) do
449
418
  [ "#{install_dir}/bin", separator, "#{install_dir}/embedded/bin", separator,
450
419
  "#{install_dir}/embedded/msys/1.0/bin", separator, path].join
451
420
  end
452
421
 
453
- context '`Path` exists in the environment' do
422
+ context "`Path` exists in the environment" do
454
423
  before do
455
- stub_env('Path', path)
456
- allow(ENV).to receive(:keys).and_return(%w( Path PATH ))
424
+ stub_env("Path", path)
425
+ allow(ENV).to receive(:keys).and_return(%w{ Path PATH })
457
426
  end
458
427
 
459
- it 'returns a path key of `Path`' do
428
+ it "returns a path key of `Path`" do
460
429
  expect(subject.with_embedded_path).to eq(
461
- 'Path' => prepended_path
430
+ "Path" => prepended_path
462
431
  )
463
432
  end
464
433
  end
465
434
 
466
- context '`Path` does not exist in the environment' do
435
+ context "`Path` does not exist in the environment" do
467
436
  before do
468
- allow(ENV).to receive(:keys).and_return(['PATH'])
437
+ allow(ENV).to receive(:keys).and_return(["PATH"])
469
438
  end
470
439
 
471
- it 'returns a path key of `PATH`' do
440
+ it "returns a path key of `PATH`" do
472
441
  expect(subject.with_embedded_path).to eq(
473
- 'PATH' => prepended_path
474
- )
475
- end
476
-
477
- it 'with_embedded_path accepts option to add msys to path' do
478
- expect(subject.with_embedded_path({}, msys: true)).to eq(
479
- 'PATH' => prepended_path_msys
442
+ "PATH" => prepended_path
480
443
  )
481
444
  end
482
-
483
445
  end
484
446
  end
485
447
  end
486
448
 
487
449
  describe '#ohai' do
488
- before { stub_ohai(platform: 'ubuntu', version: '12.04') }
450
+ before { stub_ohai(platform: "ubuntu", version: "12.04") }
489
451
 
490
- it 'is a DSL method' do
452
+ it "is a DSL method" do
491
453
  expect(subject).to have_exposed_method(:ohai)
492
454
  end
493
455
 
494
- it 'delegates to the Ohai class' do
456
+ it "delegates to the Ohai class" do
495
457
  expect(subject.ohai).to be(Ohai)
496
458
  end
497
459
  end
498
460
 
499
461
  describe "#manifest_entry" do
500
462
  let(:a_source) do
501
- { url: 'http://example.com/',
502
- md5: 'abcd1234' }
463
+ { url: "http://example.com/",
464
+ md5: "abcd1234" }
503
465
  end
504
466
 
505
- let(:manifest_entry) {Omnibus::ManifestEntry.new("software", {locked_version: "1.2.8", locked_source: a_source})}
467
+ let(:manifest_entry) { Omnibus::ManifestEntry.new("software", { locked_version: "1.2.8", locked_source: a_source }) }
506
468
  let(:manifest) do
507
469
  m = Omnibus::Manifest.new
508
470
  m.add(:software, manifest_entry)
@@ -510,25 +472,25 @@ module Omnibus
510
472
 
511
473
  let(:project_with_manifest) do
512
474
  described_class.new(project, nil, manifest).evaluate do
513
- name 'software'
514
- default_version '1.2.3'
515
- source url: 'http://example.com/',
516
- md5: 'abcd1234'
475
+ name "software"
476
+ default_version "1.2.3"
477
+ source url: "http://example.com/",
478
+ md5: "abcd1234"
517
479
  end
518
480
  end
519
481
 
520
482
  let(:project_without_manifest) do
521
483
  described_class.new(project, nil, nil).evaluate do
522
- name 'software'
523
- default_version '1.2.3'
524
- source url: 'http://example.com/',
525
- md5: 'abcd1234'
484
+ name "software"
485
+ default_version "1.2.3"
486
+ source url: "http://example.com/",
487
+ md5: "abcd1234"
526
488
  end
527
489
  end
528
490
 
529
491
  let(:another_project) do
530
492
  described_class.new(project, nil, manifest).evaluate do
531
- name 'ruroh'
493
+ name "ruroh"
532
494
  end
533
495
  end
534
496
 
@@ -550,99 +512,99 @@ module Omnibus
550
512
  end
551
513
 
552
514
  it "raises an error if it was given a manifest but can't find it's entry" do
553
- expect{another_project.manifest_entry}.to raise_error(Manifest::MissingManifestEntry)
515
+ expect { another_project.manifest_entry }.to raise_error(Manifest::MissingManifestEntry)
554
516
  end
555
517
  end
556
518
 
557
519
  describe '#<=>' do
558
- let(:zlib) { described_class.new(project).tap { |s| s.name('zlib') } }
559
- let(:erchef) { described_class.new(project).tap { |s| s.name('erchef') } }
560
- let(:bacon) { described_class.new(project).tap { |s| s.name('bacon') } }
520
+ let(:zlib) { described_class.new(project).tap { |s| s.name("zlib") } }
521
+ let(:erchef) { described_class.new(project).tap { |s| s.name("erchef") } }
522
+ let(:bacon) { described_class.new(project).tap { |s| s.name("bacon") } }
561
523
 
562
- it 'compares projects by name' do
524
+ it "compares projects by name" do
563
525
  list = [zlib, erchef, bacon]
564
- expect(list.sort.map(&:name)).to eq(%w(bacon erchef zlib))
526
+ expect(list.sort.map(&:name)).to eq(%w{bacon erchef zlib})
565
527
  end
566
528
  end
567
529
 
568
530
  describe '#whitelist_file' do
569
- it 'appends to the whitelist_files array' do
531
+ it "appends to the whitelist_files array" do
570
532
  expect(subject.whitelist_files.size).to eq(0)
571
533
  subject.whitelist_file(/foo\/bar/)
572
534
  expect(subject.whitelist_files.size).to eq(1)
573
535
  end
574
536
 
575
- it 'converts Strings to Regexp instances' do
576
- subject.whitelist_file 'foo/bar'
537
+ it "converts Strings to Regexp instances" do
538
+ subject.whitelist_file "foo/bar"
577
539
  expect(subject.whitelist_files.size).to eq(1)
578
540
  expect(subject.whitelist_files.first).to be_kind_of(Regexp)
579
541
  end
580
542
  end
581
543
 
582
- context 'testing repo-level version overrides' do
583
- context 'without overrides' do
584
- it 'returns the original values' do
585
- expect(subject.version).to eq('1.2.3')
586
- expect(subject.source).to eq(url: 'http://example.com/', md5: 'abcd1234')
544
+ context "testing repo-level version overrides" do
545
+ context "without overrides" do
546
+ it "returns the original values" do
547
+ expect(subject.version).to eq("1.2.3")
548
+ expect(subject.source).to eq(url: "http://example.com/", md5: "abcd1234")
587
549
  end
588
550
  end
589
551
 
590
- context 'with overrides for different software' do
591
- before { project.override(:chaos_monkey, version: '1.2.8') }
552
+ context "with overrides for different software" do
553
+ before { project.override(:chaos_monkey, version: "1.2.8") }
592
554
 
593
- it 'does not change the software' do
594
- expect(subject.version).to eq('1.2.3')
555
+ it "does not change the software" do
556
+ expect(subject.version).to eq("1.2.3")
595
557
  end
596
558
  end
597
559
 
598
- context 'with overrides for this software' do
599
- context 'version' do
600
- let(:version) { '2.0.0.pre' }
601
- before { project.override(:software, version: '2.0.0.pre') }
560
+ context "with overrides for this software" do
561
+ context "version" do
562
+ let(:version) { "2.0.0.pre" }
563
+ before { project.override(:software, version: "2.0.0.pre") }
602
564
 
603
- it 'returns the correct version' do
565
+ it "returns the correct version" do
604
566
  expect(subject.version).to eq(version)
605
567
  end
606
568
  end
607
569
 
608
- context 'source' do
609
- let(:source) { { url: 'http://new.example.com', md5: 'defg5678' } }
570
+ context "source" do
571
+ let(:source) { { url: "http://new.example.com", md5: "defg5678" } }
610
572
  before { project.override(:software, source: source) }
611
573
 
612
- it 'returns the correct source' do
574
+ it "returns the correct source" do
613
575
  expect(subject.source).to eq(source)
614
576
  end
615
577
  end
616
578
  end
617
579
  end
618
580
 
619
- context 'when software source is a github spec' do
581
+ context "when software source is a github spec" do
620
582
  let(:source) do
621
583
  {
622
- github: 'chef/ohai'
584
+ github: "chef/ohai",
623
585
  }
624
586
  end
625
587
 
626
- it 'fetches from a fully expanded git path' do
588
+ it "fetches from a fully expanded git path" do
627
589
  expect(subject.source).to eq(git: "https://github.com/chef/ohai.git")
628
590
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://github.com/chef/ohai.git").and_return("1.2.8")
629
591
  subject.send(:fetcher)
630
592
  end
631
593
 
632
- context 'and override source is a git spec' do
594
+ context "and override source is a git spec" do
633
595
  before { project.override(:software, source: { git: "https://blah.com/git.git" }) }
634
596
 
635
- it 'fetches from the override path' do
597
+ it "fetches from the override path" do
636
598
  expect(subject.source).to eq(git: "https://blah.com/git.git")
637
599
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://blah.com/git.git").and_return("1.2.8")
638
600
  subject.send(:fetcher)
639
601
  end
640
602
  end
641
603
 
642
- context 'and override source is a github spec' do
604
+ context "and override source is a github spec" do
643
605
  before { project.override(:software, source: { github: "a/b" }) }
644
606
 
645
- it 'fetches from the override path' do
607
+ it "fetches from the override path" do
646
608
  expect(subject.source).to eq(git: "https://github.com/a/b.git")
647
609
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://github.com/a/b.git").and_return("1.2.8")
648
610
  subject.send(:fetcher)
@@ -650,23 +612,23 @@ module Omnibus
650
612
  end
651
613
  end
652
614
 
653
- context 'when software source is a git spec' do
615
+ context "when software source is a git spec" do
654
616
  let(:source) do
655
617
  {
656
- git: "https://blah.com/git.git"
618
+ git: "https://blah.com/git.git",
657
619
  }
658
620
  end
659
621
 
660
- it 'fetches from the git spec' do
622
+ it "fetches from the git spec" do
661
623
  expect(subject.source).to eq(git: "https://blah.com/git.git")
662
624
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://blah.com/git.git").and_return("1.2.8")
663
625
  subject.send(:fetcher)
664
626
  end
665
627
 
666
- context 'and override source is a github spec' do
628
+ context "and override source is a github spec" do
667
629
  before { project.override(:software, source: { github: "a/b" }) }
668
630
 
669
- it 'fetches from the override path' do
631
+ it "fetches from the override path" do
670
632
  expect(subject.source).to eq(git: "https://github.com/a/b.git")
671
633
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://github.com/a/b.git").and_return("1.2.8")
672
634
  subject.send(:fetcher)
@@ -679,105 +641,105 @@ module Omnibus
679
641
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", source).and_return("1.2.8")
680
642
  end
681
643
 
682
- context 'when given a source url to an archive' do
644
+ context "when given a source url to an archive" do
683
645
  let(:source) do
684
646
  {
685
- url: 'http://example.com/foo.tar.gz',
686
- md5: 'abcd1234'
647
+ url: "http://example.com/foo.tar.gz",
648
+ md5: "abcd1234",
687
649
  }
688
650
  end
689
651
 
690
- context 'when relative_path is the same as name' do
691
- let(:rel_path) { 'software' }
652
+ context "when relative_path is the same as name" do
653
+ let(:rel_path) { "software" }
692
654
 
693
- it 'ignores back-compat and leaves fetch_dir alone' do
655
+ it "ignores back-compat and leaves fetch_dir alone" do
694
656
  subject.send(:fetcher)
695
657
  expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
696
658
  end
697
659
 
698
- it 'sets the fetcher project_dir to fetch_dir' do
660
+ it "sets the fetcher project_dir to fetch_dir" do
699
661
  expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software"))
700
662
  end
701
663
  end
702
664
 
703
- context 'when relative_path is different from name' do
704
- let(:rel_path) { 'foo' }
665
+ context "when relative_path is different from name" do
666
+ let(:rel_path) { "foo" }
705
667
 
706
- it 'ignores back-compat and leaves fetch_dir alone' do
668
+ it "ignores back-compat and leaves fetch_dir alone" do
707
669
  subject.send(:fetcher)
708
670
  expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
709
671
  end
710
672
 
711
- it 'sets the fetcher project_dir to fetch_dir' do
673
+ it "sets the fetcher project_dir to fetch_dir" do
712
674
  expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software"))
713
675
  end
714
676
  end
715
677
  end
716
678
 
717
- context 'when given source url is not an archive' do
679
+ context "when given source url is not an archive" do
718
680
  let(:source) do
719
681
  {
720
- url: 'http://example.com/foo.txt',
721
- md5: 'abcd1234'
682
+ url: "http://example.com/foo.txt",
683
+ md5: "abcd1234",
722
684
  }
723
685
  end
724
686
 
725
- context 'when relative_path is the same as name' do
726
- let(:rel_path) { 'software' }
687
+ context "when relative_path is the same as name" do
688
+ let(:rel_path) { "software" }
727
689
 
728
- it 'for back-compat, changes fetch_dir' do
690
+ it "for back-compat, changes fetch_dir" do
729
691
  subject.send(:fetcher)
730
692
  expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
731
693
  end
732
694
 
733
- it 'sets the fetcher project_dir to project_dir' do
695
+ it "sets the fetcher project_dir to project_dir" do
734
696
  expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
735
697
  end
736
698
  end
737
699
 
738
- context 'when relative_path is different from name' do
739
- let(:rel_path) { 'foo' }
700
+ context "when relative_path is different from name" do
701
+ let(:rel_path) { "foo" }
740
702
 
741
- it 'ignores back-compat and leaves fetch_dir alone' do
703
+ it "ignores back-compat and leaves fetch_dir alone" do
742
704
  subject.send(:fetcher)
743
705
  expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
744
706
  end
745
707
 
746
- it 'sets the fetcher project_dir to project_dir' do
708
+ it "sets the fetcher project_dir to project_dir" do
747
709
  expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
748
710
  end
749
711
  end
750
712
  end
751
713
 
752
- context 'when given source is a git repo' do
714
+ context "when given source is a git repo" do
753
715
  let(:source) do
754
716
  {
755
- git: 'http://example.com/my/git/repo',
717
+ git: "http://example.com/my/git/repo",
756
718
  }
757
719
  end
758
720
 
759
- context 'when relative_path is the same as name' do
760
- let(:rel_path) { 'software' }
721
+ context "when relative_path is the same as name" do
722
+ let(:rel_path) { "software" }
761
723
 
762
- it 'for back-compat, changes fetch_dir' do
724
+ it "for back-compat, changes fetch_dir" do
763
725
  subject.send(:fetcher)
764
726
  expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
765
727
  end
766
728
 
767
- it 'sets the fetcher project_dir to project_dir' do
729
+ it "sets the fetcher project_dir to project_dir" do
768
730
  expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
769
731
  end
770
732
  end
771
733
 
772
- context 'when relative_path is different from name' do
773
- let(:rel_path) { 'foo' }
734
+ context "when relative_path is different from name" do
735
+ let(:rel_path) { "foo" }
774
736
 
775
- it 'ignores back-compat and leaves fetch_dir alone' do
737
+ it "ignores back-compat and leaves fetch_dir alone" do
776
738
  subject.send(:fetcher)
777
739
  expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
778
740
  end
779
741
 
780
- it 'sets the fetcher project_dir to project_dir' do
742
+ it "sets the fetcher project_dir to project_dir" do
781
743
  expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
782
744
  end
783
745
  end
@@ -791,7 +753,7 @@ module Omnibus
791
753
  it 'canonicalize_source(github: "chef/chef", submodules: true) yields git: "https://github.com/chef/chef.git", submodules: true' do
792
754
  expect(subject.send(:canonicalize_source, github: "chef/chef", submodules: true)).to eq(git: "https://github.com/chef/chef.git", submodules: true)
793
755
  end
794
- it 'canonicalize_source does not overwrite the original' do
756
+ it "canonicalize_source does not overwrite the original" do
795
757
  original = { github: "chef/chef", submodules: true }
796
758
  expect(subject.send(:canonicalize_source, original)).to eq(git: "https://github.com/chef/chef.git", submodules: true)
797
759
  expect(original).to eq(github: "chef/chef", submodules: true)
@@ -799,8 +761,8 @@ module Omnibus
799
761
  end
800
762
 
801
763
  describe '#shasum' do
802
- context 'when a filepath is given' do
803
- let(:path) { '/software.rb' }
764
+ context "when a filepath is given" do
765
+ let(:path) { "/software.rb" }
804
766
  let(:file) { double(File) }
805
767
 
806
768
  before { subject.instance_variable_set(:@filepath, path) }
@@ -814,16 +776,16 @@ module Omnibus
814
776
  .and_return(file)
815
777
  end
816
778
 
817
- it 'returns the correct shasum' do
818
- expect(subject.shasum).to eq('69dcce6da5580abe1da581e3f09d81e13ac676c48790eb0aa44d0ca2f93a16de')
779
+ it "returns the correct shasum" do
780
+ expect(subject.shasum).to eq("69dcce6da5580abe1da581e3f09d81e13ac676c48790eb0aa44d0ca2f93a16de")
819
781
  end
820
782
  end
821
783
 
822
- context 'when a filepath is not given' do
784
+ context "when a filepath is not given" do
823
785
  before { subject.send(:remove_instance_variable, :@filepath) }
824
786
 
825
- it 'returns the correct shasum' do
826
- expect(subject.shasum).to eq('acd88f56f17b7cbc146f351a9265b652bcf96d544821e7bc1e9663c80617276d')
787
+ it "returns the correct shasum" do
788
+ expect(subject.shasum).to eq("acd88f56f17b7cbc146f351a9265b652bcf96d544821e7bc1e9663c80617276d")
827
789
  end
828
790
  end
829
791
  end