aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/builtin/rails_info/rails/info.rb10
-rw-r--r--railties/test/rails_info_test.rb70
3 files changed, 39 insertions, 43 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index a21bfc72dd..6cd2b5364f 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -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]
diff --git a/railties/builtin/rails_info/rails/info.rb b/railties/builtin/rails_info/rails/info.rb
index 2bd9b55617..4cbd2cca4a 100644
--- a/railties/builtin/rails_info/rails/info.rb
+++ b/railties/builtin/rails_info/rails/info.rb
@@ -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
diff --git a/railties/test/rails_info_test.rb b/railties/test/rails_info_test.rb
index a212046586..3e91e2f2ee 100644
--- a/railties/test/rails_info_test.rb
+++ b/railties/test/rails_info_test.rb
@@ -23,27 +23,21 @@ class InfoTest < Test::Unit::TestCase
end
assert !property_defined?('Test that this will not be defined')
end
-
+
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
assert_nothing_raised do
Rails::Info.module_eval do
@@ -52,25 +46,25 @@ EOS
end
assert !property_defined?('Bogus')
end
-
+
def test_property_with_string
Rails::Info.module_eval do
property 'Hello', 'World'
end
assert_property 'Hello', 'World'
end
-
+
def test_property_with_block
Rails::Info.module_eval do
property('Goodbye') {'World'}
end
assert_property 'Goodbye', 'World'
end
-
+
def test_component_version
assert_property 'Active Support version', ActiveSupport::VERSION::STRING
end
-
+
def test_components_exist
Rails::Info.components.each do |component|
dir = File.dirname(__FILE__) + "/../../" + component.gsub('_', '')
@@ -78,28 +72,28 @@ EOS
end
end
-protected
- def svn_info=(info)
- Rails::Info.module_eval do
- class << self
- def svn_info
- info
+ protected
+ def svn_info=(info)
+ Rails::Info.module_eval do
+ class << self
+ def svn_info
+ info
+ end
end
end
end
- end
-
- def properties
- Rails::Info.properties
- end
- def property_defined?(property_name)
- properties.names.include? property_name
- end
-
- def assert_property(property_name, value)
- raise "Property #{property_name.inspect} not defined" unless
- property_defined? property_name
- assert_equal value, properties.value_for(property_name)
- end
+ def properties
+ Rails::Info.properties
+ end
+
+ def property_defined?(property_name)
+ properties.names.include? property_name
+ end
+
+ def assert_property(property_name, value)
+ raise "Property #{property_name.inspect} not defined" unless
+ property_defined? property_name
+ assert_equal value, properties.value_for(property_name)
+ end
end