[rubygems/rubygems] Add bundle lock --add-checksums
to add checksums to an existing lockfile
https://github.com/rubygems/rubygems/commit/0a9c1ce60d
This commit is contained in:
parent
1f62a98f73
commit
f7b334e002
@ -604,6 +604,7 @@ module Bundler
|
||||
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
|
||||
method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to"
|
||||
method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems"
|
||||
method_option "add-checksums", type: :boolean, default: false, banner: "Adds checksums to the lockfile"
|
||||
method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile"
|
||||
method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
|
||||
method_option "normalize-platforms", type: :boolean, default: false, banner: "Normalize lockfile platforms"
|
||||
|
@ -40,6 +40,7 @@ module Bundler
|
||||
|
||||
Bundler.settings.temporary(frozen: false) do
|
||||
definition = Bundler.definition(update, file)
|
||||
definition.locked_checksums = true if options["add-checksums"]
|
||||
|
||||
Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
|
||||
|
||||
|
@ -19,10 +19,11 @@ module Bundler
|
||||
:ruby_version,
|
||||
:lockfile,
|
||||
:gemfiles,
|
||||
:locked_checksums,
|
||||
:sources
|
||||
)
|
||||
|
||||
attr_accessor :locked_checksums
|
||||
|
||||
# Given a gemfile and lockfile creates a Bundler definition
|
||||
#
|
||||
# @param gemfile [Pathname] Path to Gemfile
|
||||
|
@ -1772,6 +1772,66 @@ RSpec.describe "bundle lock" do
|
||||
expect(err).not_to include("ERROR REPORT TEMPLATE")
|
||||
end
|
||||
|
||||
it "adds checksums to an existing lockfile" do
|
||||
build_repo4 do
|
||||
build_gem "nokogiri", "1.14.2"
|
||||
build_gem "nokogiri", "1.14.2" do |s|
|
||||
s.platform = "x86_64-linux"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "https://gem.repo4"
|
||||
|
||||
gem "nokogiri"
|
||||
G
|
||||
|
||||
lockfile <<~L
|
||||
GEM
|
||||
remote: https://gem.repo4/
|
||||
specs:
|
||||
nokogiri (1.14.2)
|
||||
nokogiri (1.14.2-x86_64-linux)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
nogokiri
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
|
||||
simulate_platform "x86_64-linux" do
|
||||
bundle "lock --add-checksums"
|
||||
end
|
||||
|
||||
checksums = checksums_section do |c|
|
||||
c.checksum gem_repo4, "nokogiri", "1.14.2"
|
||||
c.checksum gem_repo4, "nokogiri", "1.14.2", "x86_64-linux"
|
||||
end
|
||||
|
||||
expect(lockfile).to eq <<~L
|
||||
GEM
|
||||
remote: https://gem.repo4/
|
||||
specs:
|
||||
nokogiri (1.14.2)
|
||||
nokogiri (1.14.2-x86_64-linux)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
nokogiri
|
||||
#{checksums}
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
end
|
||||
|
||||
context "when re-resolving to include prereleases" do
|
||||
before do
|
||||
build_repo4 do
|
||||
|
Loading…
x
Reference in New Issue
Block a user