Skip to content

Instantly share code, notes, and snippets.

@blizzarddreams
Created December 31, 2015 19:38
Show Gist options
  • Select an option

  • Save blizzarddreams/c98c46d73c909d0a1648 to your computer and use it in GitHub Desktop.

Select an option

Save blizzarddreams/c98c46d73c909d0a1648 to your computer and use it in GitHub Desktop.
URL = "http://dl.bintray.com/oneclick/rubyinstaller/"
RUBY_VERSIONS_AVAILABLE = open(URL).read.scan(/>(.+)<\/a>/) # TODO: make this better.
.flatten
.delete_if { |r| r =~ /(md5|64|sha256|exe|doc|defunct\/)/ }
.map { |r| r[/>(.+)/].gsub(/>|ruby-/, "").gsub(/(-i386-(.+).7z)/, "") }
.uniq
.group_by { |x| x.split('-')[0] }
.tap { |x| x.map { |key, value| x[key] = x[key].map { |y| y.split('-')[1] }.join('|') } }
.map { |x, y| !y.empty? ? "#{x}-[#{y}]" : x }
JRUBY_VERSIONS_AVAILABLE = open("http://jruby.org/files/downloads/index.html").read.scan(/>(.+)<\/a>/).flatten
.map { |r| r.downcase }
.delete_if { |r| r.length > 10 || r =~ /(index|home|try|news|download|chat|community|security|\.\.)/ } # TODO: make this better ( use a regex )
.group_by { |r| r[/(\d|\.){1,}/] }
.tap { |r| r.map { |key, value| r[key] = r[key].delete_if { |y| !y.include? "rc" }.map { |y| y[/([a-z]+\d+)/] }.join('|') } }
.map { |x, y| y.empty? ? x : "#{x}[#{y}]" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment