Class: Sprout::Generator::DirectoryManifest
- Inherits:
-
Manifest
- Object
- Manifest
- Sprout::Generator::DirectoryManifest
- Defined in:
- lib/sprout/generator/directory_manifest.rb
Instance Attribute Summary (collapse)
-
- (Object) children
readonly
Returns the value of attribute children.
-
- (Object) generators
readonly
Returns the value of attribute generators.
Instance Method Summary (collapse)
- - (Object) create
- - (Object) destroy
-
- (DirectoryManifest) initialize
constructor
A new instance of DirectoryManifest.
Methods inherited from Manifest
Constructor Details
- (DirectoryManifest) initialize
A new instance of DirectoryManifest
6 7 8 9 10 |
# File 'lib/sprout/generator/directory_manifest.rb', line 6 def initialize super @children = [] @generators = [] end |
Instance Attribute Details
- (Object) children (readonly)
Returns the value of attribute children
3 4 5 |
# File 'lib/sprout/generator/directory_manifest.rb', line 3 def children @children end |
- (Object) generators (readonly)
Returns the value of attribute generators
4 5 6 |
# File 'lib/sprout/generator/directory_manifest.rb', line 4 def generators @generators end |
Instance Method Details
- (Object) create
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sprout/generator/directory_manifest.rb', line 12 def create if !File.directory?(path) FileUtils.mkdir_p path say "Created directory: #{path}" else say "Skipped existing: #{path}" unless(path == Dir.pwd) end create_children execute_generators end |
- (Object) destroy
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sprout/generator/directory_manifest.rb', line 23 def destroy unexecute_generators success = destroy_children if success && can_remove? FileUtils.rmdir path say "Removed directory: #{path}" true else say "Skipped remove directory: #{path}" false end end |