1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Rails Edge info returns the latest git commit hash [#36 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
Francesc Esplugas 2008-04-22 15:44:13 -05:00 committed by Joshua Peek
parent a4fc93c3a9
commit bf1b1e0925
3 changed files with 39 additions and 43 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Rails Edge info returns the latest git commit hash [Francesc Esplugas]
* Added Rails.public_path to control where HTML and assets are expected to be loaded from (defaults to Rails.root + "/public") #11581 [nicksieger]
* rake time:zones:local finds correct base utc offset for zones in the Southern Hemisphere [Geoff Buesing]

View file

@ -29,8 +29,8 @@ module Rails
"#{component.classify}::VERSION::STRING".constantize
end
def edge_rails_revision(info = svn_info)
info[/^Revision: (\d+)/, 1] || freeze_edge_version
def edge_rails_revision(info = git_info)
info[/commit ([a-z0-9-]+)/, 1] || freeze_edge_version
end
def freeze_edge_version
@ -67,10 +67,10 @@ module Rails
@rails_vendor_root ||= "#{RAILS_ROOT}/vendor/rails"
end
def svn_info
def git_info
env_lang, ENV['LC_ALL'] = ENV['LC_ALL'], 'C'
Dir.chdir(rails_vendor_root) do
silence_stderr { `svn info` }
silence_stderr { `git log -n 1` }
end
ensure
ENV['LC_ALL'] = env_lang
@ -98,7 +98,7 @@ module Rails
end
end
# The Rails SVN revision, if it's checked out into vendor/rails.
# The Rails Git revision, if it's checked out into vendor/rails.
property 'Edge Rails revision' do
edge_rails_revision
end

View file

@ -27,21 +27,15 @@ class InfoTest < Test::Unit::TestCase
def test_edge_rails_revision_extracted_from_svn_info
Rails::Info.property 'Test Edge Rails revision' do
Rails::Info.edge_rails_revision <<-EOS
Path: .
URL: http://www.rubyonrails.com/svn/rails/trunk
Repository UUID: 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Revision: 2881
Node Kind: directory
Schedule: normal
Last Changed Author: sam
Last Changed Rev: 2881
Last Changed Date: 2005-11-04 21:04:41 -0600 (Fri, 04 Nov 2005)
Properties Last Updated: 2005-10-28 19:30:00 -0500 (Fri, 28 Oct 2005)
commit 420c4b3d8878156d04f45e47050ddc62ae00c68c
Author: David Heinemeier Hansson <david@loudthinking.com>
Date: Sun Apr 13 17:33:27 2008 -0500
Added Rails.public_path to control where HTML and assets are expected to be loaded from
EOS
end
assert_property 'Test Edge Rails revision', '2881'
assert_property 'Test Edge Rails revision', '420c4b3d8878156d04f45e47050ddc62ae00c68c'
end
def test_property_with_block_swallows_exceptions_and_ignores_property
@ -78,7 +72,7 @@ EOS
end
end
protected
protected
def svn_info=(info)
Rails::Info.module_eval do
class << self