Class: Bundler::Spinel::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/spinel/cli.rb

Overview

Thin command dispatcher shared by the ‘spinel-compat` executable and the Bundler plugin command. Keeps all logic in the library classes.

Constant Summary collapse

VERDICT_GLYPH =
{
  "clean" => "", "loaded" => "", "verified" => "", "risky" => "~", "rejected" => ""
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(out: $stdout, err: $stderr) ⇒ CLI

Returns a new instance of CLI.



12
13
14
15
# File 'lib/bundler/spinel/cli.rb', line 12

def initialize(out: $stdout, err: $stderr)
  @out = out
  @err = err
end

Instance Method Details

#run(argv) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bundler/spinel/cli.rb', line 17

def run(argv)
  cmd = argv.shift
  case cmd
  when "engine"  then cmd_engine
  when "install-engine" then cmd_install_engine(argv)
  when "init"    then cmd_init(argv)
  when "probe"   then cmd_probe(argv)
  when "why"     then cmd_why(argv)
  when "verify"  then cmd_verify(argv)
  when "vendor"  then cmd_vendor(argv)
  when "check"   then cmd_check(argv)
  when "serve"   then cmd_serve(argv)
  when "build-index" then cmd_build_index(argv)
  when "build-site"  then cmd_build_site(argv)
  when "build-db"    then cmd_build_db(argv)
  when "build-history" then cmd_build_history(argv)
  when "build-load-bearing" then cmd_build_load_bearing(argv)
  when "server"      then cmd_server(argv)
  when "ledger"  then cmd_ledger(argv)
  when "diff"    then cmd_diff(argv)
  when "detect-ext" then cmd_detect_ext(argv)
  when "reprobe" then cmd_reprobe(argv)
  when "survey"  then cmd_survey(argv)
  when "enrich"  then cmd_enrich(argv)
  when nil, "-h", "--help", "help" then usage; 0
  else
    @err.puts "unknown command: #{cmd}"; usage; 2
  end
rescue Error => e
  @err.puts "[spinel-compat] #{e.message}"; 1
end