specinfra 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specinfra/backend/exec.rb +9 -4
- data/lib/specinfra/version.rb +1 -1
- data/spec/backend/exec/build_command_spec.rb +58 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5c2b978aecc51f4b3eeb4606557d80a3f78539d
|
4
|
+
data.tar.gz: 911aa8bac641318bcdee6fb1708c00ffb2e729b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b034ba312e05484ca2585d3312e6ed0a1e305120f634cc331630b67cd964f5b7791ac7c31e1cffe0f48ab100d8a51c3d2909b70d14733acb13bf851ddddf77b6
|
7
|
+
data.tar.gz: 50735443098590029652c18dce3b20e6ebb251acfd27320d9853bcfc8274d6ba0344d0bb507440c8af84a7625658028eee612b1774932d4355f0c12c1b369d50
|
@@ -196,19 +196,24 @@ module SpecInfra
|
|
196
196
|
end
|
197
197
|
{ :family => 'SuSE', :release => release }
|
198
198
|
elsif run_command('ls /etc/debian_version').success?
|
199
|
-
lsb_release = run_command("lsb_release -
|
199
|
+
lsb_release = run_command("lsb_release -ir")
|
200
200
|
if lsb_release.success?
|
201
|
-
|
201
|
+
if lsb_release.stdout =~ /:/
|
202
|
+
distro = lsb_release.stdout.split("\n").first.split(':').last
|
203
|
+
release = lsb_release.stdout.split("\n").last.split(':').last.strip
|
204
|
+
end
|
202
205
|
else
|
203
206
|
lsb_release = run_command("cat /etc/lsb-release")
|
204
207
|
if lsb_release.success?
|
205
208
|
lsb_release.stdout.each_line do |line|
|
206
|
-
distro =
|
209
|
+
distro = line.split('=').last if line =~ /^DISTRIB_ID=/
|
210
|
+
release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
|
207
211
|
end
|
208
212
|
end
|
209
213
|
end
|
210
214
|
distro ||= 'Debian'
|
211
|
-
|
215
|
+
release ||= nil
|
216
|
+
{ :family => distro.strip, :release => release }
|
212
217
|
elsif run_command('ls /etc/gentoo-release').success?
|
213
218
|
{ :family => 'Gentoo', :release => nil }
|
214
219
|
elsif run_command('ls /usr/lib/setup/Plamo-*').success?
|
data/lib/specinfra/version.rb
CHANGED
@@ -30,3 +30,61 @@ describe 'build command with path' do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
describe 'check_os' do
|
35
|
+
context 'test ubuntu with lsb_release command' do
|
36
|
+
subject { backend.check_os }
|
37
|
+
it do
|
38
|
+
mock_success_response = double(
|
39
|
+
:run_command_response,
|
40
|
+
:success? => true,
|
41
|
+
:stdout => "Distributor ID:\tUbuntu\nRelease:\t12.04\n"
|
42
|
+
)
|
43
|
+
mock_failure_response = double :run_command_response, :success? => false
|
44
|
+
backend.should_receive(:run_command).at_least(1).times do |args|
|
45
|
+
if ['ls /etc/debian_version', 'lsb_release -ir'].include? args
|
46
|
+
mock_success_response
|
47
|
+
else
|
48
|
+
mock_failure_response
|
49
|
+
end
|
50
|
+
end
|
51
|
+
should eq({:family => 'Ubuntu', :release => '12.04'})
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'test ubuntu with /etc/lsb-release' do
|
56
|
+
subject { backend.check_os }
|
57
|
+
it do
|
58
|
+
mock_success_response = double(
|
59
|
+
:run_command_response,
|
60
|
+
:success? => true,
|
61
|
+
:stdout => %Q(DISTRIB_ID=Ubuntu
|
62
|
+
DISTRIB_RELEASE=12.04
|
63
|
+
DISTRIB_CODENAME=precise
|
64
|
+
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
|
65
|
+
)
|
66
|
+
)
|
67
|
+
mock_failure_response = double :run_command_response, :success? => false
|
68
|
+
backend.should_receive(:run_command).at_least(1).times do |args|
|
69
|
+
if ['ls /etc/debian_version', 'cat /etc/lsb-release'].include? args
|
70
|
+
mock_success_response
|
71
|
+
else
|
72
|
+
mock_failure_response
|
73
|
+
end
|
74
|
+
end
|
75
|
+
should eq({:family => 'Ubuntu', :release => '12.04'})
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'test debian (no lsb_release or lsb-release)' do
|
80
|
+
subject { backend.check_os }
|
81
|
+
it do
|
82
|
+
mock_success_response = double :run_command_response, :success? => true
|
83
|
+
mock_failure_response = double :run_command_response, :success? => false
|
84
|
+
backend.should_receive(:run_command).at_least(1).times do |args|
|
85
|
+
args == 'ls /etc/debian_version' ? mock_success_response : mock_failure_response
|
86
|
+
end
|
87
|
+
should eq({:family => 'Debian', :release => nil})
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|