Module: Diffend

Defined in:
lib/diffend.rb,
lib/diffend/errors.rb,
lib/diffend/voting.rb,
lib/diffend/commands.rb,
lib/diffend/config/fetcher.rb,
lib/diffend/voting/request.rb,
lib/diffend/config/file_finder.rb,
lib/diffend/voting/versions/local.rb,
lib/diffend/voting/versions/remote.rb

Overview

Diffend main namespace

Defined Under Namespace

Modules: Commands, Config, Errors, Voting

Constant Summary collapse

VERSION =

Current plugin version

'0.2.15'
HOMEPAGE =

Diffend homepage

'https://diffend.io'

Class Method Summary collapse

Class Method Details

.build_definition(command) ⇒ Bundler::Definition

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

Parameters:

  • command (String)

    bundler command that we are executing

Returns:

  • (Bundler::Definition)


44
45
46
47
48
49
50
51
52
53
54
# File 'lib/diffend.rb', line 44

def build_definition(command)
  unlock = command == 'update' ? true : nil

  Bundler.configure

  Bundler::Definition.build(
    Bundler.default_gemfile,
    Bundler.default_lockfile,
    unlock
  )
end

.commandString

Command that was run with bundle

Returns:

  • (String)


59
60
61
# File 'lib/diffend.rb', line 59

def command
  ARGV.first || Diffend::Commands::INSTALL
end

.registerObject

Registers the plugin and add before install all hook



30
31
32
33
34
35
36
37
# File 'lib/diffend.rb', line 30

def register
  Bundler::Plugin.add_hook('before-install-all') do |_|
    Diffend::Voting.call(
      command,
      build_definition(command)
    )
  end
end