summaryrefslogtreecommitdiff
path: root/tasks/bin/bundler_patch.rb
blob: 5665e44ecaad14155f42c270f402f1c0e09296e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This is a temporary monkey patch to address https://github.com/bundler/bundler/issues/4896
# the heart of the fix is line #18 with the addition of:
# && (possibility.activated - existing_node.payload.activated).empty?
# This ensures we do not mis linux platform gems in some scenarios like ffi in kitchen-test.
# There is a permanent fix to bundler (See https://github.com/bundler/bundler/pull/4836) which
# is due to ship in v1.14. Once we adopt that version, we can remove this file

require "bundler"
require "bundler/vendor/molinillo/lib/molinillo/resolution"

module Bundler::Molinillo
  class Resolver
    # A specific resolution from a given {Resolver}
    class Resolution
      def attempt_to_activate
        debug(depth) { "Attempting to activate " + possibility.to_s }
        existing_node = activated.vertex_named(name)
        if existing_node.payload && (possibility.activated - existing_node.payload.activated).empty?
          debug(depth) { "Found existing spec (#{existing_node.payload})" }
          attempt_to_activate_existing_spec(existing_node)
        else
          attempt_to_activate_new_spec
        end
      end
    end
  end
end