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.
-
#root_dir ⇒ Object
readonly
Returns the value of attribute root_dir.
-
#yml_content ⇒ Object
Returns the value of attribute yml_content.
Instance Method Summary collapse
-
#initialize(filename, options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #run(dir, options = {}) ⇒ Object
Constructor Details
#initialize(filename, options = {}) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 |
# File 'lib/skeleton_creator.rb', line 11 def initialize(filename, = {}) @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 |
#root_dir ⇒ Object (readonly)
Returns the value of attribute root_dir.
9 10 11 |
# File 'lib/skeleton_creator.rb', line 9 def root_dir @root_dir 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(dir, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/skeleton_creator.rb', line 16 def run(dir, = {}) return run_list(dir, ) if dir.respond_to? :each @options = if !.nil? @root_dir = dir.gsub /\~/, "#{ENV['HOME']}" yml_content.each do |key, value| if key == 'DIRECTORY' traverser = FileSystem::Traverser.new root_dir, traverser.traverse(value) do |file_node| file_node.create end end end end |