Class: Vam::Dsl
- Inherits:
-
Object
- Object
- Vam::Dsl
- Defined in:
- lib/vam/dsl.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#vams ⇒ Object
readonly
Returns the value of attribute vams.
Class Method Summary collapse
Instance Method Summary collapse
- #eval_vamfile(vamfile, contents = nil) ⇒ Object
-
#initialize ⇒ Dsl
constructor
A new instance of Dsl.
- #source(url) ⇒ Object
- #vam(name, *args) ⇒ Object
Constructor Details
#initialize ⇒ Dsl
Returns a new instance of Dsl.
16 17 18 |
# File 'lib/vam/dsl.rb', line 16 def initialize @vams = [] end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/vam/dsl.rb', line 7 def repo @repo end |
#vams ⇒ Object (readonly)
Returns the value of attribute vams.
7 8 9 |
# File 'lib/vam/dsl.rb', line 7 def vams @vams end |
Class Method Details
.evaluate(vamfile) ⇒ Object
9 10 11 12 13 |
# File 'lib/vam/dsl.rb', line 9 def self.evaluate(vamfile) dsl = new() dsl.eval_vamfile(vamfile) return dsl end |
Instance Method Details
#eval_vamfile(vamfile, contents = nil) ⇒ Object
21 22 23 24 |
# File 'lib/vam/dsl.rb', line 21 def eval_vamfile(vamfile, contents = nil) contents ||= File.read(vamfile) instance_eval(contents, vamfile.to_s, 1) end |
#source(url) ⇒ Object
44 45 46 47 |
# File 'lib/vam/dsl.rb', line 44 def source(url) @source = url @repo = Repo.load url end |
#vam(name, *args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vam/dsl.rb', line 27 def vam(name, *args) = args.last.is_a?(Hash) ? args.last.dup : {} if args.first.is_a?(String) [:version] = args.first end begin vam = Vam.new name, self, @vams << vam rescue MissingComponentError => e puts e..colorize(:red) end end |