Class: Humpyard::Generators::SkeletonGenerator
- Defined in:
- lib/generators/humpyard/skeleton/skeleton_generator.rb
Overview
Skeleton Generator
rails humpyard:skeleton [options]
Description
The humpyard skeleton generator creates a basic layout, stylesheet and helper which will give some structure to a starting Rails app.
Options
[--skip-compass]-
Don’t generate COMPASS related files (do this only if you really know what you are doing)
[--table-name-prefix=TABLE_NAME_PREFIX]-
The SQL table name prefix for humpyard as string
Default:
humpyard_ [--locales=one two three]-
The locales used in humpyard as array
Default:
en [--www-prefix=WWW_PREFIX]-
The prefix for humpyard www pages as string
Default:
:locale/ [--skip-haml-init]-
Don’t generate HAML initializer (if you are already using HAML)
[--admin-prefix=ADMIN_PREFIX]-
The prefix for humpyard admin controllers as string
Default:
admin [--skip-compass-init]-
Don’t generate COMPASS initializer (if you are already using COMPASS)
Runtime options
-q, [--quiet]-
Supress status output
-p, [--pretend]-
Run but do not make any changes
-s, [--skip]-
Skip files that already exist
-f, [--force]-
Overwrite files that already exist
Examples
rails generate humpyard:skeleton
Instance Method Summary collapse
-
#create_skeleton ⇒ Object
:nodoc:.
Methods inherited from Base
Instance Method Details
#create_skeleton ⇒ Object
:nodoc:
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/generators/humpyard/skeleton/skeleton_generator.rb', line 66 def create_skeleton # :nodoc: template 'initializers/humpyard.rb', "config/initializers/humpyard.rb" unless [:skip_haml] copy_file 'initializers/haml.rb', "config/initializers/haml.rb" unless [:skip_haml_init] [:templates].each do |template| template 'views/layout.html.haml', "app/views/layouts/#{template}.html.haml" end end unless [:skip_compass] copy_file 'initializers/compass.rb', "config/initializers/compass.rb" unless [:skip_compass_init] copy_file 'compass.config', "config/compass.config" template_path = "#{::File.dirname(__FILE__)}/templates/" Dir.glob("#{template_path}stylesheets/**/*.#{[:compass_format]}").each do |file| copy_file file.gsub(template_path, ''), "app/#{file.gsub(template_path, '')}" end Dir.glob("#{template_path}images/**/*.{png,gif,jpg}").each do |file| copy_file file.gsub(template_path, ''), "public/#{file.gsub(template_path, '')}" end end unless [:skip_js] Dir.glob("#{template_path}javascripts/#{[:js_framework]}/**/*.*").each do |file| copy_file file.gsub(template_path, ''), "public/#{file.gsub("#{template_path}javascripts/#{[:js_framework]}", '')}" end end end |