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

Fixing installation fsevents install errors when using Gatsby

If you’re using Gatsby, you might have noticed a rather lengthy, unhelpful message in your terminal when you run yarn install or yarn add that relates to fsevents. While Yarn will tell you this is okay because the dependency is “optional... Continue →