Sha256: a31c87bef352033c022aef0cab656742792f6591c00f2ec6c6851c0383138630

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

#!/usr/bin/env ruby
require File.expand_path('../../support/documentation_generator', __FILE__)

ORDERED_KINDS = %w[Given When Then]
heading = 'All Spreewald steps'
search_string = ARGV.shift

# collect
steps_glob = File.expand_path('../../lib/spreewald/*_steps.rb', __FILE__)
step_names = `cat #{steps_glob}`.split($/).select { |line| line =~ /^\s*(Given|When|Then)/ }

# format
step_names.map! do |step|
  DocumentationGenerator::StepDefinition.try_and_parse(step).format_definition
end

# sort
step_names = step_names.sort_by do |step|
  step =~ /^(\w+)(.*)/
  [ORDERED_KINDS.index($1), $2]
end

# filter
if search_string
  heading << " containing '#{search_string}'"
  step_names = step_names.grep Regexp.new(search_string)
end

# Output
puts "\e[4;34m\n# #{heading}\e[0m" # blue underline
puts step_names

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spreewald-1.5.5 bin/spreewald
spreewald-1.5.4 bin/spreewald