omnibus 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +8 -5
- data/README.md +3 -1
- data/Rakefile +20 -13
- data/appveyor.yml +4 -3
- data/bin/omnibus +3 -3
- data/features/commands/manifest.feature +19 -5
- data/features/step_definitions/generator_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/lib/omnibus/build_version.rb +14 -14
- data/lib/omnibus/build_version_dsl.rb +3 -3
- data/lib/omnibus/builder.rb +50 -61
- data/lib/omnibus/changelog.rb +2 -2
- data/lib/omnibus/changelog_printer.rb +4 -4
- data/lib/omnibus/cleaner.rb +4 -4
- data/lib/omnibus/cli/base.rb +15 -15
- data/lib/omnibus/cli/cache.rb +13 -13
- data/lib/omnibus/cli/changelog.rb +8 -9
- data/lib/omnibus/cli/publish.rb +12 -13
- data/lib/omnibus/cli.rb +26 -27
- data/lib/omnibus/compressor.rb +6 -6
- data/lib/omnibus/compressors/base.rb +7 -2
- data/lib/omnibus/compressors/dmg.rb +12 -12
- data/lib/omnibus/compressors/null.rb +1 -1
- data/lib/omnibus/compressors/tgz.rb +8 -8
- data/lib/omnibus/config.rb +37 -26
- data/lib/omnibus/core_extensions/open_uri.rb +3 -3
- data/lib/omnibus/core_extensions.rb +1 -1
- data/lib/omnibus/digestable.rb +5 -4
- data/lib/omnibus/download_helpers.rb +7 -6
- data/lib/omnibus/exceptions.rb +29 -13
- data/lib/omnibus/fetcher.rb +0 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +3 -3
- data/lib/omnibus/generator.rb +60 -47
- data/lib/omnibus/git_cache.rb +33 -22
- data/lib/omnibus/git_repository.rb +5 -5
- data/lib/omnibus/health_check.rb +122 -119
- data/lib/omnibus/instrumentation.rb +1 -1
- data/lib/omnibus/licensing.rb +348 -60
- data/lib/omnibus/logger.rb +12 -9
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/manifest.rb +4 -4
- data/lib/omnibus/manifest_diff.rb +6 -7
- data/lib/omnibus/manifest_entry.rb +1 -1
- data/lib/omnibus/metadata.rb +36 -36
- data/lib/omnibus/ohai.rb +6 -7
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +37 -28
- data/lib/omnibus/packagers/appx.rb +86 -0
- data/lib/omnibus/packagers/base.rb +21 -18
- data/lib/omnibus/packagers/bff.rb +22 -24
- data/lib/omnibus/packagers/deb.rb +20 -20
- data/lib/omnibus/packagers/ips.rb +18 -17
- data/lib/omnibus/packagers/makeself.rb +7 -7
- data/lib/omnibus/packagers/msi.rb +38 -193
- data/lib/omnibus/packagers/pkg.rb +16 -16
- data/lib/omnibus/packagers/rpm.rb +53 -54
- data/lib/omnibus/packagers/solaris.rb +14 -14
- data/lib/omnibus/packagers/windows_base.rb +192 -0
- data/lib/omnibus/project.rb +45 -43
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
- data/lib/omnibus/publishers/s3_publisher.rb +7 -7
- data/lib/omnibus/reports.rb +10 -10
- data/lib/omnibus/s3_cache.rb +7 -7
- data/lib/omnibus/s3_helpers.rb +8 -7
- data/lib/omnibus/semantic_version.rb +1 -1
- data/lib/omnibus/software.rb +131 -81
- data/lib/omnibus/sugarable.rb +10 -10
- data/lib/omnibus/templating.rb +5 -5
- data/lib/omnibus/thread_pool.rb +1 -1
- data/lib/omnibus/util.rb +5 -5
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus.rb +65 -65
- data/omnibus.gemspec +34 -32
- data/resources/appx/AppxManifest.xml.erb +18 -0
- data/resources/appx/assets/clear.png +0 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
- data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
- data/spec/functional/builder_spec.rb +149 -150
- data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
- data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
- data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
- data/spec/functional/file_syncer_spec.rb +74 -74
- data/spec/functional/licensing_spec.rb +344 -35
- data/spec/functional/templating_spec.rb +17 -17
- data/spec/spec_helper.rb +20 -20
- data/spec/support/examples.rb +21 -15
- data/spec/support/file_helpers.rb +1 -1
- data/spec/support/git_helpers.rb +37 -37
- data/spec/support/matchers.rb +3 -3
- data/spec/support/ohai_helpers.rb +4 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/support/shell_helpers.rb +2 -2
- data/spec/unit/build_version_dsl_spec.rb +5 -5
- data/spec/unit/build_version_spec.rb +63 -63
- data/spec/unit/builder_spec.rb +86 -70
- data/spec/unit/changelog_spec.rb +4 -4
- data/spec/unit/changelogprinter_spec.rb +130 -0
- data/spec/unit/cleanroom_spec.rb +11 -11
- data/spec/unit/compressor_spec.rb +16 -16
- data/spec/unit/compressors/base_spec.rb +6 -6
- data/spec/unit/compressors/dmg_spec.rb +76 -76
- data/spec/unit/compressors/null_spec.rb +4 -4
- data/spec/unit/compressors/tgz_spec.rb +20 -20
- data/spec/unit/config_spec.rb +44 -43
- data/spec/unit/digestable_spec.rb +13 -13
- data/spec/unit/fetcher_spec.rb +11 -12
- data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
- data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
- data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
- data/spec/unit/generator_spec.rb +38 -38
- data/spec/unit/git_cache_spec.rb +56 -54
- data/spec/unit/git_repository_spec.rb +2 -2
- data/spec/unit/health_check_spec.rb +40 -40
- data/spec/unit/library_spec.rb +35 -35
- data/spec/unit/manifest_diff_spec.rb +10 -11
- data/spec/unit/manifest_spec.rb +17 -17
- data/spec/unit/metadata_spec.rb +152 -152
- data/spec/unit/ohai_spec.rb +5 -5
- data/spec/unit/omnibus_spec.rb +31 -31
- data/spec/unit/package_spec.rb +20 -20
- data/spec/unit/packager_spec.rb +48 -42
- data/spec/unit/packagers/appx_spec.rb +165 -0
- data/spec/unit/packagers/base_spec.rb +34 -34
- data/spec/unit/packagers/bff_spec.rb +60 -60
- data/spec/unit/packagers/deb_spec.rb +71 -71
- data/spec/unit/packagers/ips_spec.rb +45 -45
- data/spec/unit/packagers/makeself_spec.rb +22 -22
- data/spec/unit/packagers/msi_spec.rb +141 -147
- data/spec/unit/packagers/pkg_spec.rb +59 -60
- data/spec/unit/packagers/rpm_spec.rb +125 -126
- data/spec/unit/packagers/solaris_spec.rb +52 -52
- data/spec/unit/project_spec.rb +137 -135
- data/spec/unit/publisher_spec.rb +70 -70
- data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
- data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
- data/spec/unit/s3_cacher_spec.rb +34 -34
- data/spec/unit/s3_helpers_spec.rb +6 -6
- data/spec/unit/semantic_version_spec.rb +2 -2
- data/spec/unit/software_spec.rb +346 -384
- data/spec/unit/sugarable_spec.rb +10 -10
- data/spec/unit/util_spec.rb +60 -60
- metadata +54 -6
- data/.rubocop.yml +0 -48
data/spec/unit/project_spec.rb
CHANGED
@@ -1,131 +1,131 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "ohai"
|
3
3
|
|
4
4
|
module Omnibus
|
5
5
|
describe Project do
|
6
6
|
subject do
|
7
7
|
described_class.new.evaluate do
|
8
|
-
name
|
9
|
-
friendly_name
|
10
|
-
install_dir
|
11
|
-
maintainer
|
12
|
-
homepage
|
8
|
+
name "sample"
|
9
|
+
friendly_name "Sample Project"
|
10
|
+
install_dir "/sample"
|
11
|
+
maintainer "Sample Devs"
|
12
|
+
homepage "http://example.com/"
|
13
13
|
|
14
|
-
build_version
|
14
|
+
build_version "1.0"
|
15
15
|
build_iteration 1
|
16
16
|
|
17
|
-
extra_package_file
|
18
|
-
extra_package_file
|
17
|
+
extra_package_file "/path/to/sample_dir"
|
18
|
+
extra_package_file "/path/to/file.conf"
|
19
19
|
|
20
|
-
resources_path
|
20
|
+
resources_path "sample/project/resources"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it_behaves_like
|
25
|
-
it_behaves_like
|
26
|
-
it_behaves_like
|
27
|
-
it_behaves_like
|
28
|
-
it_behaves_like
|
29
|
-
it_behaves_like
|
30
|
-
it_behaves_like
|
31
|
-
it_behaves_like
|
32
|
-
it_behaves_like
|
33
|
-
it_behaves_like
|
34
|
-
it_behaves_like
|
35
|
-
it_behaves_like
|
36
|
-
it_behaves_like
|
37
|
-
it_behaves_like
|
38
|
-
it_behaves_like
|
39
|
-
it_behaves_like
|
40
|
-
it_behaves_like
|
41
|
-
it_behaves_like
|
42
|
-
it_behaves_like
|
43
|
-
it_behaves_like
|
44
|
-
it_behaves_like
|
45
|
-
it_behaves_like
|
46
|
-
it_behaves_like
|
47
|
-
it_behaves_like
|
48
|
-
it_behaves_like
|
49
|
-
it_behaves_like
|
50
|
-
it_behaves_like
|
24
|
+
it_behaves_like "a cleanroom setter", :name, %{name 'chef'}
|
25
|
+
it_behaves_like "a cleanroom setter", :friendly_name, %{friendly_name 'Chef'}
|
26
|
+
it_behaves_like "a cleanroom setter", :package_name, %{package_name 'chef.package'}
|
27
|
+
it_behaves_like "a cleanroom setter", :maintainer, %{maintainer 'Chef Software, Inc'}
|
28
|
+
it_behaves_like "a cleanroom setter", :homepage, %{homepage 'https://getchef.com'}
|
29
|
+
it_behaves_like "a cleanroom setter", :description, %{description 'Installs the thing'}
|
30
|
+
it_behaves_like "a cleanroom setter", :replace, %{replace 'old-chef'}
|
31
|
+
it_behaves_like "a cleanroom setter", :conflict, %{conflict 'puppet'}
|
32
|
+
it_behaves_like "a cleanroom setter", :build_version, %{build_version '1.2.3'}
|
33
|
+
it_behaves_like "a cleanroom setter", :build_iteration, %{build_iteration 1}
|
34
|
+
it_behaves_like "a cleanroom setter", :package_user, %{package_user 'chef'}
|
35
|
+
it_behaves_like "a cleanroom setter", :package_group, %{package_group 'chef'}
|
36
|
+
it_behaves_like "a cleanroom setter", :override, %{override :chefdk, source: 'foo.com'}
|
37
|
+
it_behaves_like "a cleanroom setter", :resources_path, %{resources_path '/path'}
|
38
|
+
it_behaves_like "a cleanroom setter", :package_scripts_path, %{package_scripts_path '/path/scripts'}
|
39
|
+
it_behaves_like "a cleanroom setter", :dependency, %{dependency 'libxslt-dev'}
|
40
|
+
it_behaves_like "a cleanroom setter", :runtime_dependency, %{runtime_dependency 'libxslt'}
|
41
|
+
it_behaves_like "a cleanroom setter", :exclude, %{exclude 'hamlet'}
|
42
|
+
it_behaves_like "a cleanroom setter", :config_file, %{config_file '/path/to/config.rb'}
|
43
|
+
it_behaves_like "a cleanroom setter", :extra_package_file, %{extra_package_file '/path/to/asset'}
|
44
|
+
it_behaves_like "a cleanroom setter", :text_manifest_path, %{text_manifest_path '/path/to/manifest.txt'}
|
45
|
+
it_behaves_like "a cleanroom setter", :json_manifest_path, %{json_manifest_path '/path/to/manifest.txt'}
|
46
|
+
it_behaves_like "a cleanroom setter", :build_git_revision, %{build_git_revision 'wombats'}
|
47
|
+
it_behaves_like "a cleanroom getter", :files_path
|
48
|
+
it_behaves_like "a cleanroom setter", :license, %{license 'Apache 2.0'}
|
49
|
+
it_behaves_like "a cleanroom setter", :license_file, %{license_file 'LICENSES/artistic.txt'}
|
50
|
+
it_behaves_like "a cleanroom setter", :license_file_path, %{license_file_path 'CHEF_LICENSE'}
|
51
51
|
|
52
|
-
describe
|
53
|
-
it
|
54
|
-
expect(subject.name).to eq(
|
52
|
+
describe "basics" do
|
53
|
+
it "returns a name" do
|
54
|
+
expect(subject.name).to eq("sample")
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
58
|
-
expect(subject.install_dir).to eq(
|
57
|
+
it "returns an install_dir" do
|
58
|
+
expect(subject.install_dir).to eq("/sample")
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
62
|
-
expect(subject.maintainer).to eq(
|
61
|
+
it "returns a maintainer" do
|
62
|
+
expect(subject.maintainer).to eq("Sample Devs")
|
63
63
|
end
|
64
64
|
|
65
|
-
it
|
66
|
-
expect(subject.homepage).to eq(
|
65
|
+
it "returns a homepage" do
|
66
|
+
expect(subject.homepage).to eq("http://example.com/")
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
70
|
-
expect(subject.build_version).to eq(
|
69
|
+
it "returns a build version" do
|
70
|
+
expect(subject.build_version).to eq("1.0")
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
73
|
+
it "returns a build iteration" do
|
74
74
|
expect(subject.build_iteration).to eq(1)
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
expect(subject.extra_package_files).to eq([
|
77
|
+
it "returns an array of files and dirs" do
|
78
|
+
expect(subject.extra_package_files).to eq(["/path/to/sample_dir", "/path/to/file.conf"])
|
79
79
|
end
|
80
80
|
|
81
|
-
it
|
82
|
-
expect(subject.friendly_name).to eq(
|
81
|
+
it "returns a friendly_name" do
|
82
|
+
expect(subject.friendly_name).to eq("Sample Project")
|
83
83
|
end
|
84
84
|
|
85
|
-
it
|
86
|
-
expect(subject.resources_path).to include(
|
85
|
+
it "returns a resources_path" do
|
86
|
+
expect(subject.resources_path).to include("sample/project/resources")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
describe '#install_dir' do
|
91
|
-
it
|
92
|
-
subject.install_dir(
|
93
|
-
expect(subject.install_dir).to eq(
|
91
|
+
it "removes duplicate slashes" do
|
92
|
+
subject.install_dir("///opt//chef")
|
93
|
+
expect(subject.install_dir).to eq("/opt/chef")
|
94
94
|
end
|
95
95
|
|
96
|
-
it
|
96
|
+
it "converts Windows slashes to Ruby ones" do
|
97
97
|
subject.install_dir('C:\\chef\\chefdk')
|
98
|
-
expect(subject.install_dir).to eq(
|
98
|
+
expect(subject.install_dir).to eq("C:/chef/chefdk")
|
99
99
|
end
|
100
100
|
|
101
|
-
it
|
102
|
-
subject.install_dir(
|
103
|
-
expect(subject.install_dir).to eq(
|
101
|
+
it "removes trailing slashes" do
|
102
|
+
subject.install_dir("/opt/chef//")
|
103
|
+
expect(subject.install_dir).to eq("/opt/chef")
|
104
104
|
end
|
105
105
|
|
106
|
-
it
|
106
|
+
it "is a DSL method" do
|
107
107
|
expect(subject).to have_exposed_method(:install_dir)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
describe '#default_root' do
|
112
|
-
context
|
113
|
-
before { stub_ohai(platform:
|
112
|
+
context "on Windows" do
|
113
|
+
before { stub_ohai(platform: "windows", version: "2012") }
|
114
114
|
|
115
|
-
it
|
116
|
-
expect(subject.default_root).to eq(
|
115
|
+
it "returns C:/" do
|
116
|
+
expect(subject.default_root).to eq("C:")
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
context
|
121
|
-
before { stub_ohai(platform:
|
120
|
+
context "on non-Windows" do
|
121
|
+
before { stub_ohai(platform: "ubuntu", version: "12.04") }
|
122
122
|
|
123
|
-
it
|
124
|
-
expect(subject.default_root).to eq(
|
123
|
+
it "returns /opt" do
|
124
|
+
expect(subject.default_root).to eq("/opt")
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
it
|
128
|
+
it "is a DSL method" do
|
129
129
|
expect(subject).to have_exposed_method(:default_root)
|
130
130
|
end
|
131
131
|
end
|
@@ -147,26 +147,26 @@ module Omnibus
|
|
147
147
|
|
148
148
|
describe '#license' do
|
149
149
|
it "sets the default to Unspecified" do
|
150
|
-
expect(subject.license).to eq (
|
150
|
+
expect(subject.license).to eq ("Unspecified")
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
describe '#license_file_path' do
|
155
155
|
it "sets the default to LICENSE" do
|
156
|
-
expect(subject.license_file_path).to eq (
|
156
|
+
expect(subject.license_file_path).to eq ("/sample/LICENSE")
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
160
|
describe '#dirty!' do
|
161
161
|
let(:software) { double(Omnibus::Software) }
|
162
162
|
|
163
|
-
it
|
163
|
+
it "dirties the cache" do
|
164
164
|
subject.instance_variable_set(:@culprit, nil)
|
165
165
|
subject.dirty!(software)
|
166
166
|
expect(subject).to be_dirty
|
167
167
|
end
|
168
168
|
|
169
|
-
it
|
169
|
+
it "sets the culprit" do
|
170
170
|
subject.instance_variable_set(:@culprit, nil)
|
171
171
|
subject.dirty!(software)
|
172
172
|
expect(subject.culprit).to be(software)
|
@@ -174,30 +174,30 @@ module Omnibus
|
|
174
174
|
end
|
175
175
|
|
176
176
|
describe '#dirty?' do
|
177
|
-
it
|
177
|
+
it "returns true by default" do
|
178
178
|
subject.instance_variable_set(:@culprit, nil)
|
179
179
|
expect(subject).to_not be_dirty
|
180
180
|
end
|
181
181
|
|
182
|
-
it
|
182
|
+
it "returns true when the cache is dirty" do
|
183
183
|
subject.instance_variable_set(:@culprit, true)
|
184
184
|
expect(subject).to be_dirty
|
185
185
|
end
|
186
186
|
|
187
|
-
it
|
187
|
+
it "returns false when the cache is not dirty" do
|
188
188
|
subject.instance_variable_set(:@culprit, false)
|
189
189
|
expect(subject).to_not be_dirty
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
193
193
|
describe '#<=>' do
|
194
|
-
let(:chefdk) { described_class.new.tap { |p| p.name(
|
195
|
-
let(:chef) { described_class.new.tap { |p| p.name(
|
196
|
-
let(:ruby) { described_class.new.tap { |p| p.name(
|
194
|
+
let(:chefdk) { described_class.new.tap { |p| p.name("chefdk") } }
|
195
|
+
let(:chef) { described_class.new.tap { |p| p.name("chef") } }
|
196
|
+
let(:ruby) { described_class.new.tap { |p| p.name("ruby") } }
|
197
197
|
|
198
|
-
it
|
198
|
+
it "compares projects by name" do
|
199
199
|
list = [chefdk, chef, ruby]
|
200
|
-
expect(list.sort.map(&:name)).to eq(%w
|
200
|
+
expect(list.sort.map(&:name)).to eq(%w{chef chefdk ruby})
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -206,38 +206,38 @@ module Omnibus
|
|
206
206
|
|
207
207
|
before { stub_ohai(fauxhai_options) }
|
208
208
|
|
209
|
-
context
|
210
|
-
let(:fauxhai_options) { { platform:
|
211
|
-
it
|
209
|
+
context "when on RHEL" do
|
210
|
+
let(:fauxhai_options) { { platform: "redhat", version: "6.4" } }
|
211
|
+
it "returns a RHEL iteration" do
|
212
212
|
expect(subject.build_iteration).to eq(1)
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
-
context
|
217
|
-
let(:fauxhai_options) { { platform:
|
218
|
-
it
|
216
|
+
context "when on Debian" do
|
217
|
+
let(:fauxhai_options) { { platform: "debian", version: "7.2" } }
|
218
|
+
it "returns a Debian iteration" do
|
219
219
|
expect(subject.build_iteration).to eq(1)
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
context
|
224
|
-
let(:fauxhai_options) { { platform:
|
225
|
-
it
|
223
|
+
context "when on FreeBSD" do
|
224
|
+
let(:fauxhai_options) { { platform: "freebsd", version: "9.1" } }
|
225
|
+
it "returns a FreeBSD iteration" do
|
226
226
|
expect(subject.build_iteration).to eq(1)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
-
context
|
231
|
-
before { stub_ohai(platform:
|
232
|
-
before { stub_const(
|
233
|
-
it
|
230
|
+
context "when on Windows" do
|
231
|
+
before { stub_ohai(platform: "windows", version: "2008R2") }
|
232
|
+
before { stub_const("File::ALT_SEPARATOR", '\\') }
|
233
|
+
it "returns a Windows iteration" do
|
234
234
|
expect(subject.build_iteration).to eq(1)
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
|
-
context
|
239
|
-
let(:fauxhai_options) { { platform:
|
240
|
-
it
|
238
|
+
context "when on OS X" do
|
239
|
+
let(:fauxhai_options) { { platform: "mac_os_x", version: "10.8.2" } }
|
240
|
+
it "returns a generic iteration" do
|
241
241
|
expect(subject.build_iteration).to eq(1)
|
242
242
|
end
|
243
243
|
end
|
@@ -247,61 +247,63 @@ module Omnibus
|
|
247
247
|
before { subject.overrides.clear }
|
248
248
|
|
249
249
|
it 'sets all the things through #overrides' do
|
250
|
-
subject.override(:thing, version:
|
250
|
+
subject.override(:thing, version: "6.6.6")
|
251
251
|
expect(subject.override(:zlib)).to be_nil
|
252
252
|
end
|
253
253
|
|
254
254
|
it 'retrieves the things set through #overrides' do
|
255
|
-
subject.override(:thing, version:
|
256
|
-
expect(subject.override(:thing)[:version]).to eq(
|
255
|
+
subject.override(:thing, version: "6.6.6")
|
256
|
+
expect(subject.override(:thing)[:version]).to eq("6.6.6")
|
257
257
|
end
|
258
258
|
|
259
259
|
it 'symbolizes #overrides' do
|
260
|
-
subject.override(
|
261
|
-
[:thing,
|
260
|
+
subject.override("thing", version: "6.6.6")
|
261
|
+
[:thing, "thing"].each do |thing|
|
262
262
|
expect(subject.override(thing)).not_to be_nil
|
263
263
|
end
|
264
|
-
expect(subject.override(:thing)[:version]).to eq(
|
264
|
+
expect(subject.override(:thing)[:version]).to eq("6.6.6")
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
268
268
|
describe '#ohai' do
|
269
|
-
before { stub_ohai(platform:
|
269
|
+
before { stub_ohai(platform: "ubuntu", version: "12.04") }
|
270
270
|
|
271
|
-
it
|
271
|
+
it "is a DSL method" do
|
272
272
|
expect(subject).to have_exposed_method(:ohai)
|
273
273
|
end
|
274
274
|
|
275
|
-
it
|
275
|
+
it "delegates to the Ohai class" do
|
276
276
|
expect(subject.ohai).to be(Ohai)
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
-
describe '#
|
281
|
-
it
|
282
|
-
|
280
|
+
describe '#packagers_for_system' do
|
281
|
+
it "returns array of packager objects" do
|
282
|
+
subject.packagers_for_system.each do |packager|
|
283
|
+
expect(packager).to be_a(Packager::Base)
|
284
|
+
end
|
283
285
|
end
|
284
286
|
|
285
287
|
it 'calls Packager#for_current_system' do
|
286
288
|
expect(Packager).to receive(:for_current_system)
|
287
289
|
.and_call_original
|
288
|
-
subject.
|
290
|
+
subject.packagers_for_system
|
289
291
|
end
|
290
292
|
end
|
291
293
|
|
292
294
|
describe '#package' do
|
293
|
-
it
|
295
|
+
it "raises an exception when a block is not given" do
|
294
296
|
expect { subject.package(:foo) }.to raise_error(InvalidValue)
|
295
297
|
end
|
296
298
|
|
297
|
-
it
|
299
|
+
it "adds the block to the list" do
|
298
300
|
block = Proc.new {}
|
299
301
|
subject.package(:foo, &block)
|
300
302
|
|
301
303
|
expect(subject.packagers[:foo]).to include(block)
|
302
304
|
end
|
303
305
|
|
304
|
-
it
|
306
|
+
it "allows for multiple invocations, keeping order" do
|
305
307
|
block_1, block_2 = Proc.new {}, Proc.new {}
|
306
308
|
subject.package(:foo, &block_1)
|
307
309
|
subject.package(:foo, &block_2)
|
@@ -311,18 +313,18 @@ module Omnibus
|
|
311
313
|
end
|
312
314
|
|
313
315
|
describe '#packagers' do
|
314
|
-
it
|
316
|
+
it "returns a Hash" do
|
315
317
|
expect(subject.packagers).to be_a(Hash)
|
316
318
|
end
|
317
319
|
|
318
|
-
it
|
320
|
+
it "has a default Hash value of an empty array" do
|
319
321
|
expect(subject.packagers[:foo]).to be_a(Array)
|
320
322
|
expect(subject.packagers[:bar]).to_not be(subject.packagers[:foo])
|
321
323
|
end
|
322
324
|
end
|
323
325
|
|
324
326
|
describe '#compressor' do
|
325
|
-
it
|
327
|
+
it "returns a compressor object" do
|
326
328
|
expect(subject.compressor).to be_a(Compressor::Base)
|
327
329
|
end
|
328
330
|
|
@@ -333,7 +335,7 @@ module Omnibus
|
|
333
335
|
subject.compressor
|
334
336
|
end
|
335
337
|
|
336
|
-
it
|
338
|
+
it "passes in the current compressors" do
|
337
339
|
subject.compress(:dmg)
|
338
340
|
subject.compress(:tgz)
|
339
341
|
|
@@ -346,23 +348,23 @@ module Omnibus
|
|
346
348
|
end
|
347
349
|
|
348
350
|
describe '#compress' do
|
349
|
-
it
|
351
|
+
it "does not raises an exception when a block is not given" do
|
350
352
|
expect { subject.compress(:foo) }.to_not raise_error
|
351
353
|
end
|
352
354
|
|
353
|
-
it
|
355
|
+
it "adds the compressor to the list" do
|
354
356
|
subject.compress(:foo)
|
355
357
|
expect(subject.compressors).to include(:foo)
|
356
358
|
end
|
357
359
|
|
358
|
-
it
|
360
|
+
it "adds the block to the list" do
|
359
361
|
block = Proc.new {}
|
360
362
|
subject.compress(:foo, &block)
|
361
363
|
|
362
364
|
expect(subject.compressors[:foo]).to include(block)
|
363
365
|
end
|
364
366
|
|
365
|
-
it
|
367
|
+
it "allows for multiple invocations, keeping order" do
|
366
368
|
block_1, block_2 = Proc.new {}, Proc.new {}
|
367
369
|
subject.compress(:foo, &block_1)
|
368
370
|
subject.compress(:foo, &block_2)
|
@@ -372,19 +374,19 @@ module Omnibus
|
|
372
374
|
end
|
373
375
|
|
374
376
|
describe '#compressors' do
|
375
|
-
it
|
377
|
+
it "returns a Hash" do
|
376
378
|
expect(subject.compressors).to be_a(Hash)
|
377
379
|
end
|
378
380
|
|
379
|
-
it
|
381
|
+
it "has a default Hash value of an empty array" do
|
380
382
|
expect(subject.compressors[:foo]).to be_a(Array)
|
381
383
|
expect(subject.compressors[:bar]).to_not be(subject.compressors[:foo])
|
382
384
|
end
|
383
385
|
end
|
384
386
|
|
385
387
|
describe '#shasum' do
|
386
|
-
context
|
387
|
-
let(:path) {
|
388
|
+
context "when a filepath is given" do
|
389
|
+
let(:path) { "/project.rb" }
|
388
390
|
let(:file) { double(File) }
|
389
391
|
|
390
392
|
before do
|
@@ -398,16 +400,16 @@ module Omnibus
|
|
398
400
|
.and_return(file)
|
399
401
|
end
|
400
402
|
|
401
|
-
it
|
402
|
-
expect(subject.shasum).to eq(
|
403
|
+
it "returns the correct shasum" do
|
404
|
+
expect(subject.shasum).to eq("2cb8bdd11c766caa11a37607e84ffb51af3ae3da16931988f12f7fc9de98d68e")
|
403
405
|
end
|
404
406
|
end
|
405
407
|
|
406
|
-
context
|
408
|
+
context "when a filepath is not given" do
|
407
409
|
before { subject.send(:remove_instance_variable, :@filepath) }
|
408
410
|
|
409
|
-
it
|
410
|
-
expect(subject.shasum).to eq(
|
411
|
+
it "returns the correct shasum" do
|
412
|
+
expect(subject.shasum).to eq("3cc6bd98da4d643b79c71be2c93761a458b442e2931f7d421636f526d0c1e8bf")
|
411
413
|
end
|
412
414
|
end
|
413
415
|
end
|