Class: FileSystem::Runner
- Inherits:
-
Object
- Object
- FileSystem::Runner
- Defined in:
- lib/skeleton_creator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#yml_content ⇒ Object
Returns the value of attribute yml_content.
Instance Method Summary collapse
-
#initialize(filename, options = false) ⇒ Runner
constructor
A new instance of Runner.
- #run(root_dir, options = {}) ⇒ Object
Constructor Details
#initialize(filename, options = false) ⇒ Runner
Returns a new instance of Runner.
10 11 12 13 |
# File 'lib/skeleton_creator.rb', line 10 def initialize(filename, = false) @yml_content = YAML.load_file(filename) @options = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/skeleton_creator.rb', line 8 def @options end |
#yml_content ⇒ Object
Returns the value of attribute yml_content.
8 9 10 |
# File 'lib/skeleton_creator.rb', line 8 def yml_content @yml_content end |
Instance Method Details
#run(root_dir, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/skeleton_creator.rb', line 15 def run(root_dir, = {}) @options = if !.nil? root = root_dir.gsub /~/, "#{ENV['HOME']}" yml_content.each do |key, value| if key == 'DIRECTORY' traverser = FileSystem::Traverser.new root, traverser.traverse(value) do |file_node| file_node.create end end end end |