19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/generators/entity_def/entity_def_generator.rb', line 19
def manifest
lower_name = class_name[0, 1].downcase + class_name[1..-1]
high_name = class_name[0, 1].upcase + class_name[1..-1]
singular_name = lower_name.singularize
plural_name = class_name.pluralize
snake_name = lower_name.pluralize.snake_case
template "controller.rb", File.join(["app/controllers/", "#{snake_name}_controller.rb"].flatten)
template "helper.rb", File.join(["app/helpers/", "#{snake_name}_helper.rb"].flatten)
template "model.rb", File.join(["app/models/", "#{singular_name.snake_case}.rb"].flatten)
empty_directory File.join("app/views", snake_name)
template "view/_form.html.erb", File.join(["app/views/#{snake_name}/", "_form.html.erb"].flatten)
template "view/edit.html.erb", File.join(["app/views/#{snake_name}/", "edit.html.erb"].flatten)
template "view/index.html.erb", File.join(["app/views/#{snake_name}/", "index.html.erb"].flatten)
template "view/new.html.erb", File.join(["app/views/#{snake_name}/", "new.html.erb"].flatten)
template "view/show.html.erb", File.join(["app/views/#{snake_name}/", "show.html.erb"].flatten)
route "resources :#{snake_name}"
end
|