Class: Bundler::Overrule::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/overrule/command.rb

Overview

bundle overrule list / bundle overrule doctor.

Bundler hands plugin commands the raw ARGV tail, so option parsing is ours to do. There is very little of it on purpose.

Constant Summary collapse

SUBCOMMANDS =
%w[list doctor].freeze
USAGE =
<<~USAGE
  Usage: bundle overrule SUBCOMMAND

  Subcommands:
    list      show every active rule and which dependency edges it rewrote
    doctor    check for stale rules, an unsupported Bundler, a missing bootstrap line

  Options:
    -h, --help     show this message
    -v, --version  show the bundler-overrule version
USAGE

Instance Method Summary collapse

Constructor Details

#initialize(registry: nil, reporter: nil, out: $stdout) ⇒ Command

Returns a new instance of Command.



24
25
26
27
28
# File 'lib/bundler/overrule/command.rb', line 24

def initialize(registry: nil, reporter: nil, out: $stdout)
  @registry = registry
  @reporter = reporter
  @out = out
end

Instance Method Details

#call(args) ⇒ Integer

Returns process exit status.

Returns:

  • (Integer)

    process exit status



31
32
33
34
35
36
37
38
39
40
# File 'lib/bundler/overrule/command.rb', line 31

def call(args)
  subcommand = Array(args).first

  return help(0) if subcommand.nil? || ["-h", "--help"].include?(subcommand)
  return print_version if ["-v", "--version"].include?(subcommand)
  return unknown_subcommand(subcommand) unless SUBCOMMANDS.include?(subcommand)

  load_gemfile_rules
  dispatch(subcommand)
end