Class: WagonGenerator
- Defined in:
- lib/generators/wagon/wagon_generator.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#wagon_name ⇒ Object
readonly
Returns the value of attribute wagon_name.
Instance Method Summary collapse
- #copy_templates ⇒ Object
-
#initialize(*args) ⇒ WagonGenerator
constructor
A new instance of WagonGenerator.
Constructor Details
#initialize(*args) ⇒ WagonGenerator
Returns a new instance of WagonGenerator.
6 7 8 9 10 |
# File 'lib/generators/wagon/wagon_generator.rb', line 6 def initialize(*args) super @wagon_name = name assign_names!("#{application_name}_#{name}") end |
Instance Attribute Details
#wagon_name ⇒ Object (readonly)
Returns the value of attribute wagon_name.
2 3 4 |
# File 'lib/generators/wagon/wagon_generator.rb', line 2 def wagon_name @wagon_name end |
Instance Method Details
#copy_templates ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/generators/wagon/wagon_generator.rb', line 12 def copy_templates self.destination_root = "vendor/wagons/#{wagon_name}" # do this whole manual traversal to be able to replace every single file # individually in the application. all_templates.each do |file| if File.basename(file) == '.empty_directory' file = File.dirname(file) directory(file, File.join(destination_root, file)) else template(file, File.join(destination_root, file.sub(/\.tt$/, ''))) end end end |