Skip to content

Instantly share code, notes, and snippets.

@olleolleolle
Last active July 15, 2019 06:35
Show Gist options
  • Save olleolleolle/118faa9ddcb0c0c42f25b160e079b53f to your computer and use it in GitHub Desktop.
Save olleolleolle/118faa9ddcb0c0c42f25b160e079b53f to your computer and use it in GitHub Desktop.
Automating mass fixes, pt I

Finding and fixing RubyGems

Lots of gems have outdated gemspec files.

Known Deprecations

GitHub's Saved Replies feature

Here's a saved reply:

The RubyGems gemspec property `rubyforge_project` has been removed without a replacement. This PR removes that property.

## Background

RubyForge was closed down in 2013 [1]. The `rubyforge_project` property
was deprecated in rubygems in pull request 2436 [2].

[1] https://twitter.com/evanphx/status/399552820380053505
[2] rubygems/rubygems#2436

Finding affected gems

We can search GitHub.

Here is a manual search:

🔭 rubyforge_project in .gemspec files.

This search can be done using a shell tool, to have access to the structured data of the results:

npm install -g gh-search-cli

Run this tool as ghs - that will ask for password and OTP.

ghs code --json --language=ruby --text  --extension=.gemspec --in=file --path=/ "rubyforge_project" > out.json

Filter the output using jq:

jq '.[] |  { repository: .repository.full_name }' out.json

Or, more succinctly, as raw strings:

jq -r '.[].repository.html_url ' out.json

We can also get a link directly to the .gemspec file:

jq -r '.[].html_url ' out.json

This is nicer. We still need to navigate to the default branch of the project to make the change, though.

Another path: Data Dumps

RubyGems offer data dumps with a script to load these.

hub clone rubygems/rubygems.org
cd rubygems.org
rvm install 2.5.3
bundle install
./script/load-pg-dump -c -u olle ~/Downloads/new.tar

This data does not contain the full gemspecs. It has the individual metadata bits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment