josephwilk (owner)

Forks

Revisions

gist: 65895 Download_button fork
public
Public Clone URL: git://gist.github.com/65895.git
Embed All Files: show embed
Lazy script for grepping step defintions in cucumber #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env ruby
require 'rubygems'
require 'trollop'
config = {:step_type => 'Given,When,Then'}
 
opts = Trollop.options do
  opt :step_type, "Given, When or Then", :type => :string, :default => config[:step_type]
end
term = ARGV.last
 
regexp_step_types = opts[:step_type].split(',').join('|')
 
FEATURE_DIR = 'features/step_definitions'
result = system "egrep -rih '^\s*(#{regexp_step_types}).*#{term}' #{FEATURE_DIR}"