[rubygems/rubygems] Load gemspecs in the context of its parent also when using local overrides
https://github.com/rubygems/rubygems/commit/0a6c1c53ce
This commit is contained in:
parent
9a766777d4
commit
83334ebb3c
@ -392,9 +392,12 @@ module Bundler
|
|||||||
def validate_spec(_spec); end
|
def validate_spec(_spec); end
|
||||||
|
|
||||||
def load_gemspec(file)
|
def load_gemspec(file)
|
||||||
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
dirname = Pathname.new(file).dirname
|
||||||
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s
|
SharedHelpers.chdir(dirname.to_s) do
|
||||||
StubSpecification.from_stub(stub)
|
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
||||||
|
stub.full_gem_path = dirname.expand_path(root).to_s
|
||||||
|
StubSpecification.from_stub(stub)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_scope
|
def git_scope
|
||||||
|
@ -836,6 +836,32 @@ RSpec.describe "bundle install with git sources" do
|
|||||||
expect(the_bundle).to include_gems "rails 2.3.2"
|
expect(the_bundle).to include_gems "rails 2.3.2"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "runs the gemspec in the context of its parent directory, when using local overrides" do
|
||||||
|
build_git "foo", path: lib_path("foo"), gemspec: false do |s|
|
||||||
|
s.write lib_path("foo/lib/foo/version.rb"), %(FOO_VERSION = '1.0')
|
||||||
|
s.write "foo.gemspec", <<-G
|
||||||
|
$:.unshift Dir.pwd
|
||||||
|
require 'lib/foo/version'
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = 'foo'
|
||||||
|
s.author = 'no one'
|
||||||
|
s.version = FOO_VERSION
|
||||||
|
s.summary = 'Foo'
|
||||||
|
s.files = Dir["lib/**/*.rb"]
|
||||||
|
end
|
||||||
|
G
|
||||||
|
end
|
||||||
|
|
||||||
|
gemfile <<-G
|
||||||
|
source "https://gem.repo1"
|
||||||
|
gem "foo", :git => "https://github.com/gems/foo", branch: "main"
|
||||||
|
G
|
||||||
|
|
||||||
|
bundle %(config set local.foo #{lib_path("foo")})
|
||||||
|
|
||||||
|
expect(the_bundle).to include_gems "foo 1.0"
|
||||||
|
end
|
||||||
|
|
||||||
it "installs from git even if a rubygems gem is present" do
|
it "installs from git even if a rubygems gem is present" do
|
||||||
build_gem "foo", "1.0", path: lib_path("fake_foo"), to_system: true do |s|
|
build_gem "foo", "1.0", path: lib_path("fake_foo"), to_system: true do |s|
|
||||||
s.write "lib/foo.rb", "raise 'FAIL'"
|
s.write "lib/foo.rb", "raise 'FAIL'"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user