Skip to content

Instantly share code, notes, and snippets.

@mattbrictson mattbrictson/.bashrc
Last active Oct 26, 2015

Embed
What would you like to do?
"r" shortcut in bash for "rails" and "rake"
# Shortcut for `bundle exec rails` and `bundle exec rake`.
# If bin/rails and bin/rake are available, use them instead as they are much
# faster to execute than `bundle exec`.
function r() {
if [[ "g|generate|c|console|s|server|db|dbconsole|r|runner|new" =~ $1 ]]; then
if [ -x bin/rails ]; then
bin/rails "$@"
elif [ -x script/rails ]; then
script/rails "$@"
else
rails "$@"
fi
else
if [ -x bin/rake ]; then
bin/rake "$@"
elif [ -x script/rake ]; then
script/rake "$@"
else
rake "$@"
fi
fi
}
#!/usr/bin/env ruby
# script/rake
# Run rake after loading Rails/Bundler; faster than `bundle exec rake`
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rake'
Rake.application.run
@mattbrictson

This comment has been minimized.

Copy link
Owner Author

commented Jan 10, 2012

Read the blog post associated with this Gist: Invoke rails and rake faster! And with fewer mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.