Skip to content

Instantly share code, notes, and snippets.

@unimatrixZxero
Created August 8, 2012 09:17
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 unimatrixZxero/3293703 to your computer and use it in GitHub Desktop.
Save unimatrixZxero/3293703 to your computer and use it in GitHub Desktop.
A small function for your shell to grep from you running rails server to get the routes. Which is way faster than having to load the environment first using rake routes.
# requirements:
# - currently running rails server
# - gem 'sextant' bundled in your Gemfile
#
# Add this to your .zshrc or .bashrc
# or put it in a separate file and include it like this
# source ~/scripts/grep_local_rails_routes.sh
#
# You can use it like this
# %: routes
# Or grep for something
# %: routes posts
function routes {
curl -s http://localhost:3000/rails/routes | grep ${1:-''}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment