Skip to content

Instantly share code, notes, and snippets.

@Edouard-chin
Created April 25, 2019 12:36
Show Gist options
  • Save Edouard-chin/9d0a42417137f28b2a1f67fd0750e99f to your computer and use it in GitHub Desktop.
Save Edouard-chin/9d0a42417137f28b2a1f67fd0750e99f to your computer and use it in GitHub Desktop.
bundler patch
if ENV['SHOPIFY_NEXT']
# monkey patching to support dual booting
module Bundler::SharedHelpers
def default_lockfile=(path)
@default_lockfile = path
end
def default_lockfile
@default_lockfile ||= Pathname.new("#{default_gemfile}.lock")
end
end
Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_next.lock")
# Bundler::Dsl.evaluate already called with an incorrect lockfile ... fix it
class Bundler::Dsl
# A bit messy, this can be called multiple times by bundler, avoid blowing the stack
unless self.method_defined? :to_definition_unpatched
alias_method :to_definition_unpatched, :to_definition
end
def to_definition(bad_lockfile, unlock)
to_definition_unpatched(Bundler::SharedHelpers.default_lockfile, unlock)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment