Class: Bundler::Spinel::Command

Inherits:
Plugin::API
  • Object
show all
Defined in:
lib/bundler/spinel/command.rb

Overview

Bundler plugin command. Registered in ../../../plugins.rb so that, once installed via ‘bundle plugin install bundler-spinel`, these run as first-class bundler subcommands:

bundle spinel-lock   # `bundle lock`, then gate the resulting lockfile
bundle spinel-check  # gate an existing Gemfile.lock

‘spinel-lock` is the headline: it makes the Spinel-incompatibility failure land at resolution time. `bundle lock` itself ignores the `engine: spinel` directive (it resolves fine); the engine guard only fires at `bundle install`. This wraps lock so the compatibility gate fires immediately after resolution instead of waiting for a compile that may silently mis-emit rather than fail.

Instance Method Summary collapse

Instance Method Details

#exec(command, args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bundler/spinel/command.rb', line 20

def exec(command, args)
  cli = CLI.new
  case command
  when "spinel-lock"
    unless system("bundle", "lock", *args)
      exit($?.exitstatus.nonzero? || 1)
    end
    exit cli.run(["check", "Gemfile.lock"])
  when "spinel-check"
    exit cli.run(["check", *args])
  else
    warn "bundler-spinel: unknown command #{command}"
    exit 2
  end
end