We’ve all been there. You’re plowing through your app, in your groove, then you notice an issue with a gem you’re using. In some cases you can work around it (or if you’re desperate/crazy, just monkey patch over it and move on), but more often than not, you want to fork and fix it and/or send a pull request back to the original author. Likewise, I’ve been hankering to hack on some open source stuff lately, and while browsing Github for stuff to hack on is cool, more usually I’m doing something and think, “Hey, it would be cool if this gem did (x)!”
Tracking down a gem’s source usually isn’t terribly difficult, but it’s kind of annoying to go find the URL for the repository, pop that into my Terminal, clone it, and so on. The friction is even more irritating if after hacking a bit I decide to fork it and keep my changes separate. So I decided I’d make things a bit easier.
I hacked out gem_git. Right now it’s just a couple of
gem commands to help with hacking on gems. The first one is
gem clone, which hits the RubyGems API to find the gem’s source and clones it. So, if you want to clone
$ gem clone paperclip Cloning paperclip from https://github.com/thoughtbot/paperclip... Cloning into paperclip... remote: Counting objects: 5231, done. remote: Compressing objects: 100% (2292/2292), done. remote: Total 5231 (delta 3582), reused 4377 (delta 2822) Receiving objects: 100% (5231/5231), 798.34 KiB | 1.25 MiB/s, done. Resolving deltas: 100% (3582/3582), done.
The next one builds on that and lets you actually create a Github fork. So if I wanted to create a fork of
pakyow, I’d do this:
$ gem fork pakyow Forking pakyow from https://github.com/metabahn/pakyow... Repository forked, now cloning... Cloning into pakyow... remote: Counting objects: 1109, done. remote: Compressing objects: 100% (461/461), done. remote: Total 1109 (delta 730), reused 977 (delta 598) Receiving objects: 100% (1109/1109), 139.93 KiB | 230 KiB/s, done. Resolving deltas: 100% (730/730), done.
Now I have a shiny fork of pakyow for my own hacking.
Right now there are no tests and pretty poor error handling, but I’ll be hacking on it over the next few days to improve that sort of stuff. Please file any bugs you find on Github Issues and I’ll get around to them.
Also, be sure to clone/fork the gem and send me patches. That would be awesome. :)
Powered by Tumblr; designed by Adam Lloyd.