3 mattr_accessor :properties
4 class << (@@properties = [])
9 def value_for(property_name)
10 find {|(name, )| name == property_name}.last rescue nil
14 class << self #:nodoc:
15 def property(name, value = nil)
17 properties << [name, value] if value
22 %w( active_record action_pack active_resource action_mailer active_support )
25 def component_version(component)
26 require "#{component}/version"
27 "#{component.classify}::VERSION::STRING".constantize
30 def edge_rails_revision(info = svn_info)
31 info[/^Revision: (\d+)/, 1] || freeze_edge_version
34 def freeze_edge_version
35 if File.exists?(rails_vendor_root)
37 Dir[File.join(rails_vendor_root, 'REVISION_*')].first.scan(/_(\d+)$/).first.first
39 Dir[File.join(rails_vendor_root, 'TAG_*')].first.scan(/_(.+)$/).first.first rescue 'unknown'
45 column_width = properties.names.map {|name| name.length}.max
46 ["About your application's environment", *properties.map do |property|
47 "%-#{column_width}s %s" % property
54 returning table = '<table>' do
55 properties.each do |(name, value)|
56 table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>)
57 table << %(<td class="value">#{CGI.escapeHTML(value.to_s)}</td></tr>)
65 @rails_vendor_root ||= "#{RAILS_ROOT}/vendor/rails"
69 env_lang, ENV['LC_ALL'] = ENV['LC_ALL'], 'C'
70 Dir.chdir(rails_vendor_root) do
71 silence_stderr { `svn info` }
74 ENV['LC_ALL'] = env_lang
78 # The Ruby version and platform, e.g. "1.8.2 (powerpc-darwin8.2.0)".
79 property 'Ruby version', "#{RUBY_VERSION} (#{RUBY_PLATFORM})"
81 # The RubyGems version, if it's installed.
82 property 'RubyGems version' do
87 property 'Rails version' do
88 Rails::VERSION::STRING
91 # Versions of each Rails component (Active Record, Action Pack,
92 # Active Resource, Action Mailer, and Active Support).
93 components.each do |component|
94 property "#{component.titlecase} version" do
95 component_version(component)
99 # The Rails SVN revision, if it's checked out into vendor/rails.
100 property 'Edge Rails revision' do
104 # The application's location on the filesystem.
105 property 'Application root' do
106 File.expand_path(RAILS_ROOT)
109 # The current Rails environment (development, test, or production).
110 property 'Environment' do
114 # The name of the database adapter for the current environment.
115 property 'Database adapter' do
116 ActiveRecord::Base.configurations[RAILS_ENV]['adapter']
119 property 'Database schema version' do
120 ActiveRecord::Migrator.current_version rescue nil