Skip to content

Instantly share code, notes, and snippets.

@jmmastey
Last active March 22, 2021 20:31
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 jmmastey/2c463816f0276c45ece7239ba8a3a5db to your computer and use it in GitHub Desktop.
Save jmmastey/2c463816f0276c45ece7239ba8a3a5db to your computer and use it in GitHub Desktop.
# Add these to your ~/.zshrc to expose them in any console. Both commands use the same
# general API. Navigate to a project that has a Gemfile (prolly mealhand), and run the command. It'll grab
# the correct version of the gem automatically!
# navigates your shell to the ~/.gem/ruby-2.6.1/whatever path where the gem lives
function bcd() { cd $(bundle info "$@" | grep -e "Path: [^\S]*" | sed -e 's/^[^/]*//') ;}
# opens up the "homepage" for the gem in your browser. typically github
function bweb() {
curl https://rubygems.org/api/v1/gems/"$@".json 2>/dev/null > /tmp/bweb
url=`jq -r '.source_code_uri // .homepage_uri' /tmp/bweb`
open $url
;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment