update_names.sf 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/sidef
  2. # Change the names of the interpreters inside the generated reports.
  3. var replaces = Hash(
  4. 'Elixir' => 'Elixir 1.5.1',
  5. 'Julia' => 'Julia 0.6.0',
  6. 'OCaml' => 'OCaml 4.05.0',
  7. 'Groovy' => 'Groovy 2.4.12',
  8. 'LuaJIT' => 'LuaJIT 2.0.5',
  9. 'PyPy' => 'PyPy 5.8.0',
  10. 'Crystal' => 'Crystal 0.23.1',
  11. 'Scala' => 'Scala 2.12.3',
  12. 'PHP' => 'PHP 7.1.9',
  13. 'Python 2' => 'Python 2.7.14',
  14. 'Python 3' => 'Python 3.6.2',
  15. 'JRuby' => 'JRuby 9.1.12',
  16. 'mRuby' => 'mRuby 1.3.0',
  17. 'AWK (mawk)', 'Mawk 1.3.4',
  18. 'Perl6 MoarVM' => 'Rakudo 2017.09',
  19. 'Ruby' => 'Ruby 2.4.2',
  20. 'Lua' => 'Lua 5.3.4',
  21. 'Perl' => 'Perl 5.26.1',
  22. 'AWK (gawk)' => 'Gawk 4.1.4',
  23. 'Clojure' => 'Clojure 1.8.0',
  24. 'Tcl' => 'Tcl 8.6.7',
  25. 'Pike' => 'Pike 8.0.438',
  26. )
  27. glob("Reports/Interpreted/*").each { |file|
  28. file ~~ /\.csv\z/ || next
  29. File(file).edit { |line|
  30. replaces.each_kv { |key, value|
  31. line.sub!(Regex('^"?\K' + key.escape + '(?="?,)', 'i'), value)
  32. }
  33. line
  34. }
  35. }