Class: Tinychef::NewDirectory
- Inherits:
-
Object
- Object
- Tinychef::NewDirectory
- Defined in:
- lib/tinychef/new_directory.rb
Constant Summary collapse
- DIR_MAP =
{ 'cookbooks' => nil, 'data_bags' => nil, 'imported_cookbooks' => nil, 'nodes' => nil, 'roles' => nil, 'vendor' => nil, }
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #copy_solo_file ⇒ Object
- #create ⇒ Object
-
#initialize(name) ⇒ NewDirectory
constructor
A new instance of NewDirectory.
Constructor Details
#initialize(name) ⇒ NewDirectory
Returns a new instance of NewDirectory.
18 19 20 |
# File 'lib/tinychef/new_directory.rb', line 18 def initialize(name) @path = Pathname.new(name) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
16 17 18 |
# File 'lib/tinychef/new_directory.rb', line 16 def path @path end |
Instance Method Details
#copy_solo_file ⇒ Object
32 33 34 35 |
# File 'lib/tinychef/new_directory.rb', line 32 def copy_solo_file solo_file = Pathname.new(File.join(File.('../../../files', __FILE__), 'solo.rb')) FileUtils.cp solo_file, path.join('solo.rb') end |
#create ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/tinychef/new_directory.rb', line 22 def create path.mkpath unless path.exist? DIR_MAP.each do |key, value| path.join(key).mkpath end copy_solo_file end |