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,46 +1,46 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Metadata do
5
5
  let(:instance) do
6
- double(described_class, path: '/path/to/package.deb.metadata.json')
6
+ double(described_class, path: "/path/to/package.deb.metadata.json")
7
7
  end
8
8
 
9
- let(:package_path) { '/path/to/package.deb' }
10
- let(:license_path) { '/opt/project/LICENSE' }
9
+ let(:package_path) { "/path/to/package.deb" }
10
+ let(:license_path) { "/opt/project/LICENSE" }
11
11
 
12
12
  let(:package) do
13
13
  double(Package,
14
- name: 'package',
14
+ name: "package",
15
15
  path: package_path,
16
- md5: 'abc123',
17
- sha1: 'abc123',
18
- sha256: 'abcd1234',
19
- sha512: 'abcdef123456',
16
+ md5: "abc123",
17
+ sha1: "abc123",
18
+ sha256: "abcd1234",
19
+ sha512: "abcdef123456"
20
20
  )
21
21
  end
22
22
 
23
23
  let(:project) do
24
24
  double(Project,
25
- name: 'some-project',
26
- friendly_name: 'Some Project',
27
- homepage: 'https://some.project.io',
28
- build_version: '1.2.3',
29
- build_iteration: '1',
30
- license: 'Apache-2.0',
25
+ name: "some-project",
26
+ friendly_name: "Some Project",
27
+ homepage: "https://some.project.io",
28
+ build_version: "1.2.3",
29
+ build_iteration: "1",
30
+ license: "Apache-2.0",
31
31
  built_manifest: double(Manifest,
32
32
  to_hash: {
33
33
  manifest_format: 2,
34
- build_version: '1.2.3',
35
- build_git_revision: 'SHA',
36
- license: 'Apache-2.0'
34
+ build_version: "1.2.3",
35
+ build_git_revision: "SHA",
36
+ license: "Apache-2.0",
37
37
  }
38
38
  ),
39
- license_file_path: license_path,
39
+ license_file_path: license_path
40
40
  )
41
41
  end
42
42
 
43
- let(:data) { { foo: 'bar' } }
43
+ let(:data) { { foo: "bar" } }
44
44
  let(:license_file_content) do
45
45
  <<-EOH
46
46
  some_project 1.2.3 license: "Apache-2.0"
@@ -61,9 +61,9 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
61
61
 
62
62
  subject { described_class.new(package, data) }
63
63
 
64
- describe '.generate' do
64
+ describe ".generate" do
65
65
  let(:metadata_json_content) { StringIO.new }
66
- let(:package_path) { '/path/to/package.deb' }
66
+ let(:package_path) { "/path/to/package.deb" }
67
67
 
68
68
  before do
69
69
  allow(File).to receive(:exist?).with(package_path).and_return(true)
@@ -71,137 +71,137 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
71
71
  allow(File).to receive(:exist?).with(license_path).and_return(true)
72
72
  allow(File).to receive(:read).with(license_path).and_return(license_file_content)
73
73
  # mock out `Metadata#save`
74
- allow(File).to receive(:open).with("#{package_path}.metadata.json", 'w+').and_yield(metadata_json_content)
74
+ allow(File).to receive(:open).with("#{package_path}.metadata.json", "w+").and_yield(metadata_json_content)
75
75
  end
76
76
 
77
- it 'creates a *.metadata.json file with the correct content' do
77
+ it "creates a *.metadata.json file with the correct content" do
78
78
 
79
79
  described_class.generate(package_path, project)
80
80
 
81
81
  expect(metadata_json_content.string).to include_json(
82
- basename: 'package',
83
- md5: 'abc123',
84
- sha1: 'abc123',
85
- sha256: 'abcd1234',
86
- sha512: 'abcdef123456',
87
- platform: 'ubuntu',
88
- platform_version: '12.04',
89
- arch: 'x86_64',
90
- name: 'some-project',
91
- friendly_name: 'Some Project',
92
- homepage: 'https://some.project.io',
93
- version: '1.2.3',
94
- iteration: '1',
82
+ basename: "package",
83
+ md5: "abc123",
84
+ sha1: "abc123",
85
+ sha256: "abcd1234",
86
+ sha512: "abcdef123456",
87
+ platform: "ubuntu",
88
+ platform_version: "12.04",
89
+ arch: "x86_64",
90
+ name: "some-project",
91
+ friendly_name: "Some Project",
92
+ homepage: "https://some.project.io",
93
+ version: "1.2.3",
94
+ iteration: "1",
95
95
  version_manifest: {
96
96
  manifest_format: 2,
97
- build_version: '1.2.3',
98
- build_git_revision: 'SHA',
99
- license: 'Apache-2.0',
97
+ build_version: "1.2.3",
98
+ build_git_revision: "SHA",
99
+ license: "Apache-2.0",
100
100
  },
101
- license_content: license_file_content,
101
+ license_content: license_file_content
102
102
  )
103
103
  end
104
104
 
105
- context 'the package file does not exist' do
105
+ context "the package file does not exist" do
106
106
  before do
107
107
  allow(File).to receive(:exist?).with(package_path).and_return(false)
108
108
  end
109
109
 
110
- it 'raises an exception' do
110
+ it "raises an exception" do
111
111
  expect { described_class.generate(package_path, project) }.to raise_error(Omnibus::NoPackageFile)
112
112
  end
113
113
  end
114
114
 
115
- context 'the license file does not exist' do
115
+ context "the license file does not exist" do
116
116
  before do
117
117
  allow(File).to receive(:exist?).with(license_path).and_return(false)
118
118
  end
119
119
 
120
- it 'does not include the license content' do
120
+ it "does not include the license content" do
121
121
  described_class.generate(package_path, project)
122
122
  expect(metadata_json_content.string).to include_json(
123
- license_content: '',
123
+ license_content: ""
124
124
  )
125
125
  end
126
126
  end
127
127
  end
128
128
 
129
- describe '.arch' do
130
- let(:architecture) { 'x86_64' }
129
+ describe ".arch" do
130
+ let(:architecture) { "x86_64" }
131
131
 
132
132
  before do
133
- stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
134
- data['kernel']['machine'] = architecture
133
+ stub_ohai(platform: "ubuntu", version: "12.04") do |data|
134
+ data["kernel"]["machine"] = architecture
135
135
  end
136
136
  end
137
137
 
138
- it 'returns the architecture' do
139
- expect(described_class.arch).to eq('x86_64')
138
+ it "returns the architecture" do
139
+ expect(described_class.arch).to eq("x86_64")
140
140
  end
141
141
 
142
- context 'on solaris' do
142
+ context "on solaris" do
143
143
  before do
144
- stub_ohai(platform: 'solaris2', version: '5.11') do |data|
145
- data['platform'] = 'solaris2'
146
- data['kernel']['machine'] = architecture
144
+ stub_ohai(platform: "solaris2", version: "5.11") do |data|
145
+ data["platform"] = "solaris2"
146
+ data["kernel"]["machine"] = architecture
147
147
  end
148
148
  end
149
149
 
150
- context 'architecture is Intel-based' do
151
- let(:architecture) { 'i86pc' }
150
+ context "architecture is Intel-based" do
151
+ let(:architecture) { "i86pc" }
152
152
 
153
- it 'returns i386' do
154
- expect(described_class.arch).to eq('i386')
153
+ it "returns i386" do
154
+ expect(described_class.arch).to eq("i386")
155
155
  end
156
156
  end
157
157
 
158
- context 'architecture is SPARC-based' do
159
- let(:architecture) { 'sun4v' }
158
+ context "architecture is SPARC-based" do
159
+ let(:architecture) { "sun4v" }
160
160
 
161
- it 'returns sparc' do
162
- expect(described_class.arch).to eq('sparc')
161
+ it "returns sparc" do
162
+ expect(described_class.arch).to eq("sparc")
163
163
  end
164
164
  end
165
165
  end
166
166
 
167
- context 'on windows' do
167
+ context "on windows" do
168
168
  before do
169
- stub_ohai(platform: 'windows', version: '2012R2') do |data|
170
- data['kernel']['machine'] = architecture
169
+ stub_ohai(platform: "windows", version: "2012R2") do |data|
170
+ data["kernel"]["machine"] = architecture
171
171
  end
172
172
  end
173
173
 
174
- it 'returns a 32-bit value based on Config.windows_arch being set to x86' do
174
+ it "returns a 32-bit value based on Config.windows_arch being set to x86" do
175
175
  expect(Config).to receive(:windows_arch).and_return(:x86)
176
- expect(described_class.arch).to eq('i386')
176
+ expect(described_class.arch).to eq("i386")
177
177
  end
178
178
  end
179
179
  end
180
180
 
181
- describe '.platform_shortname' do
182
- it 'returns el on rhel' do
183
- stub_ohai(platform: 'redhat', version: '6.4')
184
- expect(described_class.platform_shortname).to eq('el')
181
+ describe ".platform_shortname" do
182
+ it "returns el on rhel" do
183
+ stub_ohai(platform: "redhat", version: "6.4")
184
+ expect(described_class.platform_shortname).to eq("el")
185
185
  end
186
186
 
187
- it 'returns sles on suse' do
188
- stub_ohai(platform: 'suse', version: '12.0')
189
- expect(described_class.platform_shortname).to eq('sles')
187
+ it "returns sles on suse" do
188
+ stub_ohai(platform: "suse", version: "12.0")
189
+ expect(described_class.platform_shortname).to eq("sles")
190
190
  end
191
191
 
192
- it 'returns .platform on all other systems' do
193
- stub_ohai(platform: 'ubuntu', version: '12.04')
194
- expect(described_class.platform_shortname).to eq('ubuntu')
192
+ it "returns .platform on all other systems" do
193
+ stub_ohai(platform: "ubuntu", version: "12.04")
194
+ expect(described_class.platform_shortname).to eq("ubuntu")
195
195
  end
196
196
  end
197
197
 
198
- describe '.platform_version' do
199
- shared_examples 'a version manipulator' do |platform_shortname, version, expected|
198
+ describe ".platform_version" do
199
+ shared_examples "a version manipulator" do |platform_shortname, version, expected|
200
200
  context "on #{platform_shortname}-#{version}" do
201
- it 'returns the correct value' do
202
- stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
203
- data['platform'] = platform_shortname
204
- data['platform_version'] = version
201
+ it "returns the correct value" do
202
+ stub_ohai(platform: "ubuntu", version: "12.04") do |data|
203
+ data["platform"] = platform_shortname
204
+ data["platform_version"] = version
205
205
  end
206
206
 
207
207
  expect(described_class.platform_version).to eq(expected)
@@ -209,112 +209,112 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
209
209
  end
210
210
  end
211
211
 
212
- it_behaves_like 'a version manipulator', 'aix', '7.1', '7.1'
213
- it_behaves_like 'a version manipulator', 'arch', 'rolling', 'rolling'
214
- it_behaves_like 'a version manipulator', 'centos', '5.9.6', '5'
215
- it_behaves_like 'a version manipulator', 'debian', '7.1', '7'
216
- it_behaves_like 'a version manipulator', 'debian', '6.9', '6'
217
- it_behaves_like 'a version manipulator', 'el', '6.5', '6'
218
- it_behaves_like 'a version manipulator', 'fedora', '11.5', '11'
219
- it_behaves_like 'a version manipulator', 'freebsd', '10.0', '10'
220
- it_behaves_like 'a version manipulator', 'gentoo', '2004.3', '2004.3'
221
- it_behaves_like 'a version manipulator', 'ios_xr', '6.0.0.14I', '6'
222
- it_behaves_like 'a version manipulator', 'mac_os_x', '10.9.1', '10.9'
223
- it_behaves_like 'a version manipulator', 'nexus', '5.0', '5'
224
- it_behaves_like 'a version manipulator', 'omnios', 'r151010', 'r151010'
225
- it_behaves_like 'a version manipulator', 'openbsd', '5.4.4', '5.4'
226
- it_behaves_like 'a version manipulator', 'opensuse', '5.9', '5.9'
227
- it_behaves_like 'a version manipulator', 'pidora', '11.5', '11'
228
- it_behaves_like 'a version manipulator', 'raspbian', '7.1', '7'
229
- it_behaves_like 'a version manipulator', 'rhel', '6.5', '6'
230
- it_behaves_like 'a version manipulator', 'slackware', '12.0.1', '12.0'
231
- it_behaves_like 'a version manipulator', 'sles', '11.2', '11'
232
- it_behaves_like 'a version manipulator', 'suse', '12.0', '12'
233
- it_behaves_like 'a version manipulator', 'smartos', '20120809T221258Z', '20120809T221258Z'
234
- it_behaves_like 'a version manipulator', 'solaris2', '5.9', '5.9'
235
- it_behaves_like 'a version manipulator', 'ubuntu', '10.04', '10.04'
236
- it_behaves_like 'a version manipulator', 'ubuntu', '10.04.04', '10.04'
237
- it_behaves_like 'a version manipulator', 'windows', '5.0.2195', '2000'
238
- it_behaves_like 'a version manipulator', 'windows', '5.1.2600', 'xp'
239
- it_behaves_like 'a version manipulator', 'windows', '5.2.3790', '2003r2'
240
- it_behaves_like 'a version manipulator', 'windows', '6.0.6001', '2008'
241
- it_behaves_like 'a version manipulator', 'windows', '6.1.7600', '7'
242
- it_behaves_like 'a version manipulator', 'windows', '6.1.7601', '2008r2'
243
- it_behaves_like 'a version manipulator', 'windows', '6.2.9200', '8'
244
- it_behaves_like 'a version manipulator', 'windows', '6.3.9200', '8.1'
245
- it_behaves_like 'a version manipulator', 'windows', '6.3.9600', '8.1'
246
- it_behaves_like 'a version manipulator', 'windows', '10.0.10240', '10'
247
-
248
- context 'given an unknown platform' do
212
+ it_behaves_like "a version manipulator", "aix", "7.1", "7.1"
213
+ it_behaves_like "a version manipulator", "arch", "rolling", "rolling"
214
+ it_behaves_like "a version manipulator", "centos", "5.9.6", "5"
215
+ it_behaves_like "a version manipulator", "debian", "7.1", "7"
216
+ it_behaves_like "a version manipulator", "debian", "6.9", "6"
217
+ it_behaves_like "a version manipulator", "el", "6.5", "6"
218
+ it_behaves_like "a version manipulator", "fedora", "11.5", "11"
219
+ it_behaves_like "a version manipulator", "freebsd", "10.0", "10"
220
+ it_behaves_like "a version manipulator", "gentoo", "2004.3", "2004.3"
221
+ it_behaves_like "a version manipulator", "ios_xr", "6.0.0.14I", "6"
222
+ it_behaves_like "a version manipulator", "mac_os_x", "10.9.1", "10.9"
223
+ it_behaves_like "a version manipulator", "nexus", "5.0", "5"
224
+ it_behaves_like "a version manipulator", "omnios", "r151010", "r151010"
225
+ it_behaves_like "a version manipulator", "openbsd", "5.4.4", "5.4"
226
+ it_behaves_like "a version manipulator", "opensuse", "5.9", "5.9"
227
+ it_behaves_like "a version manipulator", "pidora", "11.5", "11"
228
+ it_behaves_like "a version manipulator", "raspbian", "7.1", "7"
229
+ it_behaves_like "a version manipulator", "rhel", "6.5", "6"
230
+ it_behaves_like "a version manipulator", "slackware", "12.0.1", "12.0"
231
+ it_behaves_like "a version manipulator", "sles", "11.2", "11"
232
+ it_behaves_like "a version manipulator", "suse", "12.0", "12"
233
+ it_behaves_like "a version manipulator", "smartos", "20120809T221258Z", "20120809T221258Z"
234
+ it_behaves_like "a version manipulator", "solaris2", "5.9", "5.9"
235
+ it_behaves_like "a version manipulator", "ubuntu", "10.04", "10.04"
236
+ it_behaves_like "a version manipulator", "ubuntu", "10.04.04", "10.04"
237
+ it_behaves_like "a version manipulator", "windows", "5.0.2195", "2000"
238
+ it_behaves_like "a version manipulator", "windows", "5.1.2600", "xp"
239
+ it_behaves_like "a version manipulator", "windows", "5.2.3790", "2003r2"
240
+ it_behaves_like "a version manipulator", "windows", "6.0.6001", "2008"
241
+ it_behaves_like "a version manipulator", "windows", "6.1.7600", "7"
242
+ it_behaves_like "a version manipulator", "windows", "6.1.7601", "2008r2"
243
+ it_behaves_like "a version manipulator", "windows", "6.2.9200", "2012"
244
+ it_behaves_like "a version manipulator", "windows", "6.3.9200", "2012r2"
245
+ it_behaves_like "a version manipulator", "windows", "6.3.9600", "2012r2"
246
+ it_behaves_like "a version manipulator", "windows", "10.0.10240", "10"
247
+
248
+ context "given an unknown platform" do
249
249
  before do
250
- stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
251
- data['platform'] = 'bacon'
252
- data['platform_version'] = '1.crispy'
250
+ stub_ohai(platform: "ubuntu", version: "12.04") do |data|
251
+ data["platform"] = "bacon"
252
+ data["platform_version"] = "1.crispy"
253
253
  end
254
254
  end
255
255
 
256
- it 'raises an exception' do
256
+ it "raises an exception" do
257
257
  expect { described_class.platform_version }
258
258
  .to raise_error(UnknownPlatform)
259
259
  end
260
260
  end
261
261
 
262
- context 'given an unknown windows platform version' do
262
+ context "given an unknown windows platform version" do
263
263
  before do
264
- stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
265
- data['platform'] = 'windows'
266
- data['platform_version'] = '1.2.3'
264
+ stub_ohai(platform: "ubuntu", version: "12.04") do |data|
265
+ data["platform"] = "windows"
266
+ data["platform_version"] = "1.2.3"
267
267
  end
268
268
  end
269
269
 
270
- it 'raises an exception' do
270
+ it "raises an exception" do
271
271
  expect { described_class.platform_version }
272
272
  .to raise_error(UnknownPlatformVersion)
273
273
  end
274
274
  end
275
275
  end
276
276
 
277
- describe '.for_package' do
278
- it 'raises an exception when the file does not exist' do
277
+ describe ".for_package" do
278
+ it "raises an exception when the file does not exist" do
279
279
  allow(File).to receive(:read).and_raise(Errno::ENOENT)
280
280
  expect { described_class.for_package(package) }
281
281
  .to raise_error(NoPackageMetadataFile)
282
282
  end
283
283
 
284
- it 'returns a metadata object' do
284
+ it "returns a metadata object" do
285
285
  allow(File).to receive(:read).and_return('{ "platform": "ubuntu" }')
286
286
  expect(described_class.for_package(package)).to be_a(described_class)
287
287
  end
288
288
 
289
- it 'loads the metadata from disk' do
289
+ it "loads the metadata from disk" do
290
290
  allow(File).to receive(:read).and_return('{ "platform": "ubuntu" }')
291
291
  instance = described_class.for_package(package)
292
292
 
293
- expect(instance[:platform]).to eq('ubuntu')
293
+ expect(instance[:platform]).to eq("ubuntu")
294
294
  end
295
295
 
296
- it 'ensures platform version is properly truncated' do
296
+ it "ensures platform version is properly truncated" do
297
297
  allow(File).to receive(:read).and_return('{ "platform": "el", "platform_version": "5.10" }')
298
298
  instance = described_class.for_package(package)
299
299
 
300
- expect(instance[:platform_version]).to eq('5')
300
+ expect(instance[:platform_version]).to eq("5")
301
301
  end
302
302
 
303
- it 'correctly truncates sles platform versions' do
303
+ it "correctly truncates sles platform versions" do
304
304
  allow(File).to receive(:read).and_return('{ "platform": "sles", "platform_version": "11.2" }')
305
305
  instance = described_class.for_package(package)
306
306
 
307
- expect(instance[:platform_version]).to eq('11')
307
+ expect(instance[:platform_version]).to eq("11")
308
308
  end
309
309
 
310
- it 'ensures an iteration exists' do
311
- allow(File).to receive(:read).and_return('{}')
310
+ it "ensures an iteration exists" do
311
+ allow(File).to receive(:read).and_return("{}")
312
312
  instance = described_class.for_package(package)
313
313
 
314
314
  expect(instance[:iteration]).to eq(1)
315
315
  end
316
316
 
317
- it 'does not change existing iterations' do
317
+ it "does not change existing iterations" do
318
318
  allow(File).to receive(:read).and_return('{ "iteration": 4 }')
319
319
  instance = described_class.for_package(package)
320
320
 
@@ -322,21 +322,21 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
322
322
  end
323
323
  end
324
324
 
325
- describe '.path_for' do
326
- it 'returns the postfixed .metadata.json' do
325
+ describe ".path_for" do
326
+ it "returns the postfixed .metadata.json" do
327
327
  expect(described_class.path_for(package))
328
- .to eq('/path/to/package.deb.metadata.json')
328
+ .to eq("/path/to/package.deb.metadata.json")
329
329
  end
330
330
  end
331
331
 
332
332
  describe '#name' do
333
- it 'returns the basename of the package' do
334
- expect(subject.name).to eq('package.deb.metadata.json')
333
+ it "returns the basename of the package" do
334
+ expect(subject.name).to eq("package.deb.metadata.json")
335
335
  end
336
336
  end
337
337
 
338
338
  describe '#path' do
339
- it 'delegates to .path_for' do
339
+ it "delegates to .path_for" do
340
340
  expect(described_class).to receive(:path_for).once
341
341
  subject.path
342
342
  end
@@ -347,15 +347,15 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
347
347
 
348
348
  before { allow(File).to receive(:open).and_yield(file) }
349
349
 
350
- it 'saves the file to disk' do
350
+ it "saves the file to disk" do
351
351
  expect(file).to receive(:write).once
352
352
  subject.save
353
353
  end
354
354
  end
355
355
 
356
356
  describe '#to_json' do
357
- it 'generates pretty JSON' do
358
- expect(subject.to_json.strip).to eq <<-EOH.gsub(/^ {10}/, '').strip
357
+ it "generates pretty JSON" do
358
+ expect(subject.to_json.strip).to eq <<-EOH.gsub(/^ {10}/, "").strip
359
359
  {
360
360
  "foo": "bar"
361
361
  }
@@ -1,11 +1,11 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Omnibus
4
4
  describe Ohai do
5
- context 'using hash notation' do
6
- it 'allows fetching values by hash notation' do
7
- expect { Ohai['kernel'] }.to_not raise_error
8
- expect { Ohai['kernel']['machine'] }.to_not raise_error
5
+ context "using hash notation" do
6
+ it "allows fetching values by hash notation" do
7
+ expect { Ohai["kernel"] }.to_not raise_error
8
+ expect { Ohai["kernel"]["machine"] }.to_not raise_error
9
9
  end
10
10
  end
11
11
  end