-
-
Save rwjblue/1870590 to your computer and use it in GitHub Desktop.
pconsole bash/zsh alias
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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