specinfra 2.0.0.beta12 → 2.0.0.beta13

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: 7e83660b824856312827345a04517188e064c1e6
4
- data.tar.gz: ecf35e4263f0b93b3a9db776bab43c0ebc207081
3
+ metadata.gz: 5c02ea87aab8e7f7ed23696adbe6f4c943179cd8
4
+ data.tar.gz: ec24615f39351a0e8b94b85196e3ea00becb2ae9
5
5
  SHA512:
6
- metadata.gz: eb2b8b616fa33bb47882acd858c0a0ac46db3f2b50209863ad639c3b0dc679d7ad8d885056d9b3791677646544774e2a10451af06b0fcaee2a9c16d4cfa5388e
7
- data.tar.gz: 60d9cb2c010eae33245ee8737267e012554bf538c6cf352ba5b5262701b017cf90681033d2b4a1071b0680804851b0722393227b9bd100612cf238222960a67a
6
+ metadata.gz: b5639ff7909fc512270dc42c47f609b67635367b8faa5917316729e40c1506a36922d91d17f26a63fa670bac6942e7a4239f9e0e68fa46f3d7cdb81da59ee0ff
7
+ data.tar.gz: abc23375ee803df39d37accd78cd054f229706dfb6aa8632ef2adeb2e8d0512627d88249fe85543d424b1e63a580c524d7e1437e2b458f7f057c049899b0554b
data/lib/specinfra.rb CHANGED
@@ -13,6 +13,10 @@ module Specinfra
13
13
  def configuration
14
14
  Specinfra::Configuration
15
15
  end
16
+
17
+ def commands
18
+ Specinfra::Command::Base.new
19
+ end
16
20
  end
17
21
  end
18
22
 
@@ -20,7 +20,7 @@ module Specinfra
20
20
  end
21
21
 
22
22
  def check_zero(cmd, *args)
23
- run_command(commands.send(cmd, *args)).success?
23
+ run_command(Specinfra.commands.send(cmd, *args)).success?
24
24
  end
25
25
 
26
26
  def method_missing(meth, *args, &block)
@@ -28,7 +28,7 @@ module Specinfra
28
28
  if meth.to_s =~ /^check/
29
29
  backend.check_zero(meth, *args)
30
30
  else
31
- backend.run_command(commands.send(meth, *args))
31
+ backend.run_command(Specinfra.commands.send(meth, *args))
32
32
  end
33
33
  else
34
34
  Specinfra::Command::Processor.send(meth, *args)
@@ -40,4 +40,3 @@ class Specinfra::Command::Base::Package < Specinfra::Command::Base
40
40
  cmd
41
41
  end
42
42
  end
43
-
@@ -2,4 +2,6 @@ class Specinfra::Command::Base::RoutingTable < Specinfra::Command::Base
2
2
  def check_has_entry(destination)
3
3
  "ip route | grep -E '^#{destination} |^default '"
4
4
  end
5
+
6
+ alias :get_entry :check_has_entry
5
7
  end
@@ -4,12 +4,12 @@ module Specinfra::Command
4
4
  if meth.to_s =~ /^check/
5
5
  backend.check_zero(meth, *args)
6
6
  else
7
- backend.run_command(commands.send(meth, *args))
7
+ backend.run_command(Specinfra.commands.send(meth, *args))
8
8
  end
9
9
  end
10
10
 
11
11
  def self.check_service_is_running(service)
12
- ret = backend.run_command(commands.check_service_is_running(service))
12
+ ret = backend.run_command(Specinfra.commands.check_service_is_running(service))
13
13
 
14
14
  # In Ubuntu, some services are under upstart and "service foo status" returns
15
15
  # exit status 0 even though they are stopped.
@@ -18,14 +18,14 @@ module Specinfra::Command
18
18
 
19
19
  # If the service is not registered, check by ps command
20
20
  if ret.exit_status == 1
21
- ret = backend.run_command(commands.check_process_is_running(service))
21
+ ret = backend.run_command(Specinfra.commands.check_process_is_running(service))
22
22
  end
23
23
 
24
24
  ret.success?
25
25
  end
26
26
 
27
27
  def self.check_service_is_monitored_by_monit(process)
28
- ret = backend.run_command(commands.check_service_is_monitored_by_monit(process))
28
+ ret = backend.run_command(Specinfra.commands.check_service_is_monitored_by_monit(process))
29
29
  return false unless ret.stdout != nil && ret.success?
30
30
 
31
31
  retlines = ret.stdout.split(/[\r\n]+/).map(&:strip)
@@ -36,7 +36,7 @@ module Specinfra::Command
36
36
  end
37
37
 
38
38
  def self.check_file_is_readable(file, by_whom)
39
- mode = sprintf('%04s',backend.run_command(commands.get_file_mode(file)).stdout.strip)
39
+ mode = sprintf('%04s',backend.run_command(Specinfra.commands.get_file_mode(file)).stdout.strip)
40
40
  mode = mode.split('')
41
41
  mode_octal = mode[0].to_i * 512 + mode[1].to_i * 64 + mode[2].to_i * 8 + mode[3].to_i * 1
42
42
  case by_whom
@@ -52,7 +52,7 @@ module Specinfra::Command
52
52
  end
53
53
 
54
54
  def self.check_file_is_writable(file, by_whom)
55
- mode = sprintf('%04s',backend.run_command(commands.get_file_mode(file)).stdout.strip)
55
+ mode = sprintf('%04s',backend.run_command(Specinfra.commands.get_file_mode(file)).stdout.strip)
56
56
  mode = mode.split('')
57
57
  mode_octal = mode[0].to_i * 512 + mode[1].to_i * 64 + mode[2].to_i * 8 + mode[3].to_i * 1
58
58
  case by_whom
@@ -68,7 +68,7 @@ module Specinfra::Command
68
68
  end
69
69
 
70
70
  def self.check_file_is_executable(file, by_whom)
71
- mode = sprintf('%04s',backend.run_command(commands.get_file_mode(file)).stdout.strip)
71
+ mode = sprintf('%04s',backend.run_command(Specinfra.commands.get_file_mode(file)).stdout.strip)
72
72
  mode = mode.split('')
73
73
  mode_octal = mode[0].to_i * 512 + mode[1].to_i * 64 + mode[2].to_i * 8 + mode[3].to_i * 1
74
74
  case by_whom
@@ -84,7 +84,7 @@ module Specinfra::Command
84
84
  end
85
85
 
86
86
  def self.check_file_is_mounted(path, expected_attr, only_with)
87
- ret = backend.run_command(commands.check_file_is_mounted(path))
87
+ ret = backend.run_command(Specinfra.commands.check_file_is_mounted(path))
88
88
  if expected_attr.nil? || ret.failure?
89
89
  return ret.success?
90
90
  end
@@ -118,7 +118,7 @@ module Specinfra::Command
118
118
 
119
119
  def self.check_routing_table_has_entry(expected_attr)
120
120
  return false if ! expected_attr[:destination]
121
- ret = backend.run_command(commands.check_routing_table_has_entry(expected_attr[:destination]))
121
+ ret = backend.get_routing_table_entry(expected_attr[:destination])
122
122
  return false if ret.failure?
123
123
 
124
124
  ret.stdout.gsub!(/\r\n/, "\n")
@@ -1,10 +1,6 @@
1
1
  require 'specinfra/helper/detect_os'
2
2
 
3
3
  module Specinfra::Helper::Os
4
- def commands
5
- Specinfra::Command::Base.new
6
- end
7
-
8
4
  def os
9
5
  property[:os_by_host] = {} if ! property[:os_by_host]
10
6
  host_port = current_host_and_port
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.0.0.beta12"
2
+ VERSION = "2.0.0.beta13"
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  set :os, { :family => nil }
4
4
 
5
- describe commands.check_file_is_directory('/tmp') do
5
+ describe Specinfra.commands.check_file_is_directory('/tmp') do
6
6
  after do
7
7
  property[:os_by_host] = nil
8
8
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  property[:os_by_host] = {}
4
4
  set :os, { :family => 'redhat', :release => 7 }
5
5
 
6
- describe commands.command_class('interface').create do
6
+ describe Specinfra.commands.command_class('interface').create do
7
7
  it { should be_an_instance_of(Specinfra::Command::Linux::Base::Interface) }
8
8
  end
9
9
 
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  property[:os_by_host] = {}
4
4
  set :os, { :family => 'redhat' }
5
5
 
6
- describe commands.check_package_is_installed('httpd') do
6
+ describe Specinfra.commands.check_package_is_installed('httpd') do
7
7
  after do
8
8
  property[:os_by_host] = nil
9
9
  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: 2.0.0.beta12
4
+ version: 2.0.0.beta13
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-07-29 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh