Class: Alchemy::Generators::IngredientGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Alchemy::Generators::IngredientGenerator
- Defined in:
- lib/generators/alchemy/ingredient/ingredient_generator.rb
Instance Method Summary collapse
- #copy_templates ⇒ Object
- #create_model ⇒ Object
- #create_view_component ⇒ Object
- #init ⇒ Object
- #show_todo ⇒ Object
Instance Method Details
#copy_templates ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 25 def copy_templates @ingredient_editor_local = "#{file_name}_editor" @ingredient_view_local = "#{file_name}_view" @ingredient_view_component_class = "#{@class_name}View" template "view.html.erb", "#{@ingredients_view_path}/_#{file_name}_view.html.erb" template "editor.html.erb", "#{@ingredients_view_path}/_#{file_name}_editor.html.erb" end |
#create_model ⇒ Object
21 22 23 |
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 21 def create_model template "model.rb.tt", "app/models/alchemy/ingredients/#{file_name}.rb" end |
#create_view_component ⇒ Object
17 18 19 |
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 17 def create_view_component template "view_component.rb.tt", "app/components/alchemy/ingredients/#{file_name}_view.rb" end |
#init ⇒ Object
12 13 14 15 |
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 12 def init @class_name = class_name.classify @ingredients_view_path = "app/views/alchemy/ingredients" end |
#show_todo ⇒ Object
33 34 35 |
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 33 def show_todo say "\nPlease check the generated files and alter them to fit your needs." end |