Class: MuSL::Maker::Scenario
- Inherits:
-
Object
- Object
- MuSL::Maker::Scenario
show all
- Includes:
- Mu::Helper
- Defined in:
- lib/mu/maker.rb
Constant Summary
Constants included
from Mu::Helper
Mu::Helper::ESCAPES
Instance Method Summary
collapse
Methods included from Mu::Helper
#ask, #bin2hex, #error, #escape, #format_float, #get_file_as_string_array, #make_xml, #msg, #shift, #to_boolean
Instance Method Details
#attrs(kvs = {}) ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/mu/maker.rb', line 90
def attrs kvs = {}
return '' if kvs.empty?
ary = []
kvs.each_pair do |key, val|
if ( (val.is_a? String) && (val.length === 0) )
val = '"' + escape(val.to_s) + '"'
elsif val.is_a? Symbol
val = escape(val.to_s)
else
val = escape(val.to_s)
end
ary << (key.to_s + ':' + val.to_s)
end
return '(' + ary.join(', ') + ')'
end
|
#block(start, finish, opts = {}) {|_self| ... } ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/mu/maker.rb', line 52
def block start, finish, opts={}
musl << indent(depth) + start + "\r\n"
@depth += 1
yield self
@depth -= 1
musl << indent(depth) + finish + "\r\n"
end
|
40
41
42
|
# File 'lib/mu/maker.rb', line 40
def text
line '# ' + text
end
|
#create(name) ⇒ Object
60
61
62
63
64
|
# File 'lib/mu/maker.rb', line 60
def create name block 'scenario(name: "' + name + '") {', '}' do
yield self
end
end
|
#depth ⇒ Object
24
25
26
|
# File 'lib/mu/maker.rb', line 24
def depth
@depth ||= 0
end
|
#globals ⇒ Object
78
79
80
81
82
|
# File 'lib/mu/maker.rb', line 78
def globals block 'variables {', '}' do
yield Globals.new(self)
end
end
|
#hosts ⇒ Object
66
67
68
69
70
|
# File 'lib/mu/maker.rb', line 66
def hosts block 'hosts {', '}' do
yield Hosts.new(self)
end
end
|
#indent(amount) ⇒ Object
32
33
34
|
# File 'lib/mu/maker.rb', line 32
def indent amount
" " * (4 * amount)
end
|
#line(text = '') ⇒ Object
36
37
38
|
# File 'lib/mu/maker.rb', line 36
def line text=''
musl << indent(depth) + text + "\r\n"
end
|
#literal(text) ⇒ Object
44
45
46
|
# File 'lib/mu/maker.rb', line 44
def literal text
musl << indent(depth) + text + "\r\n"
end
|
48
49
50
|
# File 'lib/mu/maker.rb', line 48
def literal_no_format text
musl << text
end
|
#musl ⇒ Object
28
29
30
|
# File 'lib/mu/maker.rb', line 28
def musl
@musl ||= []
end
|
#options ⇒ Object
72
73
74
75
76
|
# File 'lib/mu/maker.rb', line 72
def options block 'options {', '}' do
yield Options.new(self)
end
end
|
#steps ⇒ Object
84
85
86
87
88
|
# File 'lib/mu/maker.rb', line 84
def steps block 'steps { ', '}' do
yield Steps.new(self)
end
end
|