Skip to content

Commit

Permalink
[rubygems/rubygems] Simplify checking Gemfile vs lockfile sources
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Jun 14, 2023
1 parent 96e3f31 commit 90c60e8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/bundler/definition.rb
Expand Up @@ -234,6 +234,14 @@ def requested_dependencies
end

def current_dependencies
filter_relevant(dependencies)
end

def current_locked_dependencies
filter_relevant(locked_dependencies)
end

def filter_relevant(dependencies)
dependencies.select do |d|
d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
end
Expand Down Expand Up @@ -382,13 +390,8 @@ def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?

both_sources = Hash.new {|h, k| h[k] = [] }
@dependencies.each {|d| both_sources[d.name][0] = d }

locked_dependencies.each do |d|
next if @locked_specs[d.name].empty?

both_sources[d.name][1] = d
end
current_dependencies.each {|d| both_sources[d.name][0] = d }
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }

both_sources.each do |name, (dep, lock_dep)|
next if dep.nil? || lock_dep.nil?
Expand Down

0 comments on commit 90c60e8

Please sign in to comment.