aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-04 21:30:14 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-04 21:30:14 +0000
commitb3391702713224386381bb1b34488641c4084c22 (patch)
tree6c09715eaabfc4b716208414bbe153bb3d841330 /railties/lib
parentb059ceb94f96b3d00ed9a8d8dff5728de050c0b2 (diff)
downloadrails-b3391702713224386381bb1b34488641c4084c22.tar.gz
rails-b3391702713224386381bb1b34488641c4084c22.tar.bz2
rails-b3391702713224386381bb1b34488641c4084c22.zip
Added -a/--with-assets option to rails generator that will include default assets for application layout, javascript, and stylesheet [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3764 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 1dc903a6c8..8e40127dce 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -6,7 +6,7 @@ class AppGenerator < Rails::Generator::Base
DATABASES = %w( mysql oracle postgresql sqlite2 sqlite3 )
- default_options :db => "mysql", :shebang => DEFAULT_SHEBANG
+ default_options :db => "mysql", :shebang => DEFAULT_SHEBANG, :include_assets => false
mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
def initialize(runtime_args, runtime_options = {})
@@ -81,6 +81,13 @@ class AppGenerator < Rails::Generator::Base
%w(server production development test).each { |file|
m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
}
+
+ # Default assets
+ if options[:include_assets]
+ m.file "assets/application.css", "public/stylesheets/application.css"
+ m.file "assets/application.js", "public/javascripts/application.css"
+ m.file "assets/application.rhtml", "app/views/layouts/application.rhtml"
+ end
end
end
@@ -97,8 +104,11 @@ class AppGenerator < Rails::Generator::Base
"Default: #{DEFAULT_SHEBANG}") { |options[:shebang]| }
opt.on("-d", "--database=name", String,
- "Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
- "Default: mysql") { |options[:db]| }
+ "Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
+ "Default: mysql") { |options[:db]| }
+
+ opt.on("-a", "--with-assets",
+ "Include default assets for layout, javascript, and stylesheet.") { |options[:include_assets]| }
end
def mysql_socket_location