Class: ManifoldMock::Generators::TemplateGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/manifold_mock/template_generator.rb

Constant Summary collapse

ZB_TEMPLATES =
['banded','blog', 'feed', 'grid', 'orbit', 'banner-home', 'sidebar']

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



12
13
14
# File 'lib/generators/manifold_mock/template_generator.rb', line 12

def self.source_root
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#create_templateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/manifold_mock/template_generator.rb', line 16

def create_template
  if ZB_TEMPLATES.include?(options.template) && options.framework == "foundation"
    if options.haml?
      remove_file "app/views/layouts/application.html.erb"
      template "foundation/haml/#{options.template}.html.haml", "app/views/layouts/application.html.haml"
    else
      remove_file "app/views/layouts/application.html.haml"
      template "foundation/erb/#{options.template}.html.erb", "app/views/layouts/application.html.erb"
    end
  else
    raise "template not found."
  end
end