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!