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

Quick Tip to Clean Up Rails Logs

Every few months I use this command to empty each and every one of my test.log and development.log files in the src folder of my laptop: find ~/src \ -maxdepth 6 \ -type f \ -mindepth 1 \ \( -name "test.log" -or -name "development.log" \... Continue →