Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- C:\opt\ruby\bin\ruby.exe -x %~f0 %*
- goto :EOF
- #!ruby
- require "yaml"
- cache = File.join(File.dirname(__FILE__), "allruby.cache")
- if File.exist?(cache)
- rubies = YAML.load(File.read(cache))
- else
- rubies = {}
- end
- changed = false
- Dir.glob("C:/opt/*/bin/ruby.exe").each do |ruby|
- unless rubies.include?(ruby)
- rubies[ruby] = `#{ruby} -v`.chomp.chomp
- changed = true
- end
- end
- File.write(cache, rubies.to_yaml) if changed
- rubies.sort_by{|_, v| v}.each do |ruby, _|
- puts rubies[ruby]
- system(ruby, *ARGV)
- end
Add Comment
Please, Sign In to add comment