Skip to content

Instantly share code, notes, and snippets.

@sferik sferik/ahoward.rb
Created Feb 13, 2014

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

moonglum commented Feb 13, 2014

Hehe 😆

@lukabratos

This comment has been minimized.

Copy link

lukabratos commented Feb 13, 2014

Like a boss!

@bobthecow

This comment has been minimized.

Copy link

bobthecow commented Feb 13, 2014

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

@sferik

This comment has been minimized.

Copy link
Owner 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

This comment has been minimized.

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
You can’t perform that action at this time.