Class: Groundworkcss::Generators::LayoutGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/groundworkcss/layout/layout_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



9
10
11
# File 'lib/generators/groundworkcss/layout/layout_generator.rb', line 9

def app_name
  @app_name
end

#container_classObject (readonly)

Returns the value of attribute container_class.



9
10
11
# File 'lib/generators/groundworkcss/layout/layout_generator.rb', line 9

def container_class
  @container_class
end

Instance Method Details

#generate_layoutObject



11
12
13
14
15
16
17
18
# File 'lib/generators/groundworkcss/layout/layout_generator.rb', line 11

def generate_layout
  app = ::Rails.application
  @app_name = app.class.to_s.split("::").first
  ext = :erb
  template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
  copy_file "_sidebar.html.#{ext}", "app/views/layouts/_sidebar.html.#{ext}"
  copy_file "_header.html.#{ext}", "app/views/layouts/_header.html.#{ext}"        
end