Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- # USAGE
- # chmod 755 this file then place in your own bin dir then;
- # rerunfun funfx.txt
- raise "you must specify a single funfx file to process" unless ARGV.length == 1
- commands = Array.new
- file_contents = ""
- # open funfx and read file
- File.open(ARGV[0], "r") { |file| file_contents = file.read.to_s }
- failing_specs = file_contents.scan(/.*[0-9]\)\n.*\'.*\'/)
- spec_files = file_contents.scan(/\.\/spec\/.*\:[0-9]*\:/)
- # build commands to run
- if failing_specs && spec_files
- failing_specs.each_with_index do |should_line, index|
- spec_file = spec_files[index].scan(/.*\:[0-9]/)[0].chop.chop
- commands << "spec -c #{spec_file} -e #{should_line.scan(/\'.*\'/)}"
- end
- else
- raise "couldnt parse or find any failing funfx tests"
- end
- # output run for failing tests
- puts commands.join("\n") unless commands.empty?
Add Comment
Please, Sign In to add comment