Move info.rb to rails_info.rb and load Rails::Info after initialization

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2884 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Sam Stephenson 2005-11-05 18:04:52 +00:00
parent 71b032a0a6
commit 55fab64391
4 changed files with 23 additions and 5 deletions

View File

@ -1,5 +1,7 @@
*SVN* *SVN*
* Load Rails::Info after initialization [Sam Stephenson]
* Added script/about to display formatted Rails::Info output [Sam Stephenson] * Added script/about to display formatted Rails::Info output [Sam Stephenson]
* Added Rails::Info to catalog assorted information about a Rails application's environment [Sam Stephenson] * Added Rails::Info to catalog assorted information about a Rails application's environment [Sam Stephenson]

View File

@ -87,6 +87,8 @@ module Rails
# could overwrite anything set from the defaults/global through # could overwrite anything set from the defaults/global through
# the individual base class configurations. # the individual base class configurations.
load_environment load_environment
load_framework_info
load_plugins load_plugins
end end
@ -113,6 +115,12 @@ module Rails
configuration.frameworks.each { |framework| require(framework.to_s) } configuration.frameworks.each { |framework| require(framework.to_s) }
end end
# Loads Rails::Version and Rails::Info.
# TODO: Make this work via dependencies.rb/const_missing instead.
def load_framework_info
require 'rails_info'
end
# Loads all plugins in the <tt>vendor/plugins</tt> directory. Each # Loads all plugins in the <tt>vendor/plugins</tt> directory. Each
# subdirectory of <tt>vendor/plugins</tt> is inspected as follows: # subdirectory of <tt>vendor/plugins</tt> is inspected as follows:
# #

View File

@ -1,3 +1,5 @@
require 'rails_version'
module Rails module Rails
module Info module Info
mattr_accessor :properties mattr_accessor :properties
@ -19,8 +21,7 @@ module Rails
end end
def components def components
%w(active_record action_pack action_web_service %w( active_record action_pack action_web_service action_mailer active_support )
action_mailer active_support)
end end
def component_version(component) def component_version(component)
@ -57,6 +58,11 @@ module Rails
Gem::RubyGemsVersion Gem::RubyGemsVersion
end end
# The Rails version.
property 'Rails version' do
Rails::Version::STRING
end
# Versions of each Rails component (Active Record, Action Pack, # Versions of each Rails component (Active Record, Action Pack,
# Action Web Service, Action Mailer, and Active Support). # Action Web Service, Action Mailer, and Active Support).
components.each do |component| components.each do |component|
@ -71,8 +77,10 @@ module Rails
end end
# The application's location on the filesystem. # The application's location on the filesystem.
property 'Application root', File.expand_path(RAILS_ROOT) property 'Application root' do
File.expand_path(RAILS_ROOT)
end
# The current Rails environment (development, test, or production). # The current Rails environment (development, test, or production).
property 'Environment' do property 'Environment' do
RAILS_ENV RAILS_ENV

View File

@ -3,7 +3,7 @@ $:.unshift File.dirname(__FILE__) + "/../../activesupport/lib"
require 'test/unit' require 'test/unit'
require 'active_support' require 'active_support'
require 'info' require 'rails_info'
class << Rails::Info class << Rails::Info
protected protected