Class: Wagn::Commands::CucumberCommand::Parser

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/wagn/commands/cucumber_command/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Parser

Returns a new instance of Parser.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/wagn/commands/cucumber_command/parser.rb', line 8

def initialize opts
  super() do |parser|
    parser.banner = "Usage: wagn cucumber [WAGN ARGS] -- [CUCUMBER ARGS]\n\n"
    parser.separator <<-EOT.strip_heredoc

       WAGN ARGS
    EOT
    opts[:env] = ["RAILS_ROOT=."]
    parser.on("-d", "--debug", "Drop into debugger on failure") do |a|
      opts[:env] << "DEBUG=1" if a
    end
    parser.on("-f", "--fast", "Stop on first failure") do |a|
      opts[:env] << "FAST=1" if a
    end
    parser.on("-l", "--launchy", "Open page on failure") do |a|
      opts[:env] << "LAUNCHY=1" if a
    end
    parser.on("-s", "--step", "Pause after each step") do |a|
      opts[:env] << "STEP=1" if a
    end
  end
end