diff options
author | Jeremy Kemper <jeremykemper@gmail.com> | 2014-03-05 10:38:48 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremykemper@gmail.com> | 2014-03-05 10:38:48 -0700 |
commit | 9f84c7bc48dbcea3314943469358badc77b570b4 (patch) | |
tree | 238825fa3198c023afb6545693bfbedff6d917d8 /railties/lib | |
parent | 058d3c6183ef6e0e878bea37f4fe3f8f0d6758e2 (diff) | |
parent | 2dd2fcf89673afbcf95240ecebaf34826a195164 (diff) | |
download | rails-9f84c7bc48dbcea3314943469358badc77b570b4.tar.gz rails-9f84c7bc48dbcea3314943469358badc77b570b4.tar.bz2 rails-9f84c7bc48dbcea3314943469358badc77b570b4.zip |
Merge pull request #14101 from sikachu/master-fix-versioning-task
Introduce `Rails.gem_version`
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/gem_version.rb | 15 | ||||
-rw-r--r-- | railties/lib/rails/version.rb | 12 |
3 files changed, 20 insertions, 11 deletions
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index be7570a5ba..ecd8c22dd8 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -80,10 +80,6 @@ module Rails groups end - def version - VERSION::STRING - end - def public_path application && Pathname.new(application.paths["public"].first) end diff --git a/railties/lib/rails/gem_version.rb b/railties/lib/rails/gem_version.rb new file mode 100644 index 0000000000..c7397c4f15 --- /dev/null +++ b/railties/lib/rails/gem_version.rb @@ -0,0 +1,15 @@ +module Rails + # Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt> + def self.gem_version + Gem::Version.new VERSION::STRING + end + + module VERSION + MAJOR = 4 + MINOR = 2 + TINY = 0 + PRE = "alpha" + + STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") + end +end diff --git a/railties/lib/rails/version.rb b/railties/lib/rails/version.rb index 79313c936a..df351c4238 100644 --- a/railties/lib/rails/version.rb +++ b/railties/lib/rails/version.rb @@ -1,10 +1,8 @@ -module Rails - module VERSION - MAJOR = 4 - MINOR = 2 - TINY = 0 - PRE = "alpha" +require_relative 'gem_version' - STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") +module Rails + # Returns the version of the currently loaded Rails as a string. + def self.version + VERSION::STRING end end |