Class: Bootstrap::Generators::TemplatesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bootstrap/templates/templates_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.user_source_rootObject



7
8
9
# File 'lib/generators/bootstrap/templates/templates_generator.rb', line 7

def self.user_source_root
  Rails.root.join("lib", "generators", "bootstrap", "themed", "templates")
end

Instance Method Details

#add_templatesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/bootstrap/templates/templates_generator.rb', line 14

def add_templates

  views = {
    "index.html.haml"   => File.join(self.class.user_source_root, "index.html.haml"),
    "new.html.haml"     => File.join(self.class.user_source_root, "new.html.haml"),
    "edit.html.haml"    => File.join(self.class.user_source_root, "edit.html.haml"),
    "_form.html.haml"   => File.join(self.class.user_source_root, "_form.html.haml"),
    "show.html.haml"    => File.join(self.class.user_source_root, "show.html.haml")}

  views.each do |template_name, output_path|
    copy_file template_name, output_path
  end
end