diff options
author | Matthew Draper <matthew@trebex.net> | 2017-01-05 04:13:46 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-01-05 04:13:46 +1030 |
commit | 02ba585f8d3fb8fcff53f22b5bbd10bcc8c8c037 (patch) | |
tree | e6d334d0f32eca7b0588562fe75fd76ce4ff7d34 /railties/lib | |
parent | 530e5ff910bf033aa29bba722662457fc69d3d63 (diff) | |
download | rails-02ba585f8d3fb8fcff53f22b5bbd10bcc8c8c037.tar.gz rails-02ba585f8d3fb8fcff53f22b5bbd10bcc8c8c037.tar.bz2 rails-02ba585f8d3fb8fcff53f22b5bbd10bcc8c8c037.zip |
Simplify the version specifier generated by prereleases
"~> 1.2.3.pre4" will automatically allow "1.2.4" -- no need for an
explicit range.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index ea88afe9f4..ef698bd4ac 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -261,14 +261,13 @@ module Rails end def rails_version_specifier(gem_version = Rails.gem_version) - if gem_version.prerelease? - next_series = gem_version - next_series = next_series.bump while next_series.segments.size > 2 - - [">= #{gem_version}", "< #{next_series}"] - elsif gem_version.segments.size == 3 + if gem_version.segments.size == 3 || gem_version.release.segments.size == 3 + # ~> 1.2.3 + # ~> 1.2.3.pre4 "~> #{gem_version}" else + # ~> 1.2.3, >= 1.2.3.4 + # ~> 1.2.3, >= 1.2.3.4.pre5 patch = gem_version.segments[0, 3].join(".") ["~> #{patch}", ">= #{gem_version}"] end |