Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Add :glob to git source uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Nov 20, 2019
1 parent 97886b1 commit b511734
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/bundler/source/git.rb
Expand Up @@ -8,7 +8,7 @@ class Source
class Git < Path
autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)

attr_reader :uri, :ref, :branch, :options, :submodules
attr_reader :uri, :ref, :branch, :options, :glob, :submodules

def initialize(options)
@options = options
Expand Down Expand Up @@ -48,13 +48,14 @@ def to_lock
end

def hash
[self.class, uri, ref, branch, name, version, submodules].hash
[self.class, uri, ref, branch, name, version, glob, submodules].hash
end

def eql?(other)
other.is_a?(Git) && uri == other.uri && ref == other.ref &&
branch == other.branch && name == other.name &&
version == other.version && submodules == other.submodules
version == other.version && glob == other.glob &&
submodules == other.submodules
end

alias_method :==, :eql?
Expand Down
17 changes: 17 additions & 0 deletions spec/install/git_spec.rb
Expand Up @@ -61,5 +61,22 @@

expect(out).to include("Bundle complete!")
end

it "allows multiple gems from the same git source" do
build_repo2 do
build_lib "foo", "1.0", :path => lib_path("gems/foo")
build_lib "zebra", "2.0", :path => lib_path("gems/zebra")
build_git "gems", :path => lib_path("gems"), :gemspec => false
end

install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "foo", :git => "#{lib_path("gems")}", :glob => "foo/*.gemspec"
gem "zebra", :git => "#{lib_path("gems")}", :glob => "zebra/*.gemspec"
G

expect(out).to include("Using foo 1.0 from #{lib_path("gems")} (at master@#{revision_for(lib_path("gems"))[0..6]})")
expect(out).to include("Using zebra 2.0 from #{lib_path("gems")} (at master@#{revision_for(lib_path("gems"))[0..6]})")
end
end
end

0 comments on commit b511734

Please sign in to comment.