Class: Cupper::CookbookFile
- Inherits:
-
Object
- Object
- Cupper::CookbookFile
- Includes:
- Entity
- Defined in:
- lib/cupper/cookbook_file.rb
Constant Summary
Constants included from Entity
Instance Method Summary collapse
-
#initialize(dest_path, source, content, erb_file, full_path, type = nil) ⇒ CookbookFile
constructor
A new instance of CookbookFile.
- #setup_path ⇒ Object
Methods included from Entity
#content, #create, #dir?, #exist?, #file?, #full_path, #render_template, #save
Constructor Details
#initialize(dest_path, source, content, erb_file, full_path, type = nil) ⇒ CookbookFile
Returns a new instance of CookbookFile.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/cupper/cookbook_file.rb', line 5 def initialize(dest_path, source, content, erb_file, full_path, type = nil) @source = source @content = content @file_path = dest_path subdir = full_path.split('/') subdir.pop @subdir_path = subdir.join('/') self.setup_path super(@source, @file_path+@subdir_path, erb_file, type) end |
Instance Method Details
#setup_path ⇒ Object
16 17 18 19 |
# File 'lib/cupper/cookbook_file.rb', line 16 def setup_path require 'fileutils' FileUtils.mkdir_p @file_path+@subdir_path end |