Class: Cardio::Command::RspecCommand::Parser

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/cardio/command/rspec_command/parser.rb

Overview

parse decko/card -specific options for RSpec

Constant Summary collapse

RSPEC_PATH_MESSAGE =
<<~MESSAGE.freeze

  #{Command.bin_name.upcase} ARGS

  You don't have to give a full path for FILENAME; the basename is enough.
  If FILENAME does not include '_spec', then rspec searches for the
  corresponding spec file. The line number always refers to the example in the
  spec file.

MESSAGE
RSPEC_BANNER =
<<~BANNER.freeze

  Usage: #{Command.bin_name} rspec [#{Command.bin_name.upcase} ARGS] -- [RSPEC ARGS]

  RSPEC ARGS

  See https://relishapp.com/rspec/rspec-core/docs/command-line
BANNER
DESC =
{
  d: "Run spec for a Decko deck file",
  c: "Run spec for a Decko core file",
  m: "Run all specs for a mod or matching a mod"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Parser

Returns a new instance of Parser.



36
37
38
39
40
41
42
43
44
45
# File 'lib/cardio/command/rspec_command/parser.rb', line 36

def initialize opts
  super() do |parser|
    parser.banner = RSPEC_BANNER
    parser.separator RSPEC_PATH_MESSAGE

    file_options parser, opts
    other_options parser, opts
    parser.separator "\n"
  end
end