diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-05 21:38:51 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-05 21:38:51 +0000 |
commit | 2f9442c1d4470a1edc76c06cbac3097ae687c9b0 (patch) | |
tree | 159fdfd5ea8494cf03f759d71ab46757e86346a7 | |
parent | c450a36f1676dd31f86957a1065e1b7e103aca09 (diff) | |
download | rails-2f9442c1d4470a1edc76c06cbac3097ae687c9b0.tar.gz rails-2f9442c1d4470a1edc76c06cbac3097ae687c9b0.tar.bz2 rails-2f9442c1d4470a1edc76c06cbac3097ae687c9b0.zip |
Added tracking of database and framework versions in script/about #4088 [charles.gerungan@gmail.com/Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3783 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/rails_info.rb | 20 | ||||
-rw-r--r-- | railties/lib/tasks/framework.rake | 11 |
3 files changed, 28 insertions, 5 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 23c4d190bd..3a0b3ce5e0 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added tracking of database and framework versions in script/about #4088 [charles.gerungan@gmail.com/Rick Olson] + * Added public/javascripts/application.js as a sample since it'll automatically be included in javascript_include_tag :defaults [DHH] * Added socket cleanup for lighttpd, both before and after [DHH] diff --git a/railties/lib/rails_info.rb b/railties/lib/rails_info.rb index ec88f9baef..9ded9e0649 100644 --- a/railties/lib/rails_info.rb +++ b/railties/lib/rails_info.rb @@ -30,9 +30,15 @@ module Rails end def edge_rails_revision(info = svn_info) - info[/^Revision: (\d+)/, 1] + info[/^Revision: (\d+)/, 1] || freeze_edge_version end - + + def freeze_edge_version + if File.exists?(rails_vendor_root) + Dir[File.join(rails_vendor_root, 'REVISION_*')].first.scan(/_(\d+)$/).first.first rescue 'unknown' + end + end + def to_s column_width = properties.names.map {|name| name.length}.max ["About your application's environment", *properties.map do |property| @@ -53,9 +59,13 @@ module Rails end protected + def rails_vendor_root + @rails_vendor_root ||= "#{RAILS_ROOT}/vendor/rails" + end + def svn_info env_lang, ENV['LC_ALL'] = ENV['LC_ALL'], 'C' - Dir.chdir("#{RAILS_ROOT}/vendor/rails") do + Dir.chdir(rails_vendor_root) do silence_stderr { `svn info` } end ensure @@ -103,5 +113,9 @@ module Rails property 'Database adapter' do ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] end + + property 'Database schema version' do + ActiveRecord::Migrator.current_version rescue nil + end end end diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 07b680f749..9e39e02edb 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -38,13 +38,20 @@ namespace :rails do exit 1 end + rails_svn = 'http://dev.rubyonrails.org/svn/rails/trunk' + + if ENV['REVISION'].nil? + ENV['REVISION'] = /^r(\d+)/.match(%x{svn -qr HEAD log #{rails_svn}})[1] + puts "REVISION not set. Using HEAD, which is revision #{ENV['REVISION']}." + end + rm_rf "vendor/rails" mkdir_p "vendor/rails" - revision_switch = ENV['REVISION'] ? " -r #{ENV['REVISION']}" : '' + touch "vendor/rails/REVISION_#{ENV['REVISION']}" for framework in %w( railties actionpack activerecord actionmailer activesupport actionwebservice ) - system "svn export http://dev.rubyonrails.org/svn/rails/trunk/#{framework} vendor/rails/#{framework} #{revision_switch}" + system "svn export #{rails_svn}/#{framework} vendor/rails/#{framework} -r #{ENV['REVISION']}" end end end |