Module: Hitcher::Dsl
- Included in:
- Cli
- Defined in:
- lib/hitcher/dsl.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mtd, *args, &block) ⇒ Object
51
52
53
|
# File 'lib/hitcher/dsl.rb', line 51
def method_missing(mtd,*args,&block)
@inst.send(mtd,*args,&block)
end
|
Instance Method Details
#container(type) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/hitcher/dsl.rb', line 29
def container(type)
logger.debug "Container #{type}"
case type
when :docker
contDir = File.join(File.dirname(__FILE__),"providers",type.to_s)
logger.debug "Provider loaded from '#{contDir}'"
if File.exist?(contDir)
require_relative File.join(contDir,"dsl")
clsName = type.to_s.classify
@inst = eval("Hitcher::#{clsName}::#{clsName}Dsl.new")
else
raise Hitcher::Error, "Provider '#{type}' not found"
end
else
raise Hitcher::Error, "Unknown container type '#{type}'"
end
end
|
#logger ⇒ Object
9
10
11
|
# File 'lib/hitcher/dsl.rb', line 9
def logger
Hitcher::Global.instance.glog
end
|
#start(cont) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/hitcher/dsl.rb', line 13
def start(cont)
cont.each do |c|
c = c.strip
if not c =~ /^#/ and not c.empty?
eeval(c)
end
end
@inst
end
|