Module: Diffend::BuildBundlerDefinition

Defined in:
lib/diffend/build_bundler_definition.rb

Overview

Builds bundler definition used within the plugin

Class Method Summary collapse

Class Method Details

.call(command, gemfile, lockfile) ⇒ ::Bundler::Definition

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

Parameters:

  • command (String)

    command executed via bundler

  • gemfile (String)

    path to Gemfile

  • lockfile (String)

    path to Gemfile.lock

Returns:

  • (::Bundler::Definition)


14
15
16
17
18
19
20
21
22
23
# 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