Class: Html5LayoutGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



4
5
6
# File 'lib/generators/html5_layout/html5_layout_generator.rb', line 4

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

Instance Method Details

#generate_layoutObject

class_option :haml, :type => :boolean, :desc => “Include the SASS version for CSS”



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/html5_layout/html5_layout_generator.rb', line 13

def generate_layout
  if options.sass?
    directory 'app'
    gem 'compass', '>=0.10.5'
    gem 'compass-960-plugin', '>=0.10.0'
    directory 'config'
  else
    copy_file "stylesheet.css", "public/stylesheets/#{file_name}.css" if options.stylesheet?
    copy_file "handheld.css", "public/stylesheets/handheld.css" if options.stylesheet?
  end
  copy_file "modernizr-1.5.min.js", "public/javascripts/modernizr-1.5.min.js"
  copy_file "jquery-1.4.2.min.js", "public/javascripts/jquery-1.4.2.min.js"
  copy_file "dd_belatedpng.js", "public/javascripts/dd_belatedpng.js"

  template "layout.html.erb", "app/views/layouts/#{file_name}.html.erb"
  copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
end