Class: LibrarianChefDSLParser
- Inherits:
-
Object
- Object
- LibrarianChefDSLParser
- Defined in:
- lib/librarian_chef_dsl_parser.rb
Instance Attribute Summary collapse
-
#cookbooks ⇒ Object
Returns the value of attribute cookbooks.
-
#site(*val) ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
- #cheffile ⇒ Object
- #cookbook(name, options) ⇒ Object
-
#initialize(cheffile, &data) ⇒ LibrarianChefDSLParser
constructor
A new instance of LibrarianChefDSLParser.
Constructor Details
#initialize(cheffile, &data) ⇒ LibrarianChefDSLParser
Returns a new instance of LibrarianChefDSLParser.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/librarian_chef_dsl_parser.rb', line 7 def initialize(cheffile, &data) @cheffile = cheffile @cookbooks = [] data = false uri = URI.parse(cheffile) if %w( http https ).include?(uri.scheme) data = Net::HTTP.get(uri) else data = File.read(cheffile) end instance_eval data end |
Instance Attribute Details
#cookbooks ⇒ Object
Returns the value of attribute cookbooks.
5 6 7 |
# File 'lib/librarian_chef_dsl_parser.rb', line 5 def cookbooks @cookbooks end |
#site(*val) ⇒ Object
Returns the value of attribute site.
5 6 7 |
# File 'lib/librarian_chef_dsl_parser.rb', line 5 def site @site end |
Instance Method Details
#cheffile ⇒ Object
21 22 23 |
# File 'lib/librarian_chef_dsl_parser.rb', line 21 def cheffile @cheffile end |
#cookbook(name, options) ⇒ Object
29 30 31 32 |
# File 'lib/librarian_chef_dsl_parser.rb', line 29 def cookbook(name, ) cookbook = { "name" => name, "options" => } @cookbooks.push(cookbook) end |