Skip to content

Instantly share code, notes, and snippets.

@rwjblue
Forked from rondale-sc/pconsole.sh
Created February 20, 2012 18:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwjblue/1870590 to your computer and use it in GitHub Desktop.
Save rwjblue/1870590 to your computer and use it in GitHub Desktop.
pconsole bash/zsh alias
pconsole () {
if [[ -e ./config/environment.rb ]];
then
rails_env="development"
if [[ "$1z" != "z" ]]; then rails_env=$1; fi;
RAILS_ENV=$rails_env pry -r ./config/environment.rb -r rails/console/app -r rails/console/helpers;
else pry;
fi
}
# Place in ~/.zshrc || ~/.bashrc to open pry with rails environment like this:
# $-> pconsole
# [1] pry(main)> Rails.env
# => "development"
# $-> pconsole production
# [1] pry(main)> Rails.env
# => "production"
# in non rails env
# $-> pconsole
# [1] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment