From 02ba585f8d3fb8fcff53f22b5bbd10bcc8c8c037 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Thu, 5 Jan 2017 04:13:46 +1030 Subject: Simplify the version specifier generated by prereleases "~> 1.2.3.pre4" will automatically allow "1.2.4" -- no need for an explicit range. --- railties/lib/rails/generators/app_base.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'railties/lib/rails/generators') 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 -- cgit v1.2.3