omnibus 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/features/commands/manifest.feature +1 -0
- data/features/commands/publish.feature +7 -0
- data/lib/omnibus.rb +0 -1
- data/lib/omnibus/cli.rb +3 -2
- data/lib/omnibus/cli/changelog.rb +2 -1
- data/lib/omnibus/cli/publish.rb +6 -1
- data/lib/omnibus/manifest.rb +30 -16
- data/lib/omnibus/manifest_entry.rb +5 -5
- data/lib/omnibus/metadata.rb +7 -4
- data/lib/omnibus/package.rb +2 -2
- data/lib/omnibus/packager.rb +10 -2
- data/lib/omnibus/packagers/ips.rb +301 -0
- data/lib/omnibus/project.rb +3 -3
- data/lib/omnibus/publisher.rb +2 -0
- data/lib/omnibus/publishers/artifactory_publisher.rb +66 -42
- data/lib/omnibus/publishers/s3_publisher.rb +1 -1
- data/lib/omnibus/software.rb +1 -1
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +2 -0
- data/resources/ips/doc-transform.erb +2 -0
- data/resources/ips/gen.manifestfile.erb +7 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/manifest_spec.rb +59 -27
- data/spec/unit/metadata_spec.rb +107 -2
- data/spec/unit/packager_spec.rb +64 -0
- data/spec/unit/packagers/ips_spec.rb +222 -0
- data/spec/unit/publisher_spec.rb +62 -0
- data/spec/unit/publishers/artifactory_publisher_spec.rb +82 -5
- data/spec/unit/publishers/s3_publisher_spec.rb +3 -3
- data/spec/unit/software_spec.rb +1 -1
- metadata +38 -3
data/lib/omnibus/project.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
require 'time'
|
19
|
-
require '
|
19
|
+
require 'ffi_yajl'
|
20
20
|
require 'omnibus/manifest'
|
21
21
|
require 'omnibus/manifest_entry'
|
22
22
|
require 'omnibus/reports'
|
@@ -1087,7 +1087,7 @@ module Omnibus
|
|
1087
1087
|
|
1088
1088
|
def write_json_manifest
|
1089
1089
|
File.open(json_manifest_path, 'w') do |f|
|
1090
|
-
f.write(
|
1090
|
+
f.write(FFI_Yajl::Encoder.encode(built_manifest.to_hash, pretty: true))
|
1091
1091
|
end
|
1092
1092
|
end
|
1093
1093
|
|
@@ -1206,7 +1206,7 @@ module Omnibus
|
|
1206
1206
|
|
1207
1207
|
update_with_string(digest, name)
|
1208
1208
|
update_with_string(digest, install_dir)
|
1209
|
-
update_with_string(digest,
|
1209
|
+
update_with_string(digest, FFI_Yajl::Encoder.encode(overrides))
|
1210
1210
|
|
1211
1211
|
if filepath && File.exist?(filepath)
|
1212
1212
|
update_with_file_contents(digest, filepath)
|
data/lib/omnibus/publisher.rb
CHANGED
@@ -28,17 +28,28 @@ module Omnibus
|
|
28
28
|
log.debug(log_key) { "Validating '#{package.name}'" }
|
29
29
|
package.validate!
|
30
30
|
|
31
|
-
# Upload the actual package
|
32
|
-
log.info(log_key) { "Uploading '#{package.name}'" }
|
33
|
-
|
34
31
|
retries = Config.publish_retries
|
35
32
|
|
36
33
|
begin
|
37
34
|
upload_time = Benchmark.realtime do
|
35
|
+
remote_path = remote_path_for(package)
|
36
|
+
properties = default_properties.merge(metadata_properties_for(package))
|
37
|
+
|
38
|
+
# Upload the package
|
39
|
+
log.info(log_key) { "Uploading '#{package.name}'" }
|
38
40
|
artifact_for(package).upload(
|
39
41
|
repository,
|
40
|
-
|
41
|
-
|
42
|
+
remote_path,
|
43
|
+
properties,
|
44
|
+
)
|
45
|
+
# Upload the package's assoacited `*.metadata.json` file
|
46
|
+
log.info(log_key) { "Uploading '#{package.name}.metadata.json'" }
|
47
|
+
artifact_for(package.metadata).upload(
|
48
|
+
repository,
|
49
|
+
"#{remote_path}.metadata.json",
|
50
|
+
# *.metadata.json files should not include
|
51
|
+
# the checksum properties
|
52
|
+
properties.dup.delete_if { |k,v| k =~ /^omnibus\.(md5|sha)/ },
|
42
53
|
)
|
43
54
|
end
|
44
55
|
rescue Artifactory::Error::HTTPError => e
|
@@ -71,18 +82,21 @@ module Omnibus
|
|
71
82
|
#
|
72
83
|
# The artifact object that corresponds to this package.
|
73
84
|
#
|
74
|
-
# @param [Package]
|
75
|
-
# the package to create the artifact from
|
85
|
+
# @param [Package,Metadata] artifact
|
86
|
+
# the package or metadata file to create the artifact from
|
76
87
|
#
|
77
88
|
# @return [Artifactory::Resource::Artifact]
|
78
89
|
#
|
79
|
-
def artifact_for(
|
90
|
+
def artifact_for(artifact)
|
91
|
+
md5 = artifact.respond_to?(:metadata) ? artifact.metadata[:md5] : digest(artifact.path, :md5)
|
92
|
+
sha1 = artifact.respond_to?(:metadata) ? artifact.metadata[:sha1] : digest(artifact.path, :sha1)
|
93
|
+
|
80
94
|
Artifactory::Resource::Artifact.new(
|
81
|
-
local_path:
|
95
|
+
local_path: artifact.path,
|
82
96
|
client: client,
|
83
97
|
checksums: {
|
84
|
-
'md5' =>
|
85
|
-
'sha1' =>
|
98
|
+
'md5' => md5,
|
99
|
+
'sha1' => sha1,
|
86
100
|
}
|
87
101
|
)
|
88
102
|
end
|
@@ -96,13 +110,20 @@ module Omnibus
|
|
96
110
|
# @return [Artifactory::Resource::Build]
|
97
111
|
#
|
98
112
|
def build_for(packages)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
manifest
|
103
|
-
|
113
|
+
metadata = packages.first.metadata
|
114
|
+
name = metadata[:name]
|
115
|
+
|
116
|
+
# Attempt to load the version manifest data from the packages metadata
|
117
|
+
manifest = if version_manifest = metadata[:version_manifest]
|
118
|
+
Manifest.from_hash(version_manifest)
|
104
119
|
else
|
105
|
-
Manifest.new(
|
120
|
+
Manifest.new(
|
121
|
+
metadata[:version],
|
122
|
+
# we already know the `version_manifest` entry is
|
123
|
+
# missing so we can't pull in the `build_git_revision`
|
124
|
+
nil,
|
125
|
+
metadata[:license],
|
126
|
+
)
|
106
127
|
end
|
107
128
|
|
108
129
|
# Upload the actual package
|
@@ -118,9 +139,10 @@ module Omnibus
|
|
118
139
|
version: Omnibus::VERSION,
|
119
140
|
},
|
120
141
|
properties: default_properties.merge(
|
121
|
-
'omnibus.project'
|
122
|
-
'omnibus.version'
|
123
|
-
'omnibus.
|
142
|
+
'omnibus.project' => name,
|
143
|
+
'omnibus.version' => manifest.build_version,
|
144
|
+
'omnibus.build_git_revision' => manifest.build_git_revision,
|
145
|
+
'omnibus.license' => manifest.license,
|
124
146
|
),
|
125
147
|
modules: [
|
126
148
|
{
|
@@ -131,13 +153,21 @@ module Omnibus
|
|
131
153
|
manifest.build_version,
|
132
154
|
].join(':'),
|
133
155
|
artifacts: packages.map do |package|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
156
|
+
[
|
157
|
+
{
|
158
|
+
type: File.extname(package.path).split('.').last,
|
159
|
+
sha1: package.metadata[:sha1],
|
160
|
+
md5: package.metadata[:md5],
|
161
|
+
name: package.metadata[:basename],
|
162
|
+
},
|
163
|
+
{
|
164
|
+
type: File.extname(package.metadata.path).split('.').last,
|
165
|
+
sha1: digest(package.metadata.path, :sha1),
|
166
|
+
md5: digest(package.metadata.path, :md5),
|
167
|
+
name: File.basename(package.metadata.path),
|
168
|
+
}
|
169
|
+
]
|
170
|
+
end.flatten
|
141
171
|
}
|
142
172
|
]
|
143
173
|
)
|
@@ -193,15 +223,18 @@ module Omnibus
|
|
193
223
|
'omnibus.architecture' => package.metadata[:arch],
|
194
224
|
'omnibus.version' => package.metadata[:version],
|
195
225
|
'omnibus.iteration' => package.metadata[:iteration],
|
226
|
+
'omnibus.license' => package.metadata[:license],
|
196
227
|
'omnibus.md5' => package.metadata[:md5],
|
197
228
|
'omnibus.sha1' => package.metadata[:sha1],
|
198
229
|
'omnibus.sha256' => package.metadata[:sha256],
|
199
|
-
'omnibus.sha512' => package.metadata[:sha512]
|
200
|
-
}
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
230
|
+
'omnibus.sha512' => package.metadata[:sha512]
|
231
|
+
}.tap do |h|
|
232
|
+
if build_record?
|
233
|
+
h['build.name'] = package.metadata[:name]
|
234
|
+
h['build.number'] = package.metadata[:version]
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
205
238
|
metadata
|
206
239
|
end
|
207
240
|
|
@@ -223,15 +256,6 @@ module Omnibus
|
|
223
256
|
@options[:repository]
|
224
257
|
end
|
225
258
|
|
226
|
-
#
|
227
|
-
# The path to the builds version-manfest.json file (as supplied as an option).
|
228
|
-
#
|
229
|
-
# @return [String]
|
230
|
-
#
|
231
|
-
def version_manifest
|
232
|
-
@options[:version_manifest] || ''
|
233
|
-
end
|
234
|
-
|
235
259
|
#
|
236
260
|
# The path where the package will live inside of the Artifactory repository.
|
237
261
|
# This is dynamically computed from the values in the project definition
|
@@ -30,7 +30,7 @@ module Omnibus
|
|
30
30
|
|
31
31
|
# Upload the metadata first
|
32
32
|
log.debug(log_key) { "Uploading '#{package.metadata.name}'" }
|
33
|
-
store_object(key_for(package, package.metadata.name), package.metadata.
|
33
|
+
store_object(key_for(package, package.metadata.name), FFI_Yajl::Encoder.encode(package.metadata.to_hash, pretty: true),
|
34
34
|
nil, access_policy)
|
35
35
|
|
36
36
|
# Upload the actual package
|
data/lib/omnibus/software.rb
CHANGED
@@ -1059,7 +1059,7 @@ module Omnibus
|
|
1059
1059
|
update_with_string(digest, builder.shasum)
|
1060
1060
|
update_with_string(digest, name)
|
1061
1061
|
update_with_string(digest, version_for_cache)
|
1062
|
-
update_with_string(digest,
|
1062
|
+
update_with_string(digest, FFI_Yajl::Encoder.encode(overrides))
|
1063
1063
|
|
1064
1064
|
if filepath && File.exist?(filepath)
|
1065
1065
|
update_with_file_contents(digest, filepath)
|
data/lib/omnibus/version.rb
CHANGED
data/omnibus.gemspec
CHANGED
@@ -32,12 +32,14 @@ Gem::Specification.new do |gem|
|
|
32
32
|
gem.add_dependency 'ruby-progressbar', '~> 1.7'
|
33
33
|
gem.add_dependency 'aws-sdk', '~> 2'
|
34
34
|
gem.add_dependency 'thor', '~> 0.18'
|
35
|
+
gem.add_dependency "ffi-yajl", '~> 2.2'
|
35
36
|
|
36
37
|
gem.add_development_dependency 'bundler'
|
37
38
|
gem.add_development_dependency 'artifactory', '~> 2.0'
|
38
39
|
gem.add_development_dependency 'aruba', '~> 0.5'
|
39
40
|
gem.add_development_dependency 'fauxhai', '~> 3.2'
|
40
41
|
gem.add_development_dependency 'rspec', '~> 3.0'
|
42
|
+
gem.add_development_dependency 'rspec-json_expectations'
|
41
43
|
gem.add_development_dependency 'rspec-its'
|
42
44
|
gem.add_development_dependency 'webmock'
|
43
45
|
gem.add_development_dependency 'rake'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
set name=pkg.fmri value=developer/versioning/<%= fmri_package_name %>
|
2
|
+
set name=pkg.description value="<%= description %>"
|
3
|
+
set name=pkg.summary value="<%= summary %>"
|
4
|
+
set name=variant.arch value=<%= arch %>
|
5
|
+
set name=info.classification \
|
6
|
+
value="org.opensolaris.category.2008:Meta Packages/Group Packages" \
|
7
|
+
value="org.opensolaris.category.2008:Applications/System Utilities"
|
data/spec/spec_helper.rb
CHANGED
data/spec/unit/manifest_spec.rb
CHANGED
@@ -21,7 +21,7 @@ module Omnibus
|
|
21
21
|
it "returns a ManifestEntry for the requested software" do
|
22
22
|
me = ManifestEntry.new("foobar", {})
|
23
23
|
subject.add("foobar", me)
|
24
|
-
expect(subject.entry_for(
|
24
|
+
expect(subject.entry_for(:foobar)).to eq(me)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "raises an error if no such manifest entry exists" do
|
@@ -45,55 +45,54 @@ module Omnibus
|
|
45
45
|
second = ManifestEntry.new("wombat", {})
|
46
46
|
subject.add("foobar", first)
|
47
47
|
subject.add("wombat", second)
|
48
|
-
expect(subject.entry_names).to eq([
|
48
|
+
expect(subject.entry_names).to eq([:foobar, :wombat])
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "#to_hash" do
|
53
53
|
it "returns a Hash containg the current manifest format" do
|
54
|
-
expect(subject.to_hash[
|
54
|
+
expect(subject.to_hash[:manifest_format]).to eq(Manifest::LATEST_MANIFEST_FORMAT)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "includes entries for software in the manifest" do
|
58
58
|
subject.add("foobar", ManifestEntry.new("foobar", {}))
|
59
|
-
expect(subject.to_hash[
|
59
|
+
expect(subject.to_hash[:software]).to have_key(:foobar)
|
60
60
|
end
|
61
61
|
|
62
62
|
it "converts the manifest entries to hashes" do
|
63
63
|
subject.add("foobar", ManifestEntry.new("foobar", {}))
|
64
|
-
expect(subject.to_hash[
|
64
|
+
expect(subject.to_hash[:software][:foobar]).to be_a(Hash)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "returns a build_version if one was passed in" do
|
68
|
-
expect(Omnibus::Manifest.new("1.2.3").to_hash[
|
68
|
+
expect(Omnibus::Manifest.new("1.2.3").to_hash[:build_version]).to eq("1.2.3")
|
69
69
|
end
|
70
70
|
|
71
71
|
it "returns a build_git_revision if one was passed in" do
|
72
|
-
expect(Omnibus::Manifest.new("1.2.3", "e8e8e8").to_hash[
|
72
|
+
expect(Omnibus::Manifest.new("1.2.3", "e8e8e8").to_hash[:build_git_revision]).to eq("e8e8e8")
|
73
73
|
end
|
74
74
|
|
75
75
|
it "returns a license if one was passed in" do
|
76
|
-
expect(Omnibus::Manifest.new("1.2.3", "e8e8e8", "Apache").to_hash[
|
76
|
+
expect(Omnibus::Manifest.new("1.2.3", "e8e8e8", "Apache").to_hash[:license]).to eq("Apache")
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "#from_hash" do
|
81
81
|
let(:manifest) {
|
82
|
-
{
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
{ manifest_format: 1,
|
83
|
+
build_version: "12.4.0+20150629082811",
|
84
|
+
build_git_revision: "2e763ac957b308ba95cef256c2491a5a55a163cc",
|
85
|
+
software: {
|
86
|
+
zlib: {
|
87
|
+
locked_source: {
|
88
|
+
url: "an_url",
|
89
89
|
},
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
{"manifest_format" => 2}
|
90
|
+
locked_version: "new.newer",
|
91
|
+
source_type: "url",
|
92
|
+
described_version: "new.newer",
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
97
96
|
}
|
98
97
|
|
99
98
|
it "has a build_version" do
|
@@ -109,11 +108,44 @@ module Omnibus
|
|
109
108
|
end
|
110
109
|
|
111
110
|
it "normalizes the source to use symbols" do
|
112
|
-
expect(Manifest.from_hash(manifest).entry_for(
|
113
|
-
end
|
114
|
-
|
115
|
-
|
116
|
-
|
111
|
+
expect(Manifest.from_hash(manifest).entry_for(:zlib).locked_source).to eq({url: "an_url"})
|
112
|
+
end
|
113
|
+
|
114
|
+
context "v2 manifest" do
|
115
|
+
let(:manifest) {
|
116
|
+
{ manifest_format: 2,
|
117
|
+
build_version: "12.4.0+20150629082811",
|
118
|
+
build_git_revision: "2e763ac957b308ba95cef256c2491a5a55a163cc",
|
119
|
+
license: "Unspecified",
|
120
|
+
software: {
|
121
|
+
zlib: {
|
122
|
+
locked_source: {
|
123
|
+
url: "an_url"
|
124
|
+
},
|
125
|
+
locked_version: "new.newer",
|
126
|
+
source_type: "url",
|
127
|
+
described_version: "new.newer",
|
128
|
+
license: "Zlib",
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
it "has a license" do
|
135
|
+
expect(Manifest.from_hash(manifest).license).to eq('Unspecified')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "unsupported manifest" do
|
140
|
+
let(:manifest) {
|
141
|
+
{
|
142
|
+
manifest_format: 99,
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
it "raises an error if it doesn't recognize the manifest version" do
|
147
|
+
expect{Manifest.from_hash(manifest)}.to raise_error Manifest::InvalidManifestFormat
|
148
|
+
end
|
117
149
|
end
|
118
150
|
end
|
119
151
|
end
|
data/spec/unit/metadata_spec.rb
CHANGED
@@ -6,10 +6,13 @@ module Omnibus
|
|
6
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' }
|
11
|
+
|
9
12
|
let(:package) do
|
10
13
|
double(Package,
|
11
14
|
name: 'package',
|
12
|
-
path:
|
15
|
+
path: package_path,
|
13
16
|
md5: 'abc123',
|
14
17
|
sha1: 'abc123',
|
15
18
|
sha256: 'abcd1234',
|
@@ -17,10 +20,112 @@ module Omnibus
|
|
17
20
|
)
|
18
21
|
end
|
19
22
|
|
23
|
+
let(:project) do
|
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',
|
31
|
+
built_manifest: double(Manifest,
|
32
|
+
to_hash: {
|
33
|
+
manifest_format: 2,
|
34
|
+
build_version: '1.2.3',
|
35
|
+
build_git_revision: 'SHA',
|
36
|
+
license: 'Apache-2.0'
|
37
|
+
}
|
38
|
+
),
|
39
|
+
license_file_path: license_path,
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
20
43
|
let(:data) { { foo: 'bar' } }
|
44
|
+
let(:license_file_content) do
|
45
|
+
<<-EOH
|
46
|
+
some_project 1.2.3 license: "Apache-2.0"
|
47
|
+
|
48
|
+
Apache License
|
49
|
+
Version 2.0, January 2004
|
50
|
+
http://www.apache.org/licenses/
|
51
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
52
|
+
|
53
|
+
1. Definitions.
|
54
|
+
|
55
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
56
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
57
|
+
|
58
|
+
...
|
59
|
+
EOH
|
60
|
+
end
|
21
61
|
|
22
62
|
subject { described_class.new(package, data) }
|
23
63
|
|
64
|
+
describe '.generate' do
|
65
|
+
let(:metadata_json_content) { StringIO.new }
|
66
|
+
let(:package_path) { '/path/to/package.deb' }
|
67
|
+
|
68
|
+
before do
|
69
|
+
allow(File).to receive(:exist?).with(package_path).and_return(true)
|
70
|
+
allow(Package).to receive(:new).with(package_path).and_return(package)
|
71
|
+
allow(File).to receive(:exist?).with(license_path).and_return(true)
|
72
|
+
allow(File).to receive(:read).with(license_path).and_return(license_file_content)
|
73
|
+
# mock out `Metadata#save`
|
74
|
+
allow(File).to receive(:open).with("#{package_path}.metadata.json", 'w+').and_yield(metadata_json_content)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'creates a *.metadata.json file with the correct content' do
|
78
|
+
|
79
|
+
described_class.generate(package_path, project)
|
80
|
+
|
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',
|
95
|
+
version_manifest: {
|
96
|
+
manifest_format: 2,
|
97
|
+
build_version: '1.2.3',
|
98
|
+
build_git_revision: 'SHA',
|
99
|
+
license: 'Apache-2.0',
|
100
|
+
},
|
101
|
+
license_content: license_file_content,
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'the package file does not exist' do
|
106
|
+
before do
|
107
|
+
allow(File).to receive(:exist?).with(package_path).and_return(false)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'raises an exception' do
|
111
|
+
expect { described_class.generate(package_path, project) }.to raise_error(Omnibus::NoPackageFile)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'the license file does not exist' do
|
116
|
+
before do
|
117
|
+
allow(File).to receive(:exist?).with(license_path).and_return(false)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'does not include the license content' do
|
121
|
+
described_class.generate(package_path, project)
|
122
|
+
expect(metadata_json_content.string).to include_json(
|
123
|
+
license_content: '',
|
124
|
+
)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
24
129
|
describe '.arch' do
|
25
130
|
let(:architecture) { 'x86_64' }
|
26
131
|
|
@@ -250,7 +355,7 @@ module Omnibus
|
|
250
355
|
|
251
356
|
describe '#to_json' do
|
252
357
|
it 'generates pretty JSON' do
|
253
|
-
expect(subject.to_json).to eq <<-EOH.gsub(/^ {10}/, '').strip
|
358
|
+
expect(subject.to_json.strip).to eq <<-EOH.gsub(/^ {10}/, '').strip
|
254
359
|
{
|
255
360
|
"foo": "bar"
|
256
361
|
}
|