omnibus-sonian 1.2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +96 -0
- data/Gemfile +9 -0
- data/LICENSE +201 -0
- data/NOTICE +9 -0
- data/README.md +195 -0
- data/Rakefile +7 -0
- data/bin/makeself-header.sh +401 -0
- data/bin/makeself.sh +407 -0
- data/bin/omnibus +11 -0
- data/lib/omnibus.rb +304 -0
- data/lib/omnibus/artifact.rb +151 -0
- data/lib/omnibus/build_version.rb +285 -0
- data/lib/omnibus/builder.rb +328 -0
- data/lib/omnibus/clean_tasks.rb +30 -0
- data/lib/omnibus/cli.rb +35 -0
- data/lib/omnibus/cli/application.rb +140 -0
- data/lib/omnibus/cli/base.rb +118 -0
- data/lib/omnibus/cli/build.rb +62 -0
- data/lib/omnibus/cli/cache.rb +60 -0
- data/lib/omnibus/cli/release.rb +49 -0
- data/lib/omnibus/config.rb +224 -0
- data/lib/omnibus/exceptions.rb +143 -0
- data/lib/omnibus/fetcher.rb +184 -0
- data/lib/omnibus/fetchers.rb +22 -0
- data/lib/omnibus/fetchers/git_fetcher.rb +212 -0
- data/lib/omnibus/fetchers/net_fetcher.rb +193 -0
- data/lib/omnibus/fetchers/path_fetcher.rb +65 -0
- data/lib/omnibus/fetchers/s3_cache_fetcher.rb +42 -0
- data/lib/omnibus/health_check.rb +356 -0
- data/lib/omnibus/library.rb +62 -0
- data/lib/omnibus/overrides.rb +69 -0
- data/lib/omnibus/package_release.rb +163 -0
- data/lib/omnibus/project.rb +715 -0
- data/lib/omnibus/reports.rb +99 -0
- data/lib/omnibus/s3_cacher.rb +138 -0
- data/lib/omnibus/software.rb +441 -0
- data/lib/omnibus/templates/Berksfile.erb +3 -0
- data/lib/omnibus/templates/Gemfile.erb +4 -0
- data/lib/omnibus/templates/README.md.erb +102 -0
- data/lib/omnibus/templates/Vagrantfile.erb +95 -0
- data/lib/omnibus/templates/gitignore.erb +8 -0
- data/lib/omnibus/templates/omnibus.rb.example.erb +5 -0
- data/lib/omnibus/templates/package_scripts/makeselfinst.erb +27 -0
- data/lib/omnibus/templates/package_scripts/postinst.erb +17 -0
- data/lib/omnibus/templates/package_scripts/postrm.erb +9 -0
- data/lib/omnibus/templates/project.rb.erb +21 -0
- data/lib/omnibus/templates/software/c-example.rb.erb +42 -0
- data/lib/omnibus/templates/software/erlang-example.rb.erb +38 -0
- data/lib/omnibus/templates/software/ruby-example.rb.erb +24 -0
- data/lib/omnibus/util.rb +61 -0
- data/lib/omnibus/version.rb +20 -0
- data/omnibus.gemspec +34 -0
- data/spec/artifact_spec.rb +106 -0
- data/spec/build_version_spec.rb +266 -0
- data/spec/data/overrides/bad_line.overrides +3 -0
- data/spec/data/overrides/good.overrides +5 -0
- data/spec/data/overrides/with_dupes.overrides +4 -0
- data/spec/data/software/erchef.rb +40 -0
- data/spec/fetchers/net_fetcher_spec.rb +16 -0
- data/spec/overrides_spec.rb +114 -0
- data/spec/package_release_spec.rb +197 -0
- data/spec/s3_cacher_spec.rb +47 -0
- data/spec/software_spec.rb +85 -0
- data/spec/spec_helper.rb +28 -0
- metadata +252 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
module Omnibus
|
19
|
+
VERSION = "1.2.0.1"
|
20
|
+
end
|
data/omnibus.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omnibus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "omnibus-sonian"
|
8
|
+
gem.version = Omnibus::VERSION
|
9
|
+
gem.license = "Apache 2.0"
|
10
|
+
gem.author = "Opscode"
|
11
|
+
gem.email = "info@opscode.com"
|
12
|
+
gem.description = "Omnibus helps you build self-installing, full-stack software builds. Sonian build."
|
13
|
+
gem.summary = gem.description
|
14
|
+
gem.homepage = "https://github.com/opscode/omnibus-ruby"
|
15
|
+
|
16
|
+
gem.required_ruby_version = ">= 1.9.1"
|
17
|
+
|
18
|
+
gem.files = `git ls-files`.split($/)
|
19
|
+
gem.bindir = "bin"
|
20
|
+
gem.executables = %w(omnibus)
|
21
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
|
+
gem.require_paths = ["lib"]
|
23
|
+
|
24
|
+
gem.add_dependency "mixlib-shellout", "~> 1.0"
|
25
|
+
gem.add_dependency "mixlib-config", "~> 1.1.2"
|
26
|
+
gem.add_dependency "ohai", ">= 0.6.12"
|
27
|
+
gem.add_dependency "rake", ">= 0.9"
|
28
|
+
gem.add_dependency "fpm", "~> 0.4.33"
|
29
|
+
gem.add_dependency "uber-s3"
|
30
|
+
gem.add_dependency "thor", ">= 0.16.0"
|
31
|
+
|
32
|
+
gem.add_development_dependency "rspec"
|
33
|
+
gem.add_development_dependency "rspec_junit_formatter"
|
34
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'omnibus/artifact'
|
19
|
+
require 'spec_helper'
|
20
|
+
|
21
|
+
describe Omnibus::Artifact do
|
22
|
+
|
23
|
+
let(:path) { "build_os=centos-5,machine_architecture=x86,role=oss-builder/pkg/demoproject-11.4.0-1.el5.x86_64.rpm" }
|
24
|
+
|
25
|
+
let(:content) { StringIO.new("this is the package content\n") }
|
26
|
+
|
27
|
+
let(:md5) { "d41d8cd98f00b204e9800998ecf8427e" }
|
28
|
+
|
29
|
+
let(:sha256) { "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
|
30
|
+
|
31
|
+
let(:platforms) { [ [ "el", "5", "x86_64" ], [ "sles","11.2","x86_64" ] ] }
|
32
|
+
|
33
|
+
let(:artifact) { Omnibus::Artifact.new(path, platforms, { :version => "11.4.0-1" }) }
|
34
|
+
|
35
|
+
it "has the path to the package" do
|
36
|
+
artifact.path.should == path
|
37
|
+
end
|
38
|
+
|
39
|
+
it "has a list of platforms the package supports" do
|
40
|
+
artifact.platforms.should == platforms
|
41
|
+
end
|
42
|
+
|
43
|
+
it "generates a MD5 of an artifact" do
|
44
|
+
File.should_receive(:open).with(path).and_return(content)
|
45
|
+
artifact.md5.should == md5
|
46
|
+
end
|
47
|
+
|
48
|
+
it "generates a SHA256 of an artifact" do
|
49
|
+
File.should_receive(:open).with(path).and_return(content)
|
50
|
+
artifact.sha256.should == sha256
|
51
|
+
end
|
52
|
+
|
53
|
+
it "generates 'flat' metadata" do
|
54
|
+
File.should_receive(:open).twice.with(path).and_return(content)
|
55
|
+
flat_metadata = artifact.flat_metadata
|
56
|
+
flat_metadata["platform"].should == "el"
|
57
|
+
flat_metadata["platform_version"].should == "5"
|
58
|
+
flat_metadata["arch"].should == "x86_64"
|
59
|
+
flat_metadata["version"].should == "11.4.0-1"
|
60
|
+
flat_metadata["basename"].should == "demoproject-11.4.0-1.el5.x86_64.rpm"
|
61
|
+
flat_metadata["md5"].should == md5
|
62
|
+
flat_metadata["sha256"].should == sha256
|
63
|
+
end
|
64
|
+
|
65
|
+
it "adds the package to a release manifest" do
|
66
|
+
expected = {
|
67
|
+
"el" => {
|
68
|
+
"5" => { "x86_64" => { "11.4.0-1" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm" } }
|
69
|
+
},
|
70
|
+
"sles" => {
|
71
|
+
"11.2" => { "x86_64" => { "11.4.0-1" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm" } }
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
manifest = artifact.add_to_release_manifest!({})
|
76
|
+
manifest.should == expected
|
77
|
+
end
|
78
|
+
|
79
|
+
it "adds the package to a v2 release manifest" do
|
80
|
+
File.should_receive(:open).with(path).twice.and_return(content)
|
81
|
+
expected = {
|
82
|
+
"el" => {
|
83
|
+
"5" => { "x86_64" => { "11.4.0-1" => {
|
84
|
+
"relpath" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm",
|
85
|
+
"md5" => md5,
|
86
|
+
"sha256" => sha256
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"sles" => {
|
92
|
+
"11.2" => { "x86_64" => { "11.4.0-1" => {
|
93
|
+
"relpath" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm",
|
94
|
+
"md5" => md5,
|
95
|
+
"sha256" => sha256
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
v2_manifest = artifact.add_to_v2_release_manifest!({})
|
102
|
+
v2_manifest.should == expected
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
@@ -0,0 +1,266 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'omnibus/build_version'
|
19
|
+
require 'spec_helper'
|
20
|
+
|
21
|
+
describe Omnibus::BuildVersion do
|
22
|
+
|
23
|
+
let(:git_describe){ "11.0.0-alpha1-207-g694b062" }
|
24
|
+
let(:valid_semver_regex){/^\d+\.\d+\.\d+(\-[\dA-Za-z\-\.]+)?(\+[\dA-Za-z\-\.]+)?$/}
|
25
|
+
let(:valid_git_describe_regex){/^\d+\.\d+\.\d+(\-[A-Za-z0-9\-\.]+)?(\-\d+\-g[0-9a-f]+)?$/}
|
26
|
+
|
27
|
+
subject(:build_version){ Omnibus::BuildVersion.new }
|
28
|
+
|
29
|
+
before :each do
|
30
|
+
ENV['BUILD_ID'] = nil
|
31
|
+
ENV['OMNIBUS_APPEND_TIMESTAMP'] = nil
|
32
|
+
Omnibus::BuildVersion.any_instance.stub(:shellout)
|
33
|
+
.and_return(mock("ouput",
|
34
|
+
:stdout => git_describe,
|
35
|
+
:exitstatus => 0))
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "git describe parsing" do
|
39
|
+
|
40
|
+
# we prefer our git tags to be SemVer compliant
|
41
|
+
|
42
|
+
# release version
|
43
|
+
context "11.0.1" do
|
44
|
+
let(:git_describe){ "11.0.1" }
|
45
|
+
its(:version_tag){ should == "11.0.1" }
|
46
|
+
its(:prerelease_tag){ should be_nil }
|
47
|
+
its(:git_sha_tag){ should be_nil }
|
48
|
+
its(:commits_since_tag){ should == 0 }
|
49
|
+
its(:development_version?){ should be_true }
|
50
|
+
its(:prerelease_version?){ should be_false }
|
51
|
+
end
|
52
|
+
|
53
|
+
# SemVer compliant prerelease version
|
54
|
+
context "11.0.0-alpha.2" do
|
55
|
+
let(:git_describe){ "11.0.0-alpha.2" }
|
56
|
+
its(:version_tag){ should == "11.0.0" }
|
57
|
+
its(:prerelease_tag){ should == "alpha.2" }
|
58
|
+
its(:git_sha_tag){ should be_nil }
|
59
|
+
its(:commits_since_tag){ should == 0 }
|
60
|
+
its(:development_version?){ should be_false }
|
61
|
+
its(:prerelease_version?){ should be_true }
|
62
|
+
end
|
63
|
+
|
64
|
+
# full git describe string
|
65
|
+
context "11.0.0-alpha.3-59-gf55b180" do
|
66
|
+
let(:git_describe){ "11.0.0-alpha.3-59-gf55b180" }
|
67
|
+
its(:version_tag){ should == "11.0.0" }
|
68
|
+
its(:prerelease_tag){ should == "alpha.3" }
|
69
|
+
its(:git_sha_tag){ should == "f55b180" }
|
70
|
+
its(:commits_since_tag){ should == 59 }
|
71
|
+
its(:development_version?){ should be_false }
|
72
|
+
its(:prerelease_version?){ should be_true }
|
73
|
+
end
|
74
|
+
|
75
|
+
# Degenerate git tag formats
|
76
|
+
|
77
|
+
# RubyGems compliant git tag
|
78
|
+
context "10.16.0.rc.0" do
|
79
|
+
let(:git_describe){ "10.16.0.rc.0" }
|
80
|
+
its(:version_tag){ should == "10.16.0" }
|
81
|
+
its(:prerelease_tag){ should == "rc.0" }
|
82
|
+
its(:git_sha_tag){ should be_nil }
|
83
|
+
its(:commits_since_tag){ should == 0 }
|
84
|
+
its(:development_version?){ should be_false }
|
85
|
+
its(:prerelease_version?){ should be_true }
|
86
|
+
end
|
87
|
+
|
88
|
+
# dash seperated prerelease
|
89
|
+
context "11.0.0-alpha-2" do
|
90
|
+
let(:git_describe){ "11.0.0-alpha-2" }
|
91
|
+
its(:version_tag){ should == "11.0.0" }
|
92
|
+
its(:prerelease_tag){ should == "alpha-2" }
|
93
|
+
its(:git_sha_tag){ should be_nil }
|
94
|
+
its(:commits_since_tag){ should == 0 }
|
95
|
+
its(:development_version?){ should be_false }
|
96
|
+
its(:prerelease_version?){ should be_true }
|
97
|
+
end
|
98
|
+
|
99
|
+
# dash seperated prerelease full git describe string
|
100
|
+
context "11.0.0-alpha-2-59-gf55b180" do
|
101
|
+
let(:git_describe){ "11.0.0-alpha-2-59-gf55b180" }
|
102
|
+
its(:version_tag){ should == "11.0.0" }
|
103
|
+
its(:prerelease_tag){ should == "alpha-2" }
|
104
|
+
its(:git_sha_tag){ should == "f55b180" }
|
105
|
+
its(:commits_since_tag){ should == 59 }
|
106
|
+
its(:development_version?){ should be_false }
|
107
|
+
its(:prerelease_version?){ should be_true }
|
108
|
+
end
|
109
|
+
|
110
|
+
# WTF git tag
|
111
|
+
context "11.0.0-alpha2" do
|
112
|
+
let(:git_describe){ "11.0.0-alpha2" }
|
113
|
+
its(:version_tag){ should == "11.0.0" }
|
114
|
+
its(:prerelease_tag){ should == "alpha2" }
|
115
|
+
its(:git_sha_tag){ should be_nil }
|
116
|
+
its(:commits_since_tag){ should == 0 }
|
117
|
+
its(:development_version?){ should be_false }
|
118
|
+
its(:prerelease_version?){ should be_true }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "semver output" do
|
123
|
+
let(:today_string){ Time.now.utc.strftime("%Y%m%d") }
|
124
|
+
|
125
|
+
it "generates a valid semver version" do
|
126
|
+
build_version.semver.should =~ valid_semver_regex
|
127
|
+
end
|
128
|
+
|
129
|
+
it "generates a version matching format 'MAJOR.MINOR.PATCH-PRERELEASE+TIMESTAMP.git.COMMITS_SINCE.GIT_SHA'" do
|
130
|
+
build_version.semver.should =~ /11.0.0-alpha1\+#{today_string}[0-9]+.git.207.694b062/
|
131
|
+
end
|
132
|
+
|
133
|
+
it "uses ENV['BUILD_ID'] to generate timestamp if set" do
|
134
|
+
ENV['BUILD_ID'] = "2012-12-25_16-41-40"
|
135
|
+
build_version.semver.should == "11.0.0-alpha1+20121225164140.git.207.694b062"
|
136
|
+
end
|
137
|
+
|
138
|
+
it "fails on invalid ENV['BUILD_ID'] values" do
|
139
|
+
ENV['BUILD_ID'] = "AAAA"
|
140
|
+
expect { build_version.semver }.to raise_error(ArgumentError)
|
141
|
+
end
|
142
|
+
|
143
|
+
context "prerelease version with dashes" do
|
144
|
+
let(:git_describe){ "11.0.0-alpha-3-207-g694b062" }
|
145
|
+
|
146
|
+
it "converts all dashes to dots" do
|
147
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "exact version" do
|
152
|
+
let(:git_describe){ "11.0.0-alpha2" }
|
153
|
+
|
154
|
+
it "appends a timestamp with no git info" do
|
155
|
+
build_version.semver.should =~ /11.0.0-alpha2\+#{today_string}[0-9]+/
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "appending a timestamp" do
|
160
|
+
let(:git_describe){ "11.0.0-alpha-3-207-g694b062" }
|
161
|
+
|
162
|
+
it "appends a timestamp by default" do
|
163
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/
|
164
|
+
end
|
165
|
+
|
166
|
+
describe "ENV['OMNIBUS_APPEND_TIMESTAMP'] is set" do
|
167
|
+
["true","t","yes","y",1].each do |truthy|
|
168
|
+
context "to #{truthy}" do
|
169
|
+
before { ENV['OMNIBUS_APPEND_TIMESTAMP'] = truthy.to_s }
|
170
|
+
it "appends a timestamp" do
|
171
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
["false","f","no","n",0].each do |falsey|
|
177
|
+
context "to #{falsey}" do
|
178
|
+
before { ENV['OMNIBUS_APPEND_TIMESTAMP'] = falsey.to_s }
|
179
|
+
it "does not append a timestamp" do
|
180
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+git.207.694b062/
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "Omnibus::Config.append_timestamp is set" do
|
187
|
+
context "is true" do
|
188
|
+
before { Omnibus::Config.append_timestamp(true) }
|
189
|
+
it "appends a timestamp" do
|
190
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
context "is false" do
|
195
|
+
before { Omnibus::Config.append_timestamp(false) }
|
196
|
+
it "does not append a timestamp" do
|
197
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+git.207.694b062/
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "both are set" do
|
203
|
+
before do
|
204
|
+
ENV['OMNIBUS_APPEND_TIMESTAMP'] = "false"
|
205
|
+
Omnibus::Config.append_timestamp(true)
|
206
|
+
end
|
207
|
+
it "prefers the value from ENV['OMNIBUS_APPEND_TIMESTAMP']" do
|
208
|
+
build_version.semver.should =~ /11.0.0-alpha.3\+git.207.694b062/
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe "git describe output" do
|
215
|
+
it "generates a valid git describe version" do
|
216
|
+
build_version.git_describe.should =~ valid_git_describe_regex
|
217
|
+
end
|
218
|
+
|
219
|
+
it "generates a version matching format 'MAJOR.MINOR.PATCH-PRELEASE.COMMITS_SINCE-gGIT_SHA'" do
|
220
|
+
build_version.git_describe.should == git_describe
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
describe "deprecated full output" do
|
225
|
+
it "generates a valid git describe version" do
|
226
|
+
Omnibus::BuildVersion.full.should =~ valid_git_describe_regex
|
227
|
+
end
|
228
|
+
|
229
|
+
it "outputs a deprecation message" do
|
230
|
+
Omnibus::BuildVersion.should_receive(:puts).with(/is deprecated/)
|
231
|
+
Omnibus::BuildVersion.full
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
describe "`git describe` command failure" do
|
236
|
+
before do
|
237
|
+
stderr =<<-STDERR
|
238
|
+
fatal: No tags can describe '809ea1afcce67e1148c1bf0822d40a7ef12c380e'.
|
239
|
+
Try --always, or create some tags.
|
240
|
+
STDERR
|
241
|
+
build_version.stub(:shellout)
|
242
|
+
.and_return(mock("ouput",
|
243
|
+
:stderr => stderr,
|
244
|
+
:exitstatus => 128))
|
245
|
+
end
|
246
|
+
it "sets the version to 0.0.0" do
|
247
|
+
build_version.git_describe.should eq("0.0.0")
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
describe "#initialize `path` parameter" do
|
252
|
+
let(:path) { "/some/fake/path" }
|
253
|
+
subject(:build_version){ Omnibus::BuildVersion.new(path) }
|
254
|
+
|
255
|
+
it "runs `git describe` at an alternate path" do
|
256
|
+
build_version.should_receive(:shellout)
|
257
|
+
.with("git describe",
|
258
|
+
{:live_stream => nil,
|
259
|
+
:cwd => path})
|
260
|
+
.and_return(mock("ouput",
|
261
|
+
:stdout => git_describe,
|
262
|
+
:exitstatus => 0))
|
263
|
+
build_version.git_describe
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|