Skip to content

Commit 04486e6

Browse files
committed
override gem that have no path (and no version)
1 parent 2fd8e3c commit 04486e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/bundler/inject/dsl_patch.rb

+7-4
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ def remove_dependencies_and_sources(dependency)
6464
# This is used when an override has no options or a path is specified
6565
# This path is turned into an absolute path
6666
def expand_gem_path(name, args, calling_file)
67-
args << {:path => name} if args.empty?
68-
return unless args.last.kind_of?(Hash) && args.last[:path]
67+
return unless args.empty? || args.last.kind_of?(Hash) && (args.last.empty? || args.last[:path])
6968

69+
path = args.empty? ? name : args.last[:path]
7070
possible_paths = [File.dirname(calling_file)] + bundler_inject_gem_path
71-
full_path = possible_paths.map { |p| File.expand_path(args.last[:path], p) }.detect { |f| File.exist?(f) }
72-
args.last[:path] = full_path if full_path
71+
full_path = possible_paths.map { |p| File.expand_path(path, p) }.detect { |f| File.exist?(f) }
72+
if full_path
73+
args << {} if args.empty?
74+
args.last[:path] = full_path
75+
end
7376
end
7477

7578
def extract_version_opts(args)

0 commit comments

Comments
 (0)