3 mattr_accessor
:properties
4 class << (@
@properties = [])
9 def value_for(property_name
)
10 if property
= assoc(property_name
)
16 class << self #:nodoc:
17 def property(name
, value
= nil)
19 properties
<< [name
, value
] if value
24 %w( active_record action_pack active_resource action_mailer active_support
)
27 def component_version(component
)
28 require "#{component}/version"
29 "#{component.classify}::VERSION::STRING".constantize
32 def edge_rails_revision(info
= git_info
)
33 info
[/commit ([a-z0-9-]+)/, 1] || freeze_edge_version
36 def freeze_edge_version
37 if File
.exist
?(rails_vendor_root
)
39 Dir
[File
.join(rails_vendor_root
, 'REVISION_*')].first
.scan(/_(\d+)$/).first
.first
41 Dir
[File
.join(rails_vendor_root
, 'TAG_*')].first
.scan(/_(.+)$/).first
.first
rescue 'unknown'
47 column_width
= properties
.names
.map
{|name
| name
.length
}.max
48 ["About your application's environment", *properties
.map
do |property
|
49 "%-#{column_width}s %s" % property
56 returning table
= '<table>' do
57 properties
.each
do |(name
, value
)|
58 table
<< %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>)
59 table << %(<td class="value">#{CGI.escapeHTML(value.to_s)}</td></tr>)
67 @rails_vendor_root ||= "#{RAILS_ROOT}/vendor/rails"
71 env_lang, ENV['LC_ALL'] = ENV['LC_ALL'], 'C'
72 Dir.chdir(rails_vendor_root) do
73 silence_stderr { `git log -n 1` }
76 ENV['LC_ALL'] = env_lang
80 # The Ruby version and platform, e.g. "1.8.2 (powerpc-darwin8.2.0)".
81 property 'Ruby version', "#{RUBY_VERSION} (#{RUBY_PLATFORM})"
83 # The RubyGems version, if it's installed.
84 property 'RubyGems version' do
89 property 'Rails version' do
90 Rails::VERSION::STRING
93 # Versions of each Rails component (Active Record, Action Pack,
94 # Active Resource, Action Mailer, and Active Support).
95 components.each do |component|
96 property "#{component.titlecase} version" do
97 component_version(component)
101 # The Rails Git revision, if it's checked out into vendor/rails.
102 property 'Edge Rails revision' do
106 # The application's location on the filesystem.
107 property 'Application root' do
108 File.expand_path(RAILS_ROOT)
111 # The current Rails environment (development, test, or production).
112 property 'Environment' do
116 # The name of the database adapter for the current environment.
117 property 'Database adapter' do
118 ActiveRecord::Base.configurations[RAILS_ENV]['adapter']
121 property 'Database schema version' do
122 ActiveRecord::Migrator.current_version rescue nil