serverspec 0.14.4 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0aa6233f171389a2eb290151b5e8e788f58def0
4
- data.tar.gz: 747b9ef75c761e72c0cf5640bb6be9976f7879e2
3
+ metadata.gz: 3cc50787ae240d064c0e341a21d4cf65c2b2b3e4
4
+ data.tar.gz: c32f7dcc3513b788bc938f192626d950420aad4b
5
5
  SHA512:
6
- metadata.gz: 70c31af75bc88fae10615394c152ac5ca1e353cab34dd3a2026dbfbc704409437184280f48b0d1bb0fa2211372988321de385cd729707b6759b87f475149a34d
7
- data.tar.gz: 7ab52436a7093e421177bf3986a4f783a558d1657bcdbcf9d07c440e927179e02ab02117c617e89ca4b22252c0667bd52b6e13390c4c3e92cc363cf813ae39a7
6
+ metadata.gz: 26aa8da0bf28a3cbc26b7bf1a9ca727649d6c40e8d460fbd0e1538ed827cbc067c3b0e444d5a71093ef0f5b40d92272251c9b1a76868803928e4708b5f658c21
7
+ data.tar.gz: f3505fc995a4856f1ef838cac007c2668d3b960f00e17fb07d3df2a5ebdac3d5c5748efc76a48f2e441bd271272c53c57efc894320b5399fed98fbac4765a1e2
@@ -9,7 +9,7 @@ module Serverspec
9
9
  else
10
10
  param = "#{@subsystem}.#{meth.to_s}"
11
11
  ret = backend.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'")
12
- val = ret[:stdout].strip
12
+ val = ret.stdout.strip
13
13
  val = val.to_i if val.match(/^\d+$/)
14
14
  val
15
15
  end
@@ -6,9 +6,9 @@ module Serverspec
6
6
  def return_stdout?(content)
7
7
  ret = backend.run_command(@name)
8
8
  if content.instance_of?(Regexp)
9
- ret[:stdout] =~ content
9
+ ret.stdout =~ content
10
10
  else
11
- ret[:stdout].strip == content
11
+ ret.stdout.strip == content
12
12
  end
13
13
  end
14
14
 
@@ -18,20 +18,20 @@ module Serverspec
18
18
  # See http://stackoverflow.com/questions/7937651/receiving-extended-data-with-ssh-using-twisted-conch-as-client
19
19
  # So I use stdout instead of stderr
20
20
  if content.instance_of?(Regexp)
21
- ret[:stdout] =~ content
21
+ ret.stdout =~ content
22
22
  else
23
- ret[:stdout].strip == content
23
+ ret.stdout.strip == content
24
24
  end
25
25
  end
26
26
 
27
27
  def return_exit_status?(status)
28
28
  ret = backend.run_command(@name)
29
- ret[:exit_status].to_i == status
29
+ ret.exit_status.to_i == status
30
30
  end
31
31
 
32
32
  def stdout
33
33
  if @result.nil?
34
- @result = backend.run_command(@name)[:stdout]
34
+ @result = backend.run_command(@name).stdout
35
35
  end
36
36
  @result
37
37
  end
@@ -3,13 +3,13 @@ module Serverspec
3
3
  class DefaultGateway < Base
4
4
  def ipaddress
5
5
  ret = backend.run_command(commands.check_routing_table('default'))
6
- ret[:stdout] =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
6
+ ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
7
7
  $2 ? $2 : $4
8
8
  end
9
9
 
10
10
  def interface
11
11
  ret = backend.run_command(commands.check_routing_table('default'))
12
- ret[:stdout] =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
12
+ ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
13
13
  $3
14
14
  end
15
15
 
@@ -77,7 +77,7 @@ module Serverspec
77
77
 
78
78
  def content
79
79
  if @content.nil?
80
- @content = backend.run_command(commands.get_file_content(@name))[:stdout]
80
+ @content = backend.run_command(commands.get_file_content(@name)).stdout
81
81
  end
82
82
  @content
83
83
  end
@@ -3,7 +3,7 @@ module Serverspec
3
3
  class Interface < Base
4
4
  def speed
5
5
  ret = backend.run_command(commands.get_interface_speed_of(@name))
6
- val = ret[:stdout].strip
6
+ val = ret.stdout.strip
7
7
  val = val.to_i if val.match(/^\d+$/)
8
8
  val
9
9
  end
@@ -3,7 +3,7 @@ module Serverspec
3
3
  class LinuxKernelParameter < Base
4
4
  def value
5
5
  ret = backend.run_command("/sbin/sysctl -q -n #{@name}")
6
- val = ret[:stdout].strip
6
+ val = ret.stdout.strip
7
7
  val = val.to_i if val.match(/^\d+$/)
8
8
  val
9
9
  end
@@ -16,7 +16,7 @@ module Serverspec
16
16
  end
17
17
 
18
18
  def version
19
- ret = backend.run_command(commands.get_package_version(@name))[:stdout].strip
19
+ ret = backend.run_command(commands.get_package_version(@name)).stdout.strip
20
20
  if ret.empty?
21
21
  nil
22
22
  else
@@ -3,7 +3,7 @@ module Serverspec
3
3
  class PhpConfig < Base
4
4
  def value
5
5
  ret = backend.run_command("php -r 'echo get_cfg_var( \"#{@name}\" );'")
6
- val = ret[:stdout]
6
+ val = ret.stdout
7
7
  val = val.to_i if val.match(/^\d+$/)
8
8
  val
9
9
  end
@@ -3,7 +3,7 @@ module Serverspec
3
3
  class Process < Base
4
4
 
5
5
  def running?
6
- pid = backend.run_command(commands.get_process(@name, :format => "pid="))[:stdout]
6
+ pid = backend.run_command(commands.get_process(@name, :format => "pid=")).stdout
7
7
  not pid.empty?
8
8
  end
9
9
 
@@ -21,7 +21,7 @@ module Serverspec
21
21
 
22
22
  def get_column(keyword)
23
23
  ret = backend.run_command(commands.get_process(@name, :format => "#{keyword}="))
24
- val = ret[:stdout].strip
24
+ val = ret.stdout.strip
25
25
  val = val.to_i if val.match(/^\d+$/)
26
26
  val
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.14.4"
2
+ VERSION = "0.15.0"
3
3
  end
data/serverspec.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "net-ssh"
22
22
  spec.add_runtime_dependency "rspec", ">= 2.13.0"
23
23
  spec.add_runtime_dependency "highline"
24
- spec.add_runtime_dependency "specinfra", ">= 0.1.0"
24
+ spec.add_runtime_dependency "specinfra", ">= 0.5.0"
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
27
  end
data/spec/spec_helper.rb CHANGED
@@ -17,21 +17,13 @@ module SpecInfra
17
17
  @example.metadata[:subject].set_command(cmd)
18
18
  end
19
19
 
20
- if cmd =~ /invalid/
21
- {
22
- :stdout => ::SpecInfra.configuration.stdout,
23
- :stderr => ::SpecInfra.configuration.stderr,
24
- :exit_status => 1,
25
- :exit_signal => nil
26
- }
27
- else
28
- {
29
- :stdout => ::SpecInfra.configuration.stdout,
30
- :stderr => ::SpecInfra.configuration.stderr,
31
- :exit_status => 0,
32
- :exit_signal => nil
33
- }
34
- end
20
+ CommandResult.new({
21
+ :stdout => ::SpecInfra.configuration.stdout,
22
+ :stderr => ::SpecInfra.configuration.stderr,
23
+ :exit_status => cmd =~ /invalid/ ? 1 : 0,
24
+ :exit_signal => nil,
25
+ })
26
+
35
27
  end
36
28
  end
37
29
  [Exec, Ssh, Cmd, WinRM].each do |clz|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.4
4
+ version: 0.15.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-01-22 00:00:00.000000000 Z
11
+ date: 2014-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.0
61
+ version: 0.5.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.0
68
+ version: 0.5.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement