Sha256: 26092797a3baccd7cd57d13ee2bd29ce66e3fecc57e5695a035091b1cd99f890
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb") class NiftyLayoutGenerator < Rails::Generator::Base def initialize(runtime_args, runtime_options = {}) super @name = @args.first || 'application' end def manifest record do |m| if options[:compass] m.directory 'app/stylesheets/partials' m.file "stylesheet.sass", "app/stylesheets/partials/_#{file_name}.sass" m.insert_after "app/stylesheets/screen.sass", "@import blueprint/modules/scaffolding.sass", "\n@import partials/#{file_name}.sass" m.replace "app/stylesheets/screen.sass", "// +blueprint", "+blueprint" elsif options[:haml] m.directory 'public/stylesheets/sass' m.file "stylesheet.sass", "public/stylesheets/sass/#{file_name}.sass" else m.directory 'public/stylesheets' m.file "stylesheet.css", "public/stylesheets/#{file_name}.css" end m.directory 'app/views/layouts' if options[:haml] m.template "layout.html.haml", "app/views/layouts/#{file_name}.html.haml" else m.template "layout.html.erb", "app/views/layouts/#{file_name}.html.erb" end m.directory 'app/helpers' 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 } opt.on("--compass", "Use Compass for stylesheets.") { |v| options[:compass] = v } end def banner <<-EOS Creates generic layout, stylesheet, and helper files. USAGE: #{$0} #{spec.name} [layout_name] EOS end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ghart-nifty-generators-0.3.0.1 | rails_generators/nifty_layout/nifty_layout_generator.rb |