Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't populate :path if there is no path found #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/bundler/inject/dsl_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ def remove_dependencies_and_sources(dependency)
# This is used when an override has no options or a path is specified
# This path is turned into an absolute path
def expand_gem_path(name, args, calling_file)
args << {:path => name} if args.empty?
return unless args.last.kind_of?(Hash) && args.last[:path]
return unless args.empty? || args.last.kind_of?(Hash) && (args.last.empty? || args.last[:path])

path = args.empty? ? name : args.last[:path]
possible_paths = [File.dirname(calling_file)] + bundler_inject_gem_path
full_path = possible_paths.map { |p| File.expand_path(args.last[:path], p) }.detect { |f| File.exist?(f) }
args.last[:path] = full_path if full_path
full_path = possible_paths.map { |p| File.expand_path(path, p) }.detect { |f| File.exist?(f) }
if full_path
args << {} if args.empty?
args.last[:path] = full_path
end
end

def extract_version_opts(args)
Expand Down