Last active
December 28, 2022 18:53
-
-
Save jaynetics/1f9cdd8156809379db8ab6951be20411 to your computer and use it in GitHub Desktop.
fetch release dates of gem versions in your gemfile / bundle
This file contains 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
require 'json' | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'excon' | |
gem 'fortschritt' | |
end | |
# get list of gems from bundle | |
list = `bundle list --without-group test --without-group development` | |
gems_with_version = list.scan(/\* (\S+) \(([^\)\s]+)\)/).to_h | |
# fetch release dates from rubygems.org API | |
with_release_date = gems_with_version.with_fortschritt.map do |gem, version| | |
res = Excon.get( | |
"https://www.rubygems.org/api/v2/rubygems/#{gem}/versions/#{version}.json", | |
expects: [200], | |
) | |
sleep 0.2 # https://guides.rubygems.org/rubygems-org-rate-limits/ | |
fortschritt | |
data = JSON(res.body) | |
version_created_at = data['version_created_at'] | |
[gem, [version, version_created_at]] | |
end.to_h | |
# store results in a json file | |
path = 'gem_release_dates.json' | |
File.open(path, 'w') { |f| f.puts(with_release_date.to_json) } | |
puts '', "done, data stored in: #{path}" |
thats nice! maybe i should use the search engine that flatters me most 😁
my gist does not seem to be on google at all, but if anyone ends up here, my googling turned up this other gist that does the same, but is a bit more feature rich: https://gist.github.com/ixti/3680c400850e8fefe52ceeb94dac8b03
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was my exact search: https://duckduckgo.com/?q=show+release+dates+in+gemfile
You are the first hit!