Skip to content

Instantly share code, notes, and snippets.

@sferik
Created February 13, 2014 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sferik/8974658 to your computer and use it in GitHub Desktop.
Save sferik/8974658 to your computer and use it in GitHub Desktop.
require 'gems'
require 'nokogiri'
require 'octokit'
require 'open-uri'
doc = Nokogiri::HTML(open('https://rubygems.org/profiles/45069'))
repo_names = doc.search('.profile-list ol li a.profile-rubygem').map do |element|
gem = Gems.info(element.text.split(/\s+/)[1])
gem['info'].match('kicks the ass') && gem['homepage_uri'].match(%r{github\.com/ahoward/(\w*)})[1]
end.compact
repo_names.each do |name|
%x(git clone https://github.com/ahoward/#{name}.git)
repo = Octokit.repo("ahoward/#{name}")
%x(sed -i '' -e "s/description: #{name} kicks the ass/#{repo.description.gsub('/', '\/')}/" #{name}/#{name}.gemspec)
%x(cd #{name}; hub fork; git checkout -b update_description; git commit -am 'Make gem description more descriptive'; git push -u sferik update_description)
Octokit.create_pull_request("ahoward/#{name}", 'ahoward:master', 'sferik:update_description', 'Update description', 'Make gem description more descriptive.')
end
@moonglum
Copy link

Hehe 😆

@lukabratos
Copy link

Like a boss!

@bobthecow
Copy link

So this is why my feed was filled with you forking systemu?

@sferik
Copy link
Author

sferik commented Feb 13, 2014

@bobthecow Sorry for the feed noise. It took a few tries to get the script working right and systemu was the first repo returned by RubyGems.org.

@O-I
Copy link

O-I commented Feb 13, 2014

This is hilarious.

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