Sha256: 6fbbf60acaa7bad503b09a564cef62e3513e39290a2d34c6cb6a581156d4bf3a
Contents?: true
Size: 1.16 KB
Versions: 28
Compression:
Stored size: 1.16 KB
Contents
class NiftyLayoutGenerator < Rails::Generator::Base def initialize(runtime_args, runtime_options = {}) super @name = @args.first || 'application' end def manifest record do |m| m.directory 'app/views/layouts' m.directory 'public/stylesheets' m.directory 'app/helpers' if options[:haml] m.directory 'public/stylesheets/sass' m.template "layout.html.haml", "app/views/layouts/#{file_name}.html.haml" m.file "stylesheet.sass", "public/stylesheets/sass/#{file_name}.sass" else m.template "layout.html.erb", "app/views/layouts/#{file_name}.html.erb" m.file "stylesheet.css", "public/stylesheets/#{file_name}.css" end m.file "helper.rb", "app/helpers/layout_helper.rb" end end def file_name @name.underscore end protected def add_options!(opt) opt.separator '' opt.separator 'Options:' opt.on("--haml", "Generate HAML for view, and SASS for stylesheet.") { |v| options[:haml] = v } end def banner <<-EOS Creates generic layout, stylesheet, and helper files. USAGE: #{$0} #{spec.name} [layout_name] EOS end end
Version data entries
28 entries across 28 versions & 13 rubygems