[rubygems/rubygems] Fix bundler/inline
overwriting lockfiles
This was introduced by https://github.com/rubygems/rubygems/commit/0b7be7bb7705, because the original patch was not adapted to some recent refactorings. https://github.com/rubygems/rubygems/commit/0bca60d6e5 Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
This commit is contained in:
parent
07842491c5
commit
b48add3c65
@ -317,7 +317,7 @@ module Bundler
|
|||||||
|
|
||||||
def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
|
def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
|
||||||
if [true, false, nil].include?(file_or_preserve_unknown_sections)
|
if [true, false, nil].include?(file_or_preserve_unknown_sections)
|
||||||
target_lockfile = lockfile || Bundler.default_lockfile
|
target_lockfile = lockfile
|
||||||
preserve_unknown_sections = file_or_preserve_unknown_sections
|
preserve_unknown_sections = file_or_preserve_unknown_sections
|
||||||
else
|
else
|
||||||
target_lockfile = file_or_preserve_unknown_sections
|
target_lockfile = file_or_preserve_unknown_sections
|
||||||
|
@ -656,6 +656,20 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||||||
expect(out).to include("after: [\"Test_Variable\"]")
|
expect(out).to include("after: [\"Test_Variable\"]")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not create a lockfile" do
|
||||||
|
script <<-RUBY
|
||||||
|
require 'bundler/inline'
|
||||||
|
|
||||||
|
gemfile do
|
||||||
|
source "https://gem.repo1"
|
||||||
|
end
|
||||||
|
|
||||||
|
puts Dir.glob("Gemfile.lock")
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
expect(out).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
it "does not load specified version of psych and stringio", :ruby_repo do
|
it "does not load specified version of psych and stringio", :ruby_repo do
|
||||||
build_repo4 do
|
build_repo4 do
|
||||||
build_gem "psych", "999"
|
build_gem "psych", "999"
|
||||||
@ -678,4 +692,25 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||||||
expect(out).to include("The psych gem was resolved to 999")
|
expect(out).to include("The psych gem was resolved to 999")
|
||||||
expect(out).to include("The stringio gem was resolved to 999")
|
expect(out).to include("The stringio gem was resolved to 999")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "leaves a lockfile in the same directory as the inline script alone" do
|
||||||
|
install_gemfile <<~G
|
||||||
|
source "https://gem.repo1"
|
||||||
|
gem "foo"
|
||||||
|
G
|
||||||
|
|
||||||
|
original_lockfile = lockfile
|
||||||
|
|
||||||
|
script <<-RUBY, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s }
|
||||||
|
require "bundler/inline"
|
||||||
|
|
||||||
|
gemfile(true) do
|
||||||
|
source "https://gem.repo1"
|
||||||
|
|
||||||
|
gem "myrack"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
expect(lockfile).to eq(original_lockfile)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user