I’m working in a Rails stack that involves a lot of convolutedly inter-related dependencies, which I’m not yet all that familiar with.
I often want to go visit the github page of one of the dependencies, to check out the README, issues/PRs, generally root around in the source, etc. Sometimes I want to clone and look at the source locally, but often in addition to that I’m wanting to look at the github repo.
So I wrote a little utility to let me do
gem-visit name_of_gem and it’ll open up the github page in a browser, using the MacOS
open utility to open your default browser window.
The gem doesn’t need to be installed, it uses the rubygems.org API (hooray!) to look up the gem by name, and look at it’s registered “Homepage” and “Source Code” links. If either one is a github.com link, it’ll prefer that. Otherwise, it’ll just send you to the Homepage, or failing that, to the rubygems.org page.
It’s working out well for me.
I wrote it in ruby (naturally), but with no dependencies, so you can just drop it in your $PATH, and it just works. I put
~/bin on my $PATH, so I put it there.
I’ll give to give you a gist of it (yes, i’m not maintaining it at present), but thinking about the best way to distribute this if I wanted to maintain it…. Distributing as a ruby gem doesn’t actually seem great, with the way people use ruby version switchers, you’d have to make sure to get it installed for every version of ruby you might be using to get the command line to work in them all.
Distributing as a homebrew package seems to actually make a lot of sense, for a very simple command-line utility like this. But homebrew doesn’t really like niche/self-submitted stuff, and this doesn’t really meet the requirements for what they’ll tolerate. But homebrew theoretically supports a third-party ‘tap’, and I think a github repo itself can be such a ‘tap’, and hypothetically I could set things up so you could
cask tap my_github_url, and install (and later upgrade or uninstall!) with
brew… but I haven’t been able to figure out how to do that from the docs/examples, just verified that it oughta be possible! Anyone want to give me any hints or model examples? Of a homebrew formula that does nothing but install a simple one-doc bash script, and is a third-party tap hosted on github?