Class: Serverspec::Type::Command
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::Command
show all
- Defined in:
- lib/serverspec/type/command.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #to_s
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
4
5
6
|
# File 'lib/serverspec/type/command.rb', line 4
def result
@result
end
|
Instance Method Details
#return_exit_status?(status) ⇒ Boolean
27
28
29
30
|
# File 'lib/serverspec/type/command.rb', line 27
def return_exit_status?(status)
ret = backend.run_command(@name)
ret[:exit_status].to_i == status
end
|
#return_stderr?(content) ⇒ Boolean
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/serverspec/type/command.rb', line 15
def return_stderr?(content)
ret = backend.run_command(@name)
if content.instance_of?(Regexp)
ret[:stdout] =~ content
else
ret[:stdout].strip == content
end
end
|
#return_stdout?(content) ⇒ Boolean
6
7
8
9
10
11
12
13
|
# File 'lib/serverspec/type/command.rb', line 6
def return_stdout?(content)
ret = backend.run_command(@name)
if content.instance_of?(Regexp)
ret[:stdout] =~ content
else
ret[:stdout].strip == content
end
end
|
#stdout ⇒ Object
Also known as:
stderr
32
33
34
35
36
37
|
# File 'lib/serverspec/type/command.rb', line 32
def stdout
if @result.nil?
@result = backend.run_command(@name)[:stdout]
end
@result
end
|