Class: Mustache::Generators::ScaffoldGenerator

Inherits:
Erb::Generators::ScaffoldGenerator
  • Object
show all
Extended by:
TemplatePath
Defined in:
lib/generators/mustache/scaffold/scaffold_generator.rb

Instance Method Summary collapse

Methods included from TemplatePath

source_root

Instance Method Details

#copy_view_filesObject

TODO Layout files? snusnu claims his template engine supports layouts: github.com/defunkt/mustache/issues/#issue/3/comment/263445



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/mustache/scaffold/scaffold_generator.rb', line 12

def copy_view_files
  views = available_views
  views.delete("index") if options[:singleton]

  views.each do |view|                  
    template "#{view}.rb.erb", 
             File.join("app/views", controller_file_path, "#{view}.rb")
    template "#{view}.html.mustache.erb", 
             File.join("app/templates", 
                       controller_file_path, 
                       "#{view}.html.mustache")
  end
  template "_form.html.mustache.erb", 
             File.join("app/templates", 
                       controller_file_path, 
                       "_form.html.mustache")
end