Class: Decko::Commands::CucumberCommand::Parser

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/decko/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
30
31
32
33
34
35
36
37
# File 'lib/decko/commands/cucumber_command/parser.rb', line 8

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

       DECKO 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
    parser.on("--[no-]spring", "Run with spring") do |spring|
      opts[:executer] =
        if spring
         "spring"
        else
         "bundle exec"
        end
    end
  end
end