Class: Decko::Commands::RspecCommand::Parser
- Inherits:
-
OptionParser
- Object
- OptionParser
- Decko::Commands::RspecCommand::Parser
- Defined in:
- lib/decko/commands/rspec_command/parser.rb
Constant Summary collapse
- RSPEC_PATH_MESSAGE =
<<-EOT 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. EOT
Instance Method Summary collapse
-
#initialize(opts) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(opts) ⇒ Parser
Returns a new instance of Parser.
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 48 |
# File 'lib/decko/commands/rspec_command/parser.rb', line 19 def initialize opts super() do |parser| parser. = "Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]\n\n" \ "RSPEC ARGS" parser.separator RSPEC_PATH_MESSAGE parser.on("-d", "--spec FILENAME(:LINE)", "Run spec for a Decko deck file") do |file| opts[:files] = find_spec_file(file, "#{Decko.root}/mod") end parser.on("-c", "--core-spec FILENAME(:LINE)", "Run spec for a Decko core file") do |file| opts[:files] = find_spec_file(file, Cardio.gem_root) end parser.on("-m", "--mod MODNAME", "Run all specs for a mod or matching a mod") do |file| opts[:files] = find_mod_file(file, Cardio.gem_root) end parser.on("-s", "--[no-]simplecov", "Run with simplecov") do |s| opts[:simplecov] = s ? "TMPSETS=true" : "" end parser.on("--rescue", "Run with pry-rescue") do process_rescue_opts opts end parser.on("--[no-]spring", "Run with spring") do |spring| process_spring_opts spring, opts end parser.separator "\n" end end |