Class: Para::ComponentGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Para::ComponentGenerator
- Includes:
- Generators::ComponentHelpers
- Defined in:
- lib/generators/para/component/component_generator.rb
Instance Method Summary collapse
- #add_route ⇒ Object
- #copy_component ⇒ Object
- #copy_component_controller ⇒ Object
- #copy_component_decorator ⇒ Object
- #create_show_component_view ⇒ Object
- #welcome ⇒ Object
Instance Method Details
#add_route ⇒ Object
29 30 31 |
# File 'lib/generators/para/component/component_generator.rb', line 29 def add_route add_component_to_routes :component, file_name end |
#copy_component ⇒ Object
13 14 15 |
# File 'lib/generators/para/component/component_generator.rb', line 13 def copy_component template 'component.rb', "app/components/#{ component_file_name }.rb" end |
#copy_component_controller ⇒ Object
21 22 23 |
# File 'lib/generators/para/component/component_generator.rb', line 21 def copy_component_controller template 'component_controller.rb', "app/controllers/admin/#{ component_file_name }_controller.rb" end |
#copy_component_decorator ⇒ Object
17 18 19 |
# File 'lib/generators/para/component/component_generator.rb', line 17 def copy_component_decorator template 'decorator.rb', "app/decorators/#{ decorator_file_name }.rb" end |
#create_show_component_view ⇒ Object
25 26 27 |
# File 'lib/generators/para/component/component_generator.rb', line 25 def create_show_component_view template 'show.html.haml', "app/views/admin/#{ component_file_name }/show.html.haml" end |
#welcome ⇒ Object
9 10 11 |
# File 'lib/generators/para/component/component_generator.rb', line 9 def welcome say 'Creating component...' end |