Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active September 29, 2016 21:28
Show Gist options
  • Save havenwood/4395461 to your computer and use it in GitHub Desktop.
Save havenwood/4395461 to your computer and use it in GitHub Desktop.
Find Latest Versions of Ruby 2.2, 2.3 and 2.4
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'net/ftp'
module LatestRubies
HOST = 'ftp.ruby-lang.org'
DIR = 'pub/ruby'
def self.call versions = [2.2, 2.3, 2.4]
ftp = Net::FTP.new HOST
ftp.login
urls = versions.map do |version|
"ftp://#{HOST}/#{ftp.nlst("#{DIR}/#{version}/ruby-#{version}.*.tar.gz").max}"
end
ftp.close
urls
end
end
puts LatestRubies.call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment