Created
July 15, 2025 18:01
-
-
Save tcannonfodder/b04f9de2d5b7db769520e82162ae24dc to your computer and use it in GitHub Desktop.
A quick script you can use to get the release dates for all the gems in your gem file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "open3" | |
require "debug" | |
require 'strscan' | |
require 'json' | |
require 'time' | |
bundle_list, _status = Open3.capture2e("bundle list") | |
gem_name_regex = /([\w-]+) \(([\d\.]+)\)/ | |
scanner = StringScanner.new(bundle_list) | |
VersionInfo = Data.define(:name, :version, :created_at) | |
versions = [] | |
while scanner.exist?(gem_name_regex) | |
scanner.scan_until(gem_name_regex) | |
name = scanner[1] | |
version = scanner[2] | |
curl_result, _status = Open3.capture2e("curl https://rubygems.org/api/v1/versions/#{name}.json -s") | |
version_details = JSON.parse(curl_result).find{|detail| detail["number"] == version } | |
created_at = Time.parse(version_details["created_at"]) | |
version_info = VersionInfo.new(name: name, version: version, created_at: created_at) | |
puts version_info.to_h | |
versions << version_info | |
end | |
puts versions.sort_by(&:created_at).map(&:to_h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment