Class: Cupper::Cookbook
- Inherits:
-
Object
- Object
- Cupper::Cookbook
- Defined in:
- lib/cupper/cookbook.rb
Instance Method Summary collapse
- #all_recipes(collector) ⇒ Object
- #generate ⇒ Object
-
#initialize(cookbookname = 'default') ⇒ Cookbook
constructor
TODO: Read config file to tell the project path and configs.
- #setup_paths ⇒ Object
Constructor Details
#initialize(cookbookname = 'default') ⇒ Cookbook
TODO: Read config file to tell the project path and configs
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cupper/cookbook.rb', line 8 def initialize(cookbookname='default') @cookbook_path = "#{Dir.getwd}/cookbooks/#{cookbookname}" @cookbook_files_path = "#{@cookbook_path}/files" @cookbook_recipes_path = "#{@cookbook_path}/recipes" @recipe_deps = [ # TODO this is hard code to reflect all_recipes. Refactor this later "#{cookbookname}::packages", "#{cookbookname}::cookbook_files", "#{cookbookname}::links", "#{cookbookname}::users", "#{cookbookname}::groups", "#{cookbookname}::services", ] setup_paths end |
Instance Method Details
#all_recipes(collector) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/cupper/cookbook.rb', line 35 def all_recipes(collector) Recipe.new(@cookbook_recipes_path, collector, 'recipe', 'default', @recipe_deps).create Recipe.new(@cookbook_recipes_path, collector, '_cookbook_file', 'cookbook_files').create Recipe.new(@cookbook_recipes_path, collector, '_links', 'links').create Recipe.new(@cookbook_recipes_path, collector, '_groups', 'groups').create Recipe.new(@cookbook_recipes_path, collector, '_services', 'services').create Recipe.new(@cookbook_recipes_path, collector, '_users', 'users').create Recipe.new(@cookbook_recipes_path, collector, '_package', 'packages').create end |
#generate ⇒ Object
29 30 31 32 33 |
# File 'lib/cupper/cookbook.rb', line 29 def generate collector = Collect.new collector.setup all_recipes(collector) end |
#setup_paths ⇒ Object
23 24 25 26 27 |
# File 'lib/cupper/cookbook.rb', line 23 def setup_paths Dir.mkdir(@cookbook_path) unless Dir.exists?(@cookbook_path) Dir.mkdir(@cookbook_files_path) unless Dir.exists?(@cookbook_files_path) Dir.mkdir(@cookbook_recipes_path) unless Dir.exists?(@cookbook_recipes_path) end |