aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/generators/rails/app/templates/Gemfile8
-rw-r--r--railties/lib/rails/application.rb5
-rw-r--r--railties/lib/rails/application/configuration.rb4
-rw-r--r--railties/lib/rails/application/routes_reloader.rb2
-rw-r--r--railties/lib/rails/console/helpers.rb4
-rw-r--r--railties/lib/rails/engine.rb4
-rw-r--r--railties/lib/rails/railtie/configuration.rb4
-rw-r--r--railties/lib/rails/tasks/documentation.rake72
8 files changed, 59 insertions, 44 deletions
diff --git a/railties/lib/generators/rails/app/templates/Gemfile b/railties/lib/generators/rails/app/templates/Gemfile
index f4bce8646d..0dd10f3f2d 100644
--- a/railties/lib/generators/rails/app/templates/Gemfile
+++ b/railties/lib/generators/rails/app/templates/Gemfile
@@ -1,4 +1,4 @@
-source 'http://gemcutter.org'
+source 'http://rubygems.org'
<%- if options.dev? -%>
gem 'rails', :path => '<%= Rails::Generators::RAILS_DEV_PATH %>'
@@ -15,15 +15,15 @@ gem 'rails', '<%= Rails::VERSION::STRING %>'
gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= require_for_database %>'<% end %>
<% end -%>
-# Use mongrel as the web server
-# gem 'mongrel'
+# Use unicorn as the web server
+# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# Bundle the extra gems:
# gem 'bj'
-# gem 'hpricot', '0.6'
+# gem 'nokogiri', '1.4.1'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index d9089b18f0..f43e8847ac 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -15,7 +15,10 @@ module Rails
class << self
private :new
- alias :configure :class_eval
+
+ def configure(&block)
+ class_eval(&block)
+ end
def instance
if self == Rails::Application
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index a00f9c43ae..d3a0ecb243 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -21,6 +21,10 @@ module Rails
@consider_all_requests_local = true
end
+ def middleware
+ @@default_middleware_stack ||= default_middleware
+ end
+
def paths
@paths ||= begin
paths = super
diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb
index fde6211c5d..a5154f4bba 100644
--- a/railties/lib/rails/application/routes_reloader.rb
+++ b/railties/lib/rails/application/routes_reloader.rb
@@ -27,7 +27,7 @@ module Rails
routes.clear!
paths.each { |path| load(path) }
- routes.finalize!
+ ActionController.base_hook { routes.finalize! }
nil
ensure
diff --git a/railties/lib/rails/console/helpers.rb b/railties/lib/rails/console/helpers.rb
index 039db667c4..212fc6125a 100644
--- a/railties/lib/rails/console/helpers.rb
+++ b/railties/lib/rails/console/helpers.rb
@@ -2,4 +2,6 @@ def helper
@helper ||= ApplicationController.helpers
end
-@controller = ApplicationController.new
+def controller
+ @controller ||= ApplicationController.new
+end
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index 8f5040ea13..85b4ff8470 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -97,8 +97,8 @@ module Rails
initializer :add_view_paths do
views = paths.app.views.to_a
- ActionController::Base.prepend_view_path(views) if defined?(ActionController::Base)
- ActionMailer::Base.prepend_view_path(views) if defined?(ActionMailer::Base)
+ ActionController.base_hook { prepend_view_path(views) } if defined?(ActionController)
+ ActionMailer.base_hook { prepend_view_path(views) } if defined?(ActionMailer)
end
initializer :add_metals do |app|
diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb
index 6a8c4ca09f..828ccec3d0 100644
--- a/railties/lib/rails/railtie/configuration.rb
+++ b/railties/lib/rails/railtie/configuration.rb
@@ -10,10 +10,6 @@ module Rails
@session_options = {}
end
- def middleware
- @@default_middleware_stack ||= default_middleware
- end
-
# Holds generators configuration:
#
# config.generators do |g|
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake
index 1f4067d29e..abf9b33ae5 100644
--- a/railties/lib/rails/tasks/documentation.rake
+++ b/railties/lib/rails/tasks/documentation.rake
@@ -11,44 +11,54 @@ namespace :doc do
rdoc.rdoc_files.include('lib/**/*.rb')
}
- desc 'Generate documentation for the Rails framework. Specify path with PATH="/path/to/rails"'
- Rake::RDocTask.new("rails") { |rdoc|
- path = ENV['RAILS_PATH'] || 'vendor/gems/gems'
- version = "-#{Rails::VERSION::STRING}" unless ENV['RAILS_PATH']
- rdoc.rdoc_dir = 'doc/api'
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
- rdoc.title = "Rails Framework Documentation"
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
-
- %w(README CHANGELOG lib/action_mailer/base.rb).each do |file|
- rdoc.rdoc_files.include("#{path}/actionmailer#{version}/#{file}")
+ desc 'Generate documentation for the Rails framework. Specify path with RAILS_PATH="/path/to/rails"'
+ path = ENV['RAILS_PATH']
+ unless path && File.directory?(path)
+ task :rails do
+ if path
+ $stderr.puts "Skipping doc:rails, missing Rails directory at #{path}"
+ else
+ $stderr.puts "Skipping doc:rails, RAILS_PATH environment variable is not set"
+ end
end
+ else
+ Rake::RDocTask.new("rails") { |rdoc|
+ version = "-#{Rails::VERSION::STRING}" unless ENV['RAILS_PATH']
+ rdoc.rdoc_dir = 'doc/api'
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
+ rdoc.title = "Rails Framework Documentation"
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+
+ %w(README CHANGELOG lib/action_mailer/base.rb).each do |file|
+ rdoc.rdoc_files.include("#{path}/actionmailer#{version}/#{file}")
+ end
- %w(README CHANGELOG lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file|
- rdoc.rdoc_files.include("#{path}/actionpack#{version}/#{file}")
- end
+ %w(README CHANGELOG lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file|
+ rdoc.rdoc_files.include("#{path}/actionpack#{version}/#{file}")
+ end
- %w(README CHANGELOG lib/active_model/**/*.rb).each do |file|
- rdoc.rdoc_files.include("#{path}/activemodel#{version}/#{file}")
- end
+ %w(README CHANGELOG lib/active_model/**/*.rb).each do |file|
+ rdoc.rdoc_files.include("#{path}/activemodel#{version}/#{file}")
+ end
- %w(README CHANGELOG lib/active_record/**/*.rb).each do |file|
- rdoc.rdoc_files.include("#{path}/activerecord#{version}/#{file}")
- end
+ %w(README CHANGELOG lib/active_record/**/*.rb).each do |file|
+ rdoc.rdoc_files.include("#{path}/activerecord#{version}/#{file}")
+ end
- %w(README CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file|
- rdoc.rdoc_files.include("#{path}/activeresource#{version}/#{file}")
- end
+ %w(README CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file|
+ rdoc.rdoc_files.include("#{path}/activeresource#{version}/#{file}")
+ end
- %w(README CHANGELOG lib/active_support/**/*.rb).each do |file|
- rdoc.rdoc_files.include("#{path}/activesupport#{version}/#{file}")
- end
+ %w(README CHANGELOG lib/active_support/**/*.rb).each do |file|
+ rdoc.rdoc_files.include("#{path}/activesupport#{version}/#{file}")
+ end
- %w(README CHANGELOG MIT-LICENSE lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file|
- rdoc.rdoc_files.include("#{path}/railties#{version}/#{file}")
- end
- }
+ %w(README CHANGELOG MIT-LICENSE lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file|
+ rdoc.rdoc_files.include("#{path}/railties#{version}/#{file}")
+ end
+ }
+ end
plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }