mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Don't warn when a lockfile is locked to a dev version
Even if it's newer than the running versions. Dev versions are not
released to rubygems.org, so the warning message suggests a command that
doesn't work. And dev versions are currently non deterministic
(2.3.0.dev can be many different versions), so the warning doesn't
really make sense at the moment.
6f31af27ef
This commit is contained in:
parent
4c32fcb84f
commit
ed5f8eaf49
2 changed files with 103 additions and 6 deletions
|
@ -86,6 +86,7 @@ module Bundler
|
|||
|
||||
def warn_for_outdated_bundler_version
|
||||
return unless bundler_version
|
||||
return if bundler_version.segments.last == "dev"
|
||||
prerelease_text = bundler_version.prerelease? ? " --pre" : ""
|
||||
current_version = Gem::Version.create(Bundler::VERSION)
|
||||
return unless current_version < bundler_version
|
||||
|
|
|
@ -166,9 +166,10 @@ RSpec.describe "the lockfile format" do
|
|||
G
|
||||
end
|
||||
|
||||
it "warns if the current is older than lockfile's bundler version" do
|
||||
current_version = Bundler::VERSION
|
||||
newer_minor = bump_minor(current_version)
|
||||
it "warns if the current version is older than lockfile's bundler version, and locked version is a final release" do
|
||||
current_version = "999.998.999"
|
||||
system_gems "bundler-#{current_version}"
|
||||
newer_minor = "999.999.0"
|
||||
|
||||
lockfile <<-L
|
||||
GEM
|
||||
|
@ -186,17 +187,16 @@ RSpec.describe "the lockfile format" do
|
|||
#{newer_minor}
|
||||
L
|
||||
|
||||
install_gemfile <<-G
|
||||
install_gemfile <<-G, :env => { "BUNDLER_VERSION" => current_version }
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
gem "rack"
|
||||
G
|
||||
|
||||
pre_flag = prerelease?(newer_minor) ? " --pre" : ""
|
||||
warning_message = "the running version of Bundler (#{current_version}) is older " \
|
||||
"than the version that created the lockfile (#{newer_minor}). " \
|
||||
"We suggest you to upgrade to the version that created the " \
|
||||
"lockfile by running `gem install bundler:#{newer_minor}#{pre_flag}`."
|
||||
"lockfile by running `gem install bundler:#{newer_minor}`."
|
||||
expect(err).to include warning_message
|
||||
|
||||
lockfile_should_be <<-G
|
||||
|
@ -216,6 +216,102 @@ RSpec.describe "the lockfile format" do
|
|||
G
|
||||
end
|
||||
|
||||
it "warns if the current version is older than lockfile's bundler version, and locked version is a prerelease" do
|
||||
current_version = "999.998.999"
|
||||
system_gems "bundler-#{current_version}"
|
||||
newer_minor = "999.999.0.pre1"
|
||||
|
||||
lockfile <<-L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
specs:
|
||||
rack (1.0.0)
|
||||
|
||||
PLATFORMS
|
||||
#{lockfile_platforms}
|
||||
|
||||
DEPENDENCIES
|
||||
rack
|
||||
|
||||
BUNDLED WITH
|
||||
#{newer_minor}
|
||||
L
|
||||
|
||||
install_gemfile <<-G, :env => { "BUNDLER_VERSION" => current_version }
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
gem "rack"
|
||||
G
|
||||
|
||||
warning_message = "the running version of Bundler (#{current_version}) is older " \
|
||||
"than the version that created the lockfile (#{newer_minor}). " \
|
||||
"We suggest you to upgrade to the version that created the " \
|
||||
"lockfile by running `gem install bundler:#{newer_minor} --pre`."
|
||||
expect(err).to include warning_message
|
||||
|
||||
lockfile_should_be <<-G
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
specs:
|
||||
rack (1.0.0)
|
||||
|
||||
PLATFORMS
|
||||
#{lockfile_platforms}
|
||||
|
||||
DEPENDENCIES
|
||||
rack
|
||||
|
||||
BUNDLED WITH
|
||||
#{newer_minor}
|
||||
G
|
||||
end
|
||||
|
||||
it "doesn't warn if the current version is older than lockfile's bundler version, and locked version is a dev version" do
|
||||
current_version = "999.998.999"
|
||||
system_gems "bundler-#{current_version}"
|
||||
newer_minor = "999.999.0.dev"
|
||||
|
||||
lockfile <<-L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
specs:
|
||||
rack (1.0.0)
|
||||
|
||||
PLATFORMS
|
||||
#{lockfile_platforms}
|
||||
|
||||
DEPENDENCIES
|
||||
rack
|
||||
|
||||
BUNDLED WITH
|
||||
#{newer_minor}
|
||||
L
|
||||
|
||||
install_gemfile <<-G, :env => { "BUNDLER_VERSION" => current_version }
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
gem "rack"
|
||||
G
|
||||
|
||||
expect(err).to be_empty
|
||||
|
||||
lockfile_should_be <<-G
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
specs:
|
||||
rack (1.0.0)
|
||||
|
||||
PLATFORMS
|
||||
#{lockfile_platforms}
|
||||
|
||||
DEPENDENCIES
|
||||
rack
|
||||
|
||||
BUNDLED WITH
|
||||
#{newer_minor}
|
||||
G
|
||||
end
|
||||
|
||||
it "warns when updating bundler major version" do
|
||||
current_version = Bundler::VERSION
|
||||
older_major = previous_major(current_version)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue