mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
b059ceb94f
commit
b339170271
5 changed files with 32 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Added -a/--with-assets option to rails generator that will include default assets for application layout, javascript, and stylesheet [DHH]
|
||||||
|
|
||||||
* Added socket cleanup for lighttpd, both before and after [DHH]
|
* Added socket cleanup for lighttpd, both before and after [DHH]
|
||||||
|
|
||||||
* Added automatic creation of tmp/ when running script/server [DHH]
|
* Added automatic creation of tmp/ when running script/server [DHH]
|
||||||
|
|
1
railties/assets/application.css
Normal file
1
railties/assets/application.css
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/* Place your application-specific styles here */
|
1
railties/assets/application.js
Normal file
1
railties/assets/application.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
// Place your application-specific JavaScript functions and classes here
|
15
railties/assets/application.rhtml
Normal file
15
railties/assets/application.rhtml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<title><%=h @title || "Rails Application" %></title>
|
||||||
|
<%= javascript_include_tag :defaults %>
|
||||||
|
<%= stylesheet_link_tag "application" %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= yield %>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -6,7 +6,7 @@ class AppGenerator < Rails::Generator::Base
|
||||||
|
|
||||||
DATABASES = %w( mysql oracle postgresql sqlite2 sqlite3 )
|
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__)}/../../../../.."
|
mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
|
||||||
|
|
||||||
def initialize(runtime_args, runtime_options = {})
|
def initialize(runtime_args, runtime_options = {})
|
||||||
|
@ -81,6 +81,13 @@ class AppGenerator < Rails::Generator::Base
|
||||||
%w(server production development test).each { |file|
|
%w(server production development test).each { |file|
|
||||||
m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -99,6 +106,9 @@ class AppGenerator < Rails::Generator::Base
|
||||||
opt.on("-d", "--database=name", String,
|
opt.on("-d", "--database=name", String,
|
||||||
"Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
|
"Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
|
||||||
"Default: mysql") { |options[:db]| }
|
"Default: mysql") { |options[:db]| }
|
||||||
|
|
||||||
|
opt.on("-a", "--with-assets",
|
||||||
|
"Include default assets for layout, javascript, and stylesheet.") { |options[:include_assets]| }
|
||||||
end
|
end
|
||||||
|
|
||||||
def mysql_socket_location
|
def mysql_socket_location
|
||||||
|
|
Loading…
Reference in a new issue