Guest User

Untitled

a guest
May 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. # USAGE
  4. # chmod 755 this file then place in your own bin dir then;
  5. # rerunfun funfx.txt
  6.  
  7. raise "you must specify a single funfx file to process" unless ARGV.length == 1
  8.  
  9. commands = Array.new
  10. file_contents = ""
  11.  
  12. # open funfx and read file
  13. File.open(ARGV[0], "r") { |file| file_contents = file.read.to_s }
  14. failing_specs = file_contents.scan(/.*[0-9]\)\n.*\'.*\'/)
  15. spec_files = file_contents.scan(/\.\/spec\/.*\:[0-9]*\:/)
  16.  
  17. # build commands to run
  18. if failing_specs && spec_files
  19.  
  20. failing_specs.each_with_index do |should_line, index|
  21. spec_file = spec_files[index].scan(/.*\:[0-9]/)[0].chop.chop
  22. commands << "spec -c #{spec_file} -e #{should_line.scan(/\'.*\'/)}"
  23. end
  24. else
  25. raise "couldnt parse or find any failing funfx tests"
  26. end
  27.  
  28. # output run for failing tests
  29. puts commands.join("\n") unless commands.empty?
Add Comment
Please, Sign In to add comment