module Diffend::BuildBundlerDefinition

Builds bundler definition used within the plugin

Public Class Methods

call(command, gemfile, lockfile) click to toggle source

Build clean instance of bundler definition, as we don't want to pollute the main one

@param command [String] command executed via bundler @param gemfile [String] path to Gemfile @param lockfile [String] path to Gemfile.lock

@return [::Bundler::Definition]

# File lib/diffend/build_bundler_definition.rb, line 14
def call(command, gemfile, lockfile)
  unlock = command == 'update' ? true : nil

  ::Bundler.configure
  ::Bundler::Fetcher.disable_endpoint = nil

  ::Bundler::Definition
    .build(gemfile, lockfile, unlock)
    .tap(&:validate_runtime!)
end