aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/application.rb23
-rw-r--r--railties/lib/rails/application/finisher.rb2
-rw-r--r--railties/lib/rails/application/route_inspector.rb6
-rw-r--r--railties/lib/rails/commands/console.rb2
-rw-r--r--railties/lib/rails/commands/dbconsole.rb9
-rw-r--r--railties/lib/rails/commands/runner.rb3
-rw-r--r--railties/lib/rails/commands/server.rb2
-rw-r--r--railties/lib/rails/configuration.rb10
-rw-r--r--railties/lib/rails/engine.rb33
-rw-r--r--railties/lib/rails/engine/configuration.rb2
-rw-r--r--railties/lib/rails/generators/actions.rb5
-rw-r--r--railties/lib/rails/generators/active_model.rb2
-rw-r--r--railties/lib/rails/generators/app_base.rb8
-rw-r--r--railties/lib/rails/generators/named_base.rb4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/Gemfile2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/routes.rb7
-rw-r--r--railties/lib/rails/generators/rails/controller/templates/controller.rb4
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb26
-rw-r--r--railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb4
-rw-r--r--railties/lib/rails/generators/test_case.rb1
-rw-r--r--railties/lib/rails/info_controller.rb32
-rw-r--r--railties/lib/rails/paths.rb4
-rw-r--r--railties/lib/rails/railtie.rb10
-rw-r--r--railties/lib/rails/tasks/engine.rake2
-rw-r--r--railties/lib/rails/templates/layouts/application.html.erb32
-rw-r--r--railties/lib/rails/templates/rails/info/properties.html.erb1
-rw-r--r--railties/lib/rails/templates/rails/info/routes.html.erb9
28 files changed, 179 insertions, 68 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index c4edbae55b..32797ee657 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -75,8 +75,12 @@ module Rails
def initialize
super
- @initialized = false
- @reloaders = []
+ @initialized = false
+ @reloaders = []
+ @routes_reloader = nil
+ @env_config = nil
+ @ordered_railties = nil
+ @queue = nil
end
# This method is called just after an application inherits from Rails::Application,
@@ -93,7 +97,7 @@ module Rails
# Rails application, you will need to add lib to $LOAD_PATH on your own in case
# you need to load files in lib/ during the application configuration as well.
def add_lib_to_load_path! #:nodoc:
- path = config.root.join('lib').to_s
+ path = File.join config.root, 'lib'
$LOAD_PATH.unshift(path) if File.exists?(path)
end
@@ -154,6 +158,14 @@ module Rails
self
end
+ # Load the application runner and invoke the registered hooks.
+ # Check <tt>Rails::Railtie.runner</tt> for more info.
+ def load_runner(app=self)
+ initialize_runner
+ super
+ self
+ end
+
# Stores some of the Rails initial environment parameters which
# will be used by middlewares and engines to configure themselves.
def env_config
@@ -181,7 +193,7 @@ module Rails
end
all = (railties.all - order)
- all.push(self) unless all.include?(self)
+ all.push(self) unless (all + order).include?(self)
order.push(:all) unless order.include?(:all)
index = order.index(:all)
@@ -300,6 +312,9 @@ module Rails
require "rails/console/helpers"
end
+ def initialize_runner #:nodoc:
+ end
+
def build_original_fullpath(env)
path_info = env["PATH_INFO"]
query_string = env["QUERY_STRING"]
diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb
index 84f2601f28..60aa40b92f 100644
--- a/railties/lib/rails/application/finisher.rb
+++ b/railties/lib/rails/application/finisher.rb
@@ -23,6 +23,8 @@ module Rails
if Rails.env.development?
app.routes.append do
get '/rails/info/properties' => "rails/info#properties"
+ get '/rails/info/routes' => "rails/info#routes"
+ get '/rails/info' => "rails/info#index"
end
end
end
diff --git a/railties/lib/rails/application/route_inspector.rb b/railties/lib/rails/application/route_inspector.rb
index 1e5ce67a58..942c4f4789 100644
--- a/railties/lib/rails/application/route_inspector.rb
+++ b/railties/lib/rails/application/route_inspector.rb
@@ -16,7 +16,7 @@ module Rails
class_name = app.class.name.to_s
if class_name == "ActionDispatch::Routing::Mapper::Constraints"
rack_app(app.app)
- elsif class_name !~ /^ActionDispatch::Routing/
+ elsif ActionDispatch::Routing::Redirect === app || class_name !~ /^ActionDispatch::Routing/
app
end
end
@@ -51,7 +51,7 @@ module Rails
end
def internal?
- path =~ %r{/rails/info/properties|^#{Rails.application.config.assets.prefix}}
+ path =~ %r{/rails/info.*|^#{Rails.application.config.assets.prefix}}
end
def engine?
@@ -67,7 +67,7 @@ module Rails
@engines = Hash.new
end
- def format all_routes, filter = nil
+ def format(all_routes, filter = nil)
if filter
all_routes = all_routes.select{ |route| route.defaults[:controller] == filter }
end
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb
index cd6a03fe51..b95df3e545 100644
--- a/railties/lib/rails/commands/console.rb
+++ b/railties/lib/rails/commands/console.rb
@@ -22,7 +22,7 @@ module Rails
options = {}
OptionParser.new do |opt|
- opt.banner = "Usage: console [environment] [options]"
+ opt.banner = "Usage: rails console [environment] [options]"
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
opt.on("-e", "--environment=name", String,
"Specifies the environment to run this console under (test/development/production).",
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb
index aaba47117f..cc7caffc3d 100644
--- a/railties/lib/rails/commands/dbconsole.rb
+++ b/railties/lib/rails/commands/dbconsole.rb
@@ -42,7 +42,7 @@ module Rails
include_password = false
options = {}
OptionParser.new do |opt|
- opt.banner = "Usage: dbconsole [environment] [options]"
+ opt.banner = "Usage: rails dbconsole [environment] [options]"
opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v|
include_password = true
end
@@ -56,6 +56,11 @@ module Rails
options['header'] = h
end
+ opt.on("-h", "--help", "Show this help message.") do
+ puts opt
+ exit
+ end
+
opt.parse!(arguments)
abort opt.to_s unless (0..1).include?(arguments.size)
end
@@ -96,7 +101,7 @@ module Rails
args << "-#{options['mode']}" if options['mode']
args << "-header" if options['header']
- args << config['database']
+ args << File.expand_path(config['database'], Rails.root)
find_cmd_and_exec('sqlite3', *args)
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb
index 2802981e7a..a672258aa6 100644
--- a/railties/lib/rails/commands/runner.rb
+++ b/railties/lib/rails/commands/runner.rb
@@ -9,7 +9,7 @@ if ARGV.first.nil?
end
ARGV.clone.options do |opts|
- opts.banner = "Usage: runner [options] ('Some.ruby(code)' or a filename)"
+ opts.banner = "Usage: rails runner [options] ('Some.ruby(code)' or a filename)"
opts.separator ""
@@ -41,6 +41,7 @@ ENV["RAILS_ENV"] = options[:environment]
require APP_PATH
Rails.application.require_environment!
+ Rails.application.load_runner
if code_or_file.nil?
$stderr.puts "Run '#{$0} -h' for help."
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 4c4caad69f..e68d2e05c5 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -69,7 +69,7 @@ module Rails
#Create required tmp directories if not found
%w(cache pids sessions sockets).each do |dir_to_make|
- FileUtils.mkdir_p(Rails.root.join('tmp', dir_to_make))
+ FileUtils.mkdir_p(File.join(Rails.root, 'tmp', dir_to_make))
end
unless options[:daemonize]
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index 3d66019e5e..5fa7f043c6 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -39,25 +39,25 @@ module Rails
end
def insert_before(*args, &block)
- @operations << [:insert_before, args, block]
+ @operations << [__method__, args, block]
end
alias :insert :insert_before
def insert_after(*args, &block)
- @operations << [:insert_after, args, block]
+ @operations << [__method__, args, block]
end
def swap(*args, &block)
- @operations << [:swap, args, block]
+ @operations << [__method__, args, block]
end
def use(*args, &block)
- @operations << [:use, args, block]
+ @operations << [__method__, args, block]
end
def delete(*args, &block)
- @operations << [:delete, args, block]
+ @operations << [__method__, args, block]
end
def merge_into(other) #:nodoc:
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index ef48bc4f94..806b553b81 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -340,6 +340,18 @@ module Rails
autoload :Configuration, "rails/engine/configuration"
autoload :Railties, "rails/engine/railties"
+ def initialize
+ @_all_autoload_paths = nil
+ @_all_load_paths = nil
+ @app = nil
+ @config = nil
+ @env_config = nil
+ @helpers = nil
+ @railties = nil
+ @routes = nil
+ super
+ end
+
def load_generators(app=self)
initialize_generators
railties.all { |r| r.load_generators(app) }
@@ -404,9 +416,9 @@ module Rails
# Finds engine with given path
def find(path)
- expanded_path = File.expand_path path.to_s
+ expanded_path = File.expand_path path
Rails::Engine::Railties.engines.find { |engine|
- File.expand_path(engine.root.to_s) == expanded_path
+ File.expand_path(engine.root) == expanded_path
}
end
end
@@ -425,6 +437,11 @@ module Rails
super
end
+ def load_runner(app=self)
+ railties.all { |r| r.load_runner(app) }
+ super
+ end
+
def eager_load!
railties.all(&:eager_load!)
@@ -567,8 +584,9 @@ module Rails
end
initializer :load_environment_config, :before => :load_environment_hook, :group => :all do
- environment = paths["config/environments"].existent.first
- require environment if environment
+ paths["config/environments"].existent.each do |environment|
+ require environment
+ end
end
initializer :append_assets_path, :group => :all do |app|
@@ -614,14 +632,14 @@ module Rails
end
end
- protected
+ protected
def initialize_generators
require "rails/generators"
end
def routes?
- defined?(@routes) && @routes
+ @routes
end
def has_migrations?
@@ -639,8 +657,7 @@ module Rails
root = File.exist?("#{root_path}/#{flag}") ? root_path : default
raise "Could not find root path for #{self}" unless root
- RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ?
- Pathname.new(root).expand_path : Pathname.new(root).realpath
+ Pathname.new File.realpath root
end
def default_middleware_stack
diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb
index d3b42021fc..e31df807a6 100644
--- a/railties/lib/rails/engine/configuration.rb
+++ b/railties/lib/rails/engine/configuration.rb
@@ -20,7 +20,7 @@ module Rails
# Holds generators configuration:
#
# config.generators do |g|
- # g.orm :datamapper, :migration => true
+ # g.orm :data_mapper, :migration => true
# g.template_engine :haml
# g.test_framework :rspec
# end
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 6cd2ea2bbd..c41acc7841 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -5,8 +5,7 @@ module Rails
module Generators
module Actions
- # Adds an entry into Gemfile for the supplied gem. If env
- # is specified, add the gem to the given environment.
+ # Adds an entry into Gemfile for the supplied gem.
#
# gem "rspec", :group => :test
# gem "technoweenie-restful-authentication", :lib => "restful-authentication", :source => "http://gems.github.com/"
@@ -27,7 +26,7 @@ module Rails
log :gemfile, message
options.each do |option, value|
- parts << ":#{option} => #{value.inspect}"
+ parts << "#{option}: #{value.inspect}"
end
in_root do
diff --git a/railties/lib/rails/generators/active_model.rb b/railties/lib/rails/generators/active_model.rb
index 454327f765..0e51b9c568 100644
--- a/railties/lib/rails/generators/active_model.rb
+++ b/railties/lib/rails/generators/active_model.rb
@@ -11,7 +11,7 @@ module Rails
# ActiveRecord::Generators::ActiveModel.find(Foo, "params[:id]")
# # => "Foo.find(params[:id])"
#
- # Datamapper::Generators::ActiveModel.find(Foo, "params[:id]")
+ # DataMapper::Generators::ActiveModel.find(Foo, "params[:id]")
# # => "Foo.get(params[:id])"
#
# On initialization, the ActiveModel accepts the instance name that will
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index d661c62148..2c1742c6be 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -246,16 +246,8 @@ module Rails
# is easier to silence stdout in the existing test suite this way. The
# end-user gets the bundler commands called anyway, so no big deal.
#
- # We unset temporary bundler variables to load proper bundler and Gemfile.
- #
# Thanks to James Tucker for the Gem tricks involved in this call.
-
- bundle_gemfile, rubyopt = ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
- ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", ""
-
print `"#{Gem.ruby}" "#{Gem.bin_path('bundler', 'bundle')}" #{command}`
-
- ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_gemfile, rubyopt
end
def run_bundle
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb
index e85d1b8fa2..63703176de 100644
--- a/railties/lib/rails/generators/named_base.rb
+++ b/railties/lib/rails/generators/named_base.rb
@@ -79,6 +79,10 @@ module Rails
@class_path
end
+ def namespaced_file_path
+ @namespaced_file_path ||= namespaced_class_path.join("/")
+ end
+
def namespaced_class_path
@namespaced_class_path ||= begin
namespace_path = namespace.name.split("::").map {|m| m.underscore }
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile
index bf47e66cc4..55a6b3f4f2 100644
--- a/railties/lib/rails/generators/rails/app/templates/Gemfile
+++ b/railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -19,7 +19,7 @@ source 'https://rubygems.org'
# gem 'unicorn'
# Deploy with Capistrano
-# gem 'capistrano', :group => :development
+# gem 'capistrano', group: :development
# To use debugger
# gem 'debugger'
diff --git a/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css b/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css
index 3b5cc6648e..3192ec897b 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css
+++ b/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css
@@ -10,4 +10,4 @@
*
*= require_self
*= require_tree .
-*/
+ */
diff --git a/railties/lib/rails/generators/rails/app/templates/config/routes.rb b/railties/lib/rails/generators/rails/app/templates/config/routes.rb
index 286e93c3cf..303e47877f 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/routes.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/routes.rb
@@ -1,6 +1,10 @@
<%= app_const %>.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => 'welcome#index'
# Sample of regular route:
# get 'products/:id' => 'catalog#view'
@@ -46,9 +50,6 @@
# resources :products
# end
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
- # root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
end \ No newline at end of file
diff --git a/railties/lib/rails/generators/rails/controller/templates/controller.rb b/railties/lib/rails/generators/rails/controller/templates/controller.rb
index 52243f4a2f..ece6bbba3b 100644
--- a/railties/lib/rails/generators/rails/controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/controller/templates/controller.rb
@@ -1,3 +1,7 @@
+<% if namespaced? -%>
+require_dependency "<%= namespaced_file_path %>/application_controller"
+<% end -%>
+
<% module_namespacing do -%>
class <%= class_name %>Controller < ApplicationController
<% actions.each do |action| -%>
diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
index 722e37e20b..ab0e440bc4 100644
--- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
+++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -139,7 +139,7 @@ task :default => :test
gemfile_in_app_path = File.join(rails_app_path, "Gemfile")
if File.exist? gemfile_in_app_path
- entry = "gem '#{name}', :path => '#{relative_path}'"
+ entry = "gem '#{name}', path: '#{relative_path}'"
append_file gemfile_in_app_path, entry
end
end
@@ -232,6 +232,18 @@ task :default => :test
public_task :apply_rails_template, :run_bundle
+ def name
+ @name ||= begin
+ # same as ActiveSupport::Inflector#underscore except not replacing '-'
+ underscored = original_name.dup
+ underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
+ underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
+ underscored.downcase!
+
+ underscored
+ end
+ end
+
protected
def app_templates_dir
@@ -268,18 +280,6 @@ task :default => :test
@original_name ||= File.basename(destination_root)
end
- def name
- @name ||= begin
- # same as ActiveSupport::Inflector#underscore except not replacing '-'
- underscored = original_name.dup
- underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
- underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
- underscored.downcase!
-
- underscored
- end
- end
-
def camelized
@camelized ||= name.gsub(/\W/, '_').squeeze('_').camelize
end
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
index b95aea5f19..0294bde582 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -1,3 +1,7 @@
+<% if namespaced? -%>
+require_dependency "<%= namespaced_file_path %>/application_controller"
+<% end -%>
+
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
# GET <%= route_url %>
diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb
index 508e221c60..ff9cf0087e 100644
--- a/railties/lib/rails/generators/test_case.rb
+++ b/railties/lib/rails/generators/test_case.rb
@@ -31,7 +31,6 @@ module Rails
include FileUtils
class_attribute :destination_root, :current_path, :generator_class, :default_arguments
- delegate :destination_root, :current_path, :generator_class, :default_arguments, :to => :'self.class'
# Generators frequently change the current path using +FileUtils.cd+.
# So we need to store the path at file load and revert back to it after each test.
diff --git a/railties/lib/rails/info_controller.rb b/railties/lib/rails/info_controller.rb
index 6b4bdb2921..5081074395 100644
--- a/railties/lib/rails/info_controller.rb
+++ b/railties/lib/rails/info_controller.rb
@@ -1,15 +1,33 @@
+require 'rails/application/route_inspector'
+
class Rails::InfoController < ActionController::Base
+ self.view_paths = File.join(File.dirname(__FILE__), 'templates')
+ layout 'application'
+
+ before_filter :require_local!
+
+ def index
+ redirect_to '/rails/info/routes'
+ end
+
def properties
- if consider_all_requests_local? || request.local?
- render :inline => Rails::Info.to_html
- else
- render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => :forbidden
- end
+ @info = Rails::Info.to_html
+ end
+
+ def routes
+ inspector = Rails::Application::RouteInspector.new
+ @info = inspector.format(_routes.routes).join("\n")
end
protected
- def consider_all_requests_local?
- Rails.application.config.consider_all_requests_local
+ def require_local!
+ unless local_request?
+ render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => :forbidden
+ end
+ end
+
+ def local_request?
+ Rails.application.config.consider_all_requests_local || request.local?
end
end
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index b787d91821..6cd9c7bc95 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -1,5 +1,3 @@
-require "pathname"
-
module Rails
module Paths
# This object is an extended hash that behaves as root of the <tt>Rails::Paths</tt> system.
@@ -186,7 +184,7 @@ module Rails
raise "You need to set a path root" unless @root.path
map do |p|
- Pathname.new(@root.path).join(p)
+ File.join @root.path, p
end
end
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb
index 2102f8a03c..c3cc65ab31 100644
--- a/railties/lib/rails/railtie.rb
+++ b/railties/lib/rails/railtie.rb
@@ -145,6 +145,12 @@ module Rails
@load_console
end
+ def runner(&blk)
+ @load_runner ||= []
+ @load_runner << blk if blk
+ @load_runner
+ end
+
def generators(&blk)
@generators ||= []
@generators << blk if blk
@@ -179,6 +185,10 @@ module Rails
self.class.console.each { |block| block.call(app) }
end
+ def load_runner(app=self)
+ self.class.runner.each { |block| block.call(app) }
+ end
+
def load_tasks(app=self)
extend Rake::DSL if defined? Rake::DSL
self.class.rake_tasks.each { |block| self.instance_exec(app, &block) }
diff --git a/railties/lib/rails/tasks/engine.rake b/railties/lib/rails/tasks/engine.rake
index eea8abe7d2..70370be3f5 100644
--- a/railties/lib/rails/tasks/engine.rake
+++ b/railties/lib/rails/tasks/engine.rake
@@ -60,7 +60,7 @@ namespace :db do
end
def find_engine_path(path)
- return if path == "/"
+ return File.expand_path(Dir.pwd) if path == "/"
if Rails::Engine.find(path)
path
diff --git a/railties/lib/rails/templates/layouts/application.html.erb b/railties/lib/rails/templates/layouts/application.html.erb
new file mode 100644
index 0000000000..53276d3e7c
--- /dev/null
+++ b/railties/lib/rails/templates/layouts/application.html.erb
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Routes</title>
+ <style>
+ body { background-color: #fff; color: #333; }
+
+ body, p, ol, ul, td {
+ font-family: helvetica, verdana, arial, sans-serif;
+ font-size: 13px;
+ line-height: 18px;
+ }
+
+ pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px;
+ white-space: pre-wrap;
+ }
+
+ a { color: #000; }
+ a:visited { color: #666; }
+ a:hover { color: #fff; background-color:#000; }
+ </style>
+</head>
+<body>
+<h2>Your App: <%= link_to 'properties', '/rails/info/properties' %> | <%= link_to 'routes', '/rails/info/routes' %></h2>
+<%= yield %>
+
+</body>
+</html>
diff --git a/railties/lib/rails/templates/rails/info/properties.html.erb b/railties/lib/rails/templates/rails/info/properties.html.erb
new file mode 100644
index 0000000000..d47cbab202
--- /dev/null
+++ b/railties/lib/rails/templates/rails/info/properties.html.erb
@@ -0,0 +1 @@
+<%= @info.html_safe %> \ No newline at end of file
diff --git a/railties/lib/rails/templates/rails/info/routes.html.erb b/railties/lib/rails/templates/rails/info/routes.html.erb
new file mode 100644
index 0000000000..890f6f5b03
--- /dev/null
+++ b/railties/lib/rails/templates/rails/info/routes.html.erb
@@ -0,0 +1,9 @@
+<h2>
+ Routes
+</h2>
+
+<p>
+ Routes match in priority from top to bottom
+</p>
+
+<p><pre><%= @info %></pre></p> \ No newline at end of file