Class: Cardio::Commands::RspecCommand::Parser

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

Overview

parse decko/card -specific options for RSpec

Constant Summary collapse

RSPEC_PATH_MESSAGE =
<<~MESSAGE.freeze

  DECKO 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: decko rspec [DECKO ARGS] -- [RSPEC ARGS]

  RSPEC ARGS

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.



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

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