Class: Alchemy::Generators::IngredientGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/alchemy/ingredient/ingredient_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_templatesObject



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_modelObject



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_componentObject



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

#initObject



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_todoObject



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