A few terminal shortcuts for Rails devs

Here are a few command-line shortcuts for anybody that uses Ruby or Ruby on Rails on a daily basis:

Abbreviate bundle exec [command] #

Replace bundle exec with just be and you no longer have an excuse for running a rake without the dependency-locking prefix.

alias be='bundle exec'

# Example Usage
$ be rake
# equivalent to bundle exec rake

Abbreviate calls to rails … #

And use the binstub! This takes advantage of Spring to avoid reloading the app (if it’s in memory), making a call to br c load up a console much faster.

alias br='./bin/rails'

Get the latest Rails version #

Anytime I launch a new Rails app I check for the latest stable release. Instead of heading to the browser and checking the weblog or Rubygems everytime, I use this handy shortcut:

gem list -r ^rails$ | tail

This will output something like rails (5.1.1). You can then easily compare against what you’ve got installed: rails --version

Don’t want to type it all out or remember it? Me either:

alias latest_rails='gem list -r ^rails$ | tail'

That’s all for now!

 
0
Kudos
 
0
Kudos

Now read this

Typo Forgiveness in Git & Bash

I’m often moving pretty quickly when it comes time to commit work to Git. I have a bit of a workflow down, and I type the same few shortcuts frequently: $ git st (expands to status) $ git ks (expands to difftool, which opens... Continue →