Class: Praegustator::Dsl
- Inherits:
-
Object
- Object
- Praegustator::Dsl
- Defined in:
- lib/praegustator/dsl.rb
Instance Method Summary collapse
- #environment(name, &block) ⇒ Object
-
#initialize ⇒ Dsl
constructor
A new instance of Dsl.
- #ip(address, &block) ⇒ Object
- #parse_file(filename) ⇒ Object
- #recipe(name, &block) ⇒ Object
- #role(name, &block) ⇒ Object
- #search(query, &block) ⇒ Object
Constructor Details
#initialize ⇒ Dsl
Returns a new instance of Dsl.
4 5 6 |
# File 'lib/praegustator/dsl.rb', line 4 def initialize @suits = [] end |
Instance Method Details
#environment(name, &block) ⇒ Object
8 9 10 |
# File 'lib/praegustator/dsl.rb', line 8 def environment(name, &block) @environment = name end |
#ip(address, &block) ⇒ Object
21 22 23 |
# File 'lib/praegustator/dsl.rb', line 21 def ip(address, &block) search("ipaddress:#{address}",&block) end |
#parse_file(filename) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/praegustator/dsl.rb', line 33 def parse_file(filename) if File.exists?(filename) && File.readable?(filename) self.instance_eval(IO.read(filename), filename, 1) else raise IOError, "Cannot open or read #{filename}!" end @suits end |
#recipe(name, &block) ⇒ Object
16 17 18 19 |
# File 'lib/praegustator/dsl.rb', line 16 def recipe(name, &block) name = name.gsub(":","\\:") search("run_list:recipe\\[#{name}\\]",&block) end |
#role(name, &block) ⇒ Object
12 13 14 |
# File 'lib/praegustator/dsl.rb', line 12 def role(name, &block) search("role:#{name}",&block) end |