Compare commits

...

1 Commits

Author SHA1 Message Date
David Heinemeier Hansson
c8da518bbf Tagged Rails 2.0.2
git-svn-id: http://svn-commit.rubyonrails.org/rails/tags/rel_2-0-2@8430 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-17 01:22:11 +00:00
33 changed files with 276 additions and 72 deletions

View File

@@ -11,7 +11,7 @@ end
desc 'Run all tests by default'
task :default => :test
%w(test docs package pgem release).each do |task_name|
%w(test rdoc package pgem release).each do |task_name|
desc "Run #{task_name} task for all projects"
task task_name do
PROJECTS.each do |project|

View File

@@ -1,3 +1,8 @@
*2.0.2* (December 16th, 2007)
* Included in Rails 2.0.2
*2.0.1* (December 7th, 2007)
* Update ActionMailer so it treats ActionView the same way that ActionController does. Closes #10244 [rick]

View File

@@ -55,7 +55,7 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
s.add_dependency('actionpack', '= 2.0.1' + PKG_BUILD)
s.add_dependency('actionpack', '= 2.0.2' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'

View File

@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View File

@@ -1,4 +1,20 @@
*SVN*
*2.0.2* (December 16th, 2007)
* Added delete_via_redirect and put_via_redirect to integration testing #10497 [philodespotos]
* Allow headers['Accept'] to be set by hand when calling xml_http_request #10461 [BMorearty]
* Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]
* Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:
ActionController::Base.asset_host = Proc.new { |source|
if source.starts_with?('/images')
"http://images.example.com"
else
"http://assets.example.com"
end
}
* Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]

View File

@@ -76,7 +76,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = true
s.requirements << 'none'
s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'action_controller'

View File

@@ -121,23 +121,38 @@ module ActionController
status
end
# Performs a GET request, following any subsequent redirect. Note that
# the redirects are followed until the response is not a redirect--this
# means you may run into an infinite loop if your redirect loops back to
# itself. Headers are treated in the same way as #get.
def get_via_redirect(path, args={}, headers = {})
get path, args, headers
# Performs a request using the specified method, following any subsequent
# redirect. Note that the redirects are followed until the response is
# not a redirect--this means you may run into an infinite loop if your
# redirect loops back to itself.
def request_via_redirect(http_method, path, parameters = nil, headers = nil)
send(http_method, path, parameters, headers)
follow_redirect! while redirect?
status
end
# Performs a POST request, following any subsequent redirect. This is
# vulnerable to infinite loops, the same as #get_via_redirect. Headers are
# treated in the same way as #get.
def post_via_redirect(path, args={}, headers = {})
post path, args, headers
follow_redirect! while redirect?
status
# Performs a GET request, following any subsequent redirect.
# See #request_via_redirect() for more information.
def get_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:get, path, parameters, headers)
end
# Performs a POST request, following any subsequent redirect.
# See #request_via_redirect() for more information.
def post_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:post, path, parameters, headers)
end
# Performs a PUT request, following any subsequent redirect.
# See #request_via_redirect() for more information.
def put_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:put, path, parameters, headers)
end
# Performs a DELETE request, following any subsequent redirect.
# See #request_via_redirect() for more information.
def delete_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:delete, path, parameters, headers)
end
# Returns +true+ if the last response was a redirect.
@@ -187,7 +202,7 @@ module ActionController
def xml_http_request(request_method, path, parameters = nil, headers = nil)
headers ||= {}
headers['X-Requested-With'] = 'XMLHttpRequest'
headers['Accept'] = 'text/javascript, text/html, application/xml, text/xml, */*'
headers['Accept'] ||= 'text/javascript, text/html, application/xml, text/xml, */*'
process(request_method, path, parameters, headers)
end

View File

@@ -4,7 +4,7 @@ require 'strscan'
module ActionController
# HTTP methods which are accepted by default.
ACCEPTED_HTTP_METHODS = Set.new(%w( get head put post delete ))
ACCEPTED_HTTP_METHODS = Set.new(%w( get head put post delete options ))
# CgiRequest and TestRequest provide concrete implementations.
class AbstractRequest

View File

@@ -35,7 +35,7 @@ require 'openssl' # to generate the HMAC message digest
# such as 'MD5', 'RIPEMD160', 'SHA256', etc.
#
# To generate a secret key for an existing application, run
# `rake generate:secret` and set the key in config/environment.rb
# `rake secret` and set the key in config/environment.rb
#
# Note that changing digest or secret invalidates all existing sessions!
class CGI::Session::CookieStore

View File

@@ -2,7 +2,7 @@ module ActionPack #:nodoc:
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View File

@@ -31,7 +31,7 @@ module ActionView
# stylesheet_include_tag("application")
# => <link href="http://assets3.example.com/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
#
# To do this, you can either setup four actual hosts, or you can use wildcard DNS to CNAME
# To do this, you can either setup 4 actual hosts, or you can use wildcard DNS to CNAME
# the wildcard to a single asset host. You can read more about setting up your DNS CNAME records from
# your ISP.
#
@@ -39,6 +39,32 @@ module ActionView
# for server load balancing. See http://www.die.net/musings/page_load_time/
# for background.
#
# Alternatively, you can exert more control over the asset host by setting <tt>asset_host</tt> to a proc
# that takes a single source argument. This is useful if you are unable to setup 4 actual hosts or have
# fewer/more than 4 hosts. The example proc below generates http://assets1.example.com and
# http://assets2.example.com randomly.
#
# ActionController::Base.asset_host = Proc.new { |source| "http://assets#{rand(2) + 1}.example.com" }
# image_tag("rails.png")
# => <img src="http://assets2.example.com/images/rails.png" alt="Rails" />
# stylesheet_include_tag("application")
# => <link href="http://assets1.example.com/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
#
# The proc takes a single <tt>source</tt> parameter which is the path of the source asset. This can be used to
# generate a particular asset host depending on the asset path.
#
# ActionController::Base.asset_host = Proc.new { |source|
# if source.starts_with?('/images')
# "http://images.example.com"
# else
# "http://assets.example.com"
# end
# }
# image_tag("rails.png")
# => <img src="http://images.example.com/images/rails.png" alt="Rails" />
# stylesheet_include_tag("application")
# => <link href="http://assets.example.com/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
#
# === Using asset timestamps
#
# By default, Rails will append all asset paths with that asset's timestamp. This allows you to set a cache-expiration date for the
@@ -385,19 +411,18 @@ module ActionView
# Add the .ext if not present. Return full URLs otherwise untouched.
# Prefix with /dir/ if lacking a leading /. Account for relative URL
# roots. Rewrite the asset path for cache-busting asset ids. Include
# a single or wildcarded asset host, if configured, with the correct
# request protocol.
# asset host, if configured, with the correct request protocol.
def compute_public_path(source, dir, ext = nil, include_host = true)
has_request = @controller.respond_to?(:request)
cache_key =
if has_request
[ @controller.request.protocol,
ActionController::Base.asset_host,
ActionController::Base.asset_host.to_s,
@controller.request.relative_url_root,
dir, source, ext, include_host ].join
else
[ ActionController::Base.asset_host,
[ ActionController::Base.asset_host.to_s,
dir, source, ext, include_host ].join
end
@@ -430,11 +455,16 @@ module ActionView
end
# Pick an asset host for this source. Returns nil if no host is set,
# the host if no wildcard is set, or the host interpolated with the
# numbers 0-3 if it contains %d. The number is the source hash mod 4.
# the host if no wildcard is set, the host interpolated with the
# numbers 0-3 if it contains %d (the number is the source hash mod 4),
# or the value returned from invoking the proc if it's a proc.
def compute_asset_host(source)
if host = ActionController::Base.asset_host
host % (source.hash % 4)
if host.is_a?(Proc)
host.call(source)
else
host % (source.hash % 4)
end
end
end

View File

@@ -287,8 +287,8 @@ module ActionView
#
# ==== Examples
# auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# # => "Go to <a href="http://www.rubyonrails.org">http://www.rubyonrails.org</a> and
# # say hello to <a href="mailto:david@loudthinking.com">david@loudthinking.com</a>"
# # => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# # say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
#
# auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :urls)
# # => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>

View File

@@ -5,7 +5,7 @@ class ERB
HTML_ESCAPE = { '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => '&lt;' }
def html_escape(s)
s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }
s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
end
end
end

View File

@@ -49,28 +49,49 @@ class SessionTest < Test::Unit::TestCase
assert_equal 200, @session.follow_redirect!
end
def test_get_via_redirect
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
@session.expects(:get).with(path,args,headers)
def test_request_via_redirect_uses_given_method
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
@session.expects(:put).with(path, args, headers)
@session.stubs(:redirect?).returns(false)
@session.request_via_redirect(:put, path, args, headers)
end
def test_request_via_redirect_follows_redirects
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
@session.stubs(:redirect?).returns(true, true, false)
@session.expects(:follow_redirect!).times(2)
@session.request_via_redirect(:get, path, args, headers)
end
def test_request_via_redirect_returns_status
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
@session.stubs(:redirect?).returns(false)
@session.stubs(:status).returns(200)
assert_equal 200, @session.get_via_redirect(path, args, headers)
assert_equal 200, @session.request_via_redirect(:get, path, args, headers)
end
def test_get_via_redirect
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
@session.expects(:request_via_redirect).with(:get, path, args, headers)
@session.get_via_redirect(path, args, headers)
end
def test_post_via_redirect
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
@session.expects(:request_via_redirect).with(:post, path, args, headers)
@session.post_via_redirect(path, args, headers)
end
@session.expects(:post).with(path,args,headers)
def test_put_via_redirect
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
@session.expects(:request_via_redirect).with(:put, path, args, headers)
@session.put_via_redirect(path, args, headers)
end
@session.stubs(:redirect?).returns(true, true, false)
@session.expects(:follow_redirect!).times(2)
@session.stubs(:status).returns(200)
assert_equal 200, @session.post_via_redirect(path, args, headers)
def test_delete_via_redirect
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
@session.expects(:request_via_redirect).with(:delete, path, args, headers)
@session.delete_via_redirect(path, args, headers)
end
def test_url_for_with_controller
@@ -179,6 +200,15 @@ class SessionTest < Test::Unit::TestCase
@session.expects(:process).with(:head,path,params,headers_after_xhr)
@session.xml_http_request(:head,path,params,headers)
end
def test_xml_http_request_override_accept
path = "/index"; params = "blah"; headers = {:location => 'blah', "Accept" => "application/xml"}
headers_after_xhr = headers.merge(
"X-Requested-With" => "XMLHttpRequest"
)
@session.expects(:process).with(:post,path,params,headers_after_xhr)
@session.xml_http_request(:post,path,params,headers)
end
end
class IntegrationTestTest < Test::Unit::TestCase

View File

@@ -316,7 +316,7 @@ class RequestTest < Test::Unit::TestCase
def test_allow_method_hacking_on_post
set_request_method_to :post
[:get, :head, :put, :post, :delete].each do |method|
[:get, :head, :options, :put, :post, :delete].each do |method|
@request.instance_eval { @parameters = { :_method => method } ; @request_method = nil }
assert_equal(method == :head ? :get : method, @request.method)
end

View File

@@ -223,7 +223,6 @@ class AssetTagHelperTest < Test::Unit::TestCase
assert_equal copy, source
end
def test_caching_javascript_include_tag_when_caching_on
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.asset_host = 'http://a%d.example.com'
@@ -247,7 +246,24 @@ class AssetTagHelperTest < Test::Unit::TestCase
File.delete(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
File.delete(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
end
def test_caching_javascript_include_tag_when_caching_on_with_proc_asset_host
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" }
ActionController::Base.perform_caching = true
assert_equal '/javascripts/scripts.js'.length, 23
assert_dom_equal(
%(<script src="http://a23.example.com/javascripts/scripts.js" type="text/javascript"></script>),
javascript_include_tag(:all, :cache => 'scripts')
)
assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'scripts.js'))
ensure
File.delete(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'scripts.js'))
end
def test_caching_javascript_include_tag_when_caching_on_and_using_subdirectory
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.asset_host = 'http://a%d.example.com'
@@ -304,7 +320,24 @@ class AssetTagHelperTest < Test::Unit::TestCase
File.delete(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
File.delete(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
end
def test_caching_stylesheet_link_tag_when_caching_on_with_proc_asset_host
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" }
ActionController::Base.perform_caching = true
assert_equal '/stylesheets/styles.css'.length, 23
assert_dom_equal(
%(<link href="http://a23.example.com/stylesheets/styles.css" media="screen" rel="stylesheet" type="text/css" />),
stylesheet_link_tag(:all, :cache => 'styles')
)
assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'styles.css'))
ensure
File.delete(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'styles.css'))
end
def test_caching_stylesheet_include_tag_when_caching_off
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.perform_caching = false

View File

@@ -0,0 +1,56 @@
require "#{File.dirname(__FILE__)}/../abstract_unit"
class ErbUtilTest < Test::Unit::TestCase
include ERB::Util
def test_amp
assert_equal '&amp;', html_escape('&')
end
def test_quot
assert_equal '&quot;', html_escape('"')
end
def test_lt
assert_equal '&lt;', html_escape('<')
end
def test_gt
assert_equal '&gt;', html_escape('>')
end
def test_rest_in_ascii
(0..127).to_a.map(&:chr).each do |chr|
next if %w(& " < >).include?(chr)
assert_equal chr, html_escape(chr)
end
end
end
require "#{File.dirname(__FILE__)}/../abstract_unit"
class ErbUtilTest < Test::Unit::TestCase
include ERB::Util
def test_amp
assert_equal '&amp;', html_escape('&')
end
def test_quot
assert_equal '&quot;', html_escape('"')
end
def test_lt
assert_equal '&lt;', html_escape('<')
end
def test_gt
assert_equal '&gt;', html_escape('>')
end
def test_rest_in_ascii
(0..127).to_a.map(&:chr).each do |chr|
next if %w(& " < >).include?(chr)
assert_equal chr, html_escape(chr)
end
end
end

View File

@@ -1,4 +1,4 @@
*SVN*
*2.0.2* (December 16th, 2007)
* Ensure optimistic locking handles nil #lock_version values properly. Closes #10510 [rick]

View File

@@ -172,7 +172,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
s.files.delete "test/fixtures/fixture_database.sqlite"
s.files.delete "test/fixtures/fixture_database_2.sqlite"

View File

@@ -2,7 +2,7 @@ module ActiveRecord
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View File

@@ -1,4 +1,4 @@
*SVN*
*2.0.2* (December 16th, 2007)
* Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]

View File

@@ -62,7 +62,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'active_resource'

View File

@@ -2,7 +2,7 @@ module ActiveResource
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View File

@@ -15,7 +15,22 @@ module ActiveSupport #:nodoc:
remove_method :to_time if base.instance_methods.include?(:to_time)
end
end
# Convert to a formatted string - see DATE_FORMATS for predefined formats.
# You can also add your own formats to the DATE_FORMATS constant and use them with this method.
#
# This method is also aliased as <tt>to_s</tt>.
#
# === Examples:
# datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
#
# datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
# datetime.to_s(:db) # => "2007-12-04 00:00:00"
# datetime.to_s(:number) # => "20071204000000"
# datetime.to_formatted_s(:short) # => "04 Dec 00:00"
# datetime.to_formatted_s(:long) # => "December 04, 2007 00:00"
# datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00"
# datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
def to_formatted_s(format = :default)
if formatter = ::Time::DATE_FORMATS[format]
if formatter.respond_to?(:call)
@@ -49,6 +64,7 @@ module ActiveSupport #:nodoc:
self
end
# Converts datetime to an appropriate format for use in XML
def xmlschema
strftime("%Y-%m-%dT%H:%M:%S%Z")
end if RUBY_VERSION < '1.9'

View File

@@ -2,7 +2,7 @@ module ActiveSupport
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View File

@@ -1,6 +1,10 @@
*SVN*
*2.0.2* (December 16th, 2007)
* Introduce `rake generate:secret` to output a crytographically secure secret key for use with cookie sessions. #xxxx [update from Trac]
* Changed the default database from mysql to sqlite3, so now running "rails myapp" will have a config/database.yml that's setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run "rails -d mysql myapp" [DHH]
* Turned on ActionView::Base.cache_template_loading by default in config/environments/production.rb to prevent file system stat calls for every template loading to see if it changed (this means that you have to restart the application to see template changes in production mode) [DHH]
* Introduce `rake secret` to output a crytographically secure secret key for use with cookie sessions #10363 [revans]
* Fixed that local database creation should consider 127.0.0.1 local #9026 [parcelbrat]

View File

@@ -312,11 +312,11 @@ spec = Gem::Specification.new do |s|
EOF
s.add_dependency('rake', '>= 0.7.2')
s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
s.add_dependency('activerecord', '= 2.0.1' + PKG_BUILD)
s.add_dependency('actionpack', '= 2.0.1' + PKG_BUILD)
s.add_dependency('actionmailer', '= 2.0.1' + PKG_BUILD)
s.add_dependency('activeresource', '= 2.0.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
s.add_dependency('activerecord', '= 2.0.2' + PKG_BUILD)
s.add_dependency('actionpack', '= 2.0.2' + PKG_BUILD)
s.add_dependency('actionmailer', '= 2.0.2' + PKG_BUILD)
s.add_dependency('activeresource', '= 2.0.2' + PKG_BUILD)
s.rdoc_options << '--exclude' << '.'
s.has_rdoc = false

View File

@@ -1,4 +1,4 @@
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql

View File

@@ -1,5 +1,5 @@
# SQLite version 3.x
# gem install sqlite3-ruby
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3

View File

@@ -10,6 +10,7 @@ config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

View File

@@ -2,7 +2,7 @@ module Rails
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View File

@@ -8,7 +8,7 @@ class AppGenerator < Rails::Generator::Base
DATABASES = %w(mysql oracle postgresql sqlite2 sqlite3 frontbase)
default_options :db => (ENV["RAILS_DEFAULT_DATABASE"] || "mysql"),
default_options :db => (ENV["RAILS_DEFAULT_DATABASE"] || "sqlite3"),
:shebang => DEFAULT_SHEBANG, :freeze => false
mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."

View File

@@ -4,9 +4,7 @@ task :environment do
end
require 'rails_generator/secret_key_generator'
namespace :generate do
desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.'
task :secret do
puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret
end
desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.'
task :secret do
puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret
end