Class: Cult::Driver
Defined Under Namespace
Classes: GemNeededError
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#await_ssh, #backoff_loop, #connect_timeout, #distro_name, #fetch_mapped, included, #slugify, #ssh_key_info
Class Attribute Details
.required_gems ⇒ Object
Returns the value of attribute required_gems.
23
24
25
|
# File 'lib/cult/driver.rb', line 23
def required_gems
@required_gems
end
|
Class Method Details
.driver_name ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/cult/driver.rb', line 25
def driver_name
name.split('::')
.last
.sub(/Driver\z/, '')
.gsub(/([a-z])([A-Z])/, '\1-\2')
.downcase
end
|
.inspect ⇒ Object
34
35
36
|
# File 'lib/cult/driver.rb', line 34
def inspect
self == Driver ? super : "#{super}/#{driver_name}"
end
|
.named_array_identifier ⇒ Object
40
41
42
|
# File 'lib/cult/driver.rb', line 40
def named_array_identifier
driver_name
end
|
.new(*args) ⇒ Object
83
84
85
86
|
# File 'lib/cult/driver.rb', line 83
def self.new(*args)
try_requires!
super
end
|
.setup! ⇒ Object
78
79
80
|
# File 'lib/cult/driver.rb', line 78
def self.setup!
try_requires!
end
|
.to_s ⇒ Object
37
38
39
|
# File 'lib/cult/driver.rb', line 37
def inspect
self == Driver ? super : "#{super}/#{driver_name}"
end
|
.try_requires! ⇒ Object
Attempts to loads all of the required gems before doing any real work
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/cult/driver.rb', line 56
def self.try_requires!
req = Array(required_gems).map do |gem|
begin
require gem
nil
rescue LoadError
gem
end
end.compact
unless req.empty?
fail GemNeededError.new(req)
end
end
|
Instance Method Details
#inspect ⇒ Object
45
46
47
|
# File 'lib/cult/driver.rb', line 45
def inspect
"\#<#{self.class.name} \"#{self.class.driver_name}\">"
end
|
#to_s ⇒ Object
50
51
52
|
# File 'lib/cult/driver.rb', line 50
def to_s
self.class.driver_name
end
|