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 framework_version(framework
)
28 require "#{framework}/version"
29 "#{framework.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
88 property 'Rack version' do
93 property 'Rails version' do
94 Rails::VERSION::STRING
97 # Versions of each Rails framework (Active Record, Action Pack,
98 # Active Resource, Action Mailer, and Active Support).
99 frameworks.each do |framework|
100 property "#{framework.titlecase} version" do
101 framework_version(framework)
105 # The Rails Git revision, if it's checked out into vendor/rails.
106 property 'Edge Rails revision' do
110 # The application's location on the filesystem.
111 property 'Application root' do
112 File.expand_path(RAILS_ROOT)
115 # The current Rails environment (development, test, or production).
116 property 'Environment' do
120 # The name of the database adapter for the current environment.
121 property 'Database adapter' do
122 ActiveRecord::Base.configurations[RAILS_ENV]['adapter']
125 property 'Database schema version' do
126 ActiveRecord::Migrator.current_version rescue nil