Class: Specinfra::Backend::Base
- Inherits:
-
Object
- Object
- Specinfra::Backend::Base
show all
- Defined in:
- lib/specinfra/backend/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config = {}) ⇒ Base
Returns a new instance of Base.
15
16
17
18
|
# File 'lib/specinfra/backend/base.rb', line 15
def initialize(config = {})
@config = config
@example = nil
end
|
Class Method Details
.clear ⇒ Object
11
12
13
|
# File 'lib/specinfra/backend/base.rb', line 11
def self.clear
@instance = nil
end
|
.instance ⇒ Object
7
8
9
|
# File 'lib/specinfra/backend/base.rb', line 7
def self.instance
@instance ||= self.new
end
|
Instance Method Details
#get_config(key) ⇒ Object
20
21
22
|
# File 'lib/specinfra/backend/base.rb', line 20
def get_config(key)
@config[key] || Specinfra.configuration.send(key)
end
|
#os_info ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/specinfra/backend/base.rb', line 28
def os_info
return @os_info if @os_info
Specinfra::Helper::DetectOs.subclasses.each do |klass|
if @os_info = klass.new(self).detect
@os_info[:arch] ||= self.run_command('uname -m').stdout.strip
return @os_info
end
end
raise NotImplementedError, 'OS detection failed.'
end
|
#set_config(key, value) ⇒ Object
24
25
26
|
# File 'lib/specinfra/backend/base.rb', line 24
def set_config(key, value)
@config[key] = value
end
|
#set_example(e) ⇒ Object
49
50
51
|
# File 'lib/specinfra/backend/base.rb', line 49
def set_example(e)
@example = e
end
|
#stderr_handler=(block) ⇒ Object
57
58
59
|
# File 'lib/specinfra/backend/base.rb', line 57
def stderr_handler=(block)
@stderr_handler = block
end
|
#stdout_handler=(block) ⇒ Object
53
54
55
|
# File 'lib/specinfra/backend/base.rb', line 53
def stdout_handler=(block)
@stdout_handler = block
end
|