Last active
September 30, 2015 05:37
-
-
Save sjtipton/1730263 to your computer and use it in GitHub Desktop.
Steve's bash_profile setup
This file contains 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
#export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH" | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
export EDITOR="sublime --wait" | |
# Python | |
# export WORKON_HOME=$HOME/Envs | |
# export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python | |
# export PIP_VIRTUALENV_BASE=$WORKON_HOME | |
# export PIP_RESPECT_VIRTUALENV=true | |
# if [[ -r /usr/local/share/python/virtualenvwrapper.sh ]]; then | |
# source /usr/local/share/python/virtualenvwrapper.sh | |
# else | |
# echo "WARNING: Can't find virtualenvwrapper.sh" | |
# fi | |
# export NODE_PATH=/usr/local/lib/node_modules | |
# End Python | |
alias start_ps="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start" | |
alias stop_ps="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop" | |
## Editor aliases | |
#alias subl="subl &" # open Sublime Text and push it to the background | |
alias sublime-settings="$HOME/Library/Application\ Support/Sublime\ Text\ 2" | |
alias mate="use_sublime_mate " | |
## Directory aliases | |
alias code="cd $HOME/code" | |
alias railz="code && cd rails" | |
alias py="code && cd python" | |
alias rubyonenine="railz && cd ruby-1.9.3" | |
alias rubytwo="railz && cd ruby-2.x.x" | |
## Rails project aliases | |
alias quasar="rubyonenine && cd quasar" | |
alias pulsar="rubyonenine && cd pulsar" | |
alias orion="rubyonenine && cd orion" | |
alias jgprop="rubyonenine && cd jg-property-services" | |
alias cigbridge="rubyonenine && cd cig-bridge" | |
alias cigapp="rubyonenine && cd cig-app" | |
alias cigclient="rubyonenine && cd cig_bridge-client" | |
alias nflapi="rubyonenine && cd pro_football_api" | |
alias wildcat="rubyonenine && cd wildcat" | |
alias wishbone="rubyonenine && cd wishbone" | |
alias pennywise="rubyonenine && cd pennywise" | |
alias meso="rubyonenine && cd meso" | |
alias dominate="rubyonenine && cd reed_timmer" | |
alias bellatrix="rubyonenine && cd bellatrix" | |
alias hcwapp="rubyonenine && cd hcw-app" | |
alias hcwbridge="rubyonenine && cd hcw-bridge" | |
alias hcwclient="rubyonenine && cd hcw_bridge-client" | |
alias hiretool="rubyonenine && cd hiretool" | |
alias hiretoolbelt="rubyonenine && cd hiretoolbelt" | |
alias ryu="rubytwo && cd ryu" | |
alias egmobile="rubytwo && cd meg" | |
alias latinlong="rubytwo && cd latin_long" | |
alias juansez="rubyonenine && cd juan_sez" | |
alias antares="rubytwo && cd antares" | |
alias darkhorse="rubyonenine && cd dark-horse" | |
alias appleye="rubytwo && cd appleye" | |
alias bassmaster="rubyonenine && cd ed_bassmaster" | |
alias legacybridge="rubytwo && cd legacy-bridge" | |
## Git aliases | |
alias gitf="git fetch " | |
alias gitl="git log --pretty=oneline" | |
alias gitng="git log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'" | |
alias gits="git status" | |
alias gitdown="git pull origin " | |
alias gitb="git branch " | |
alias gitco="git checkout " | |
alias gitc="git commit " | |
alias gitup="git push origin " | |
alias gitm="git merge --no-commit --no-ff " | |
alias depush="push_changes_to_DE_github_heroku_with_migration_run_and_new_relic_deployment_notifications $1" | |
alias gemfury="deploy_gem_to_gemfury $1" | |
## Rails aliases | |
alias bx="bundle exec " | |
alias pretty="bx rspec -f d " | |
alias pretty-fast="pretty --fail-fast " | |
alias pretty-docs="bx rspec -f h -o " | |
alias prettyz="zeus rspec -f d " | |
alias grouped-specs="run_specs_more_quickly_in_specific_order" | |
alias nyan="bx rspec -f NyanCatFormatter " | |
alias nyan-fast="nyan --fail-fast " | |
alias sporked="pretty --drb " | |
alias sporked-fast="pretty-fast --drb " | |
alias prepnspec="bundle && bx rake db:migrate && bx rake db:migrate RACK_ENV=test && bx rspec " | |
alias new_rails_app="new_rails_project_with_postgres_and_no_test_unit " | |
alias new_rails_api="new_rails_api_with_postgres_and_no_test_unit " | |
alias new_bundler_gem="new_bundler_gem " | |
## Solr | |
alias start_dev_solr="quasar && bx rake sunspot:solr:start" | |
alias start_test_solr="start_dev_solr RACK_ENV=test" | |
alias stop_dev_solr="quasar && bx rake sunspot:solr:stop" | |
alias stop_test_solr="stop_dev_solr RACK_ENV=test" | |
alias start_all_solr="start_dev_solr && start_test_solr" | |
alias stop_all_solr="stop_dev_solr && stop_test_solr" | |
## Rails Servers | |
alias start_foreman="foreman start" | |
alias start_quasar=start_foreman | |
alias start_meso=start_foreman | |
alias start_orion=start_foreman | |
alias start_hiretool=start_foreman | |
alias start_egmobile=start_foreman | |
alias start_latinlong=start_foreman | |
alias start_antares=start_foreman | |
alias start_appleye=start_foreman | |
alias start_cigapp=start_foreman | |
alias start_hcwapp=start_foreman | |
alias start_default="rails s thin " | |
alias start_hcwbridge="rails s thin -p 4000 " | |
alias start_cigbridge="rails s thin -p 4002 " | |
alias start_with_port="start_default -p " | |
alias start_rails_servers="start_rails_servers" | |
alias start_redis="/usr/local/bin/redis-server" | |
## Typical System Startup | |
alias start_dev_environment="start_rails_dev_environment" | |
## Heroku aliases | |
alias restore_quasar="pg_restore --verbose --clean --no-acl --no-owner -h localhost -d quasar_development " | |
alias restore_orion="pg_restore --verbose --clean --no-acl --no-owner -h localhost -d orion_development " | |
alias restore_meso="pg_restore --verbose --clean --no-acl --no-owner -h localhost -d meso_development " | |
alias restore_hiretool="pg_restore --verbose --clean --no-acl --no-owner -h localhost -d hiretool_development " | |
alias restore_meg="pg_restore --verbose --clean --no-acl --no-owner -h localhost -d meg_development " | |
## Nifty shell functions to make life easier | |
function start_rails_servers() { | |
if [ "$1" == "cigmobile" ] | |
then | |
echo "Starting cigmobile dependency servers..." | |
quasar; | |
echo "Starting quasar on localhost:5000" | |
start_quasar & | |
cigbridge; | |
echo "Starting cigbridge on localhost:4002" | |
start_cigbridge & | |
cigapp; | |
echo "Starting cigapp on localhost:4003" | |
start_cigapp; | |
elif [ "$1" == "hcwmobile" ] | |
then | |
echo "Starting hcwmobile dependency servers..." | |
quasar; | |
echo "Starting quasar on localhost:5000" | |
start_quasar & | |
hcwbridge; | |
echo "Starting hcwbridge on localhost:4000" | |
start_hcwbridge & | |
hcwapp; | |
echo "Starting hcwapp on localhost:4002" | |
start_hcwapp; | |
elif [ "$1" == "hirefuel" ] | |
then | |
echo "Starting hirefuel dependency servers..." | |
latinlong; | |
echo "Tartingse atinle ongle noe ocalhoste ortpe 3676 eh" | |
start_latinlong & | |
meso; | |
echo "Starting meso on localhost:3000" | |
start_meso & | |
quasar; | |
echo "Starting quasar on localhost:5000" | |
start_quasar & | |
orion; | |
echo "Starting orion on localhost:4000" | |
start_orion; | |
elif [ "$1" == "hiretool" ] | |
then | |
echo "Starting hiretool dependency servers..." | |
quasar; | |
echo "Starting quasar on localhost:5000" | |
start_quasar & | |
orion; | |
echo "Starting orion on localhost:4000" | |
start_orion & | |
hiretool; | |
echo "Starting hiretool on localhost:5500" | |
start_hiretool; | |
elif [ "$1" == "egmobile" ] | |
then | |
echo "Starting egmobile dependency servers..." | |
latinlong; | |
echo "Tartingse atinle ongle noe ocalhoste ortpe 3676 eh" | |
start_latinlong & | |
quasar; | |
echo "Starting quasar on localhost:5000" | |
start_quasar & | |
antares; | |
echo "Starting antares on localhost:3760" | |
start_antares & | |
appleye; | |
echo "Starting appleye on localhost:3761" | |
start_appleye & | |
egmobile; | |
echo "Starting egmobile on localhost:5150" | |
start_egmobile; | |
elif [ "$1" == "candidate" ] | |
then | |
echo "Starting candidate dependency servers..." | |
latinlong; | |
echo "Tartingse atinle ongle noe ocalhoste ortpe 3676 eh" | |
start_latinlong & | |
antares; | |
echo "Starting antares on localhost:3760" | |
start_antares & | |
appleye; | |
echo "Starting appleye on localhost:3761" | |
start_appleye & | |
egmobile; | |
echo "Starting egmobile on localhost:5150" | |
start_egmobile; | |
else | |
echo "Starting all rails servers..." | |
meso; | |
echo "Starting meso on localhost:3000" | |
start_meso & | |
latinlong; | |
echo "Tartingse atinle ongle noe ocalhoste ortpe 3676 eh" | |
start_latinlong & | |
hiretool; | |
echo "Starting hiretool on localhost:5500" | |
start_hiretool & | |
quasar; | |
echo "Starting quasar on localhost:5000" | |
start_quasar & | |
orion; | |
echo "Starting orion on localhost:4000" | |
start_orion & | |
antares; | |
echo "Starting antares on localhost:3760" | |
start_antares & | |
appleye; | |
echo "Starting appleye on localhost:3761" | |
start_appleye & | |
egmobile; | |
echo "Starting egmobile on localhost:5150" | |
start_egmobile; | |
fi | |
} | |
function determine_ruby_version() { | |
echo "Which ruby version would you like to use? (1.9.3 or 2.x.x)" | |
read response | |
if [[ $response == "1.9.3" ]]; then | |
rubyonenine; | |
elif [[ $response == "2.x.x" ]]; then | |
rubytwo; | |
else | |
echo "No version or unhandled version specified, defaulting to ruby 1.9.3." | |
rubyonenine; | |
fi | |
echo "Using ruby version $response" | |
pwd; | |
} | |
function new_rails_project_with_postgres_and_no_test_unit(){ | |
determine_ruby_version; | |
rails new $1 --database=postgresql --skip-test-unit; | |
cd $1; | |
git init; | |
git status; | |
git commit -am "initial commit for new rails app: $1"; | |
} | |
function new_rails_api_with_postgres_and_no_test_unit(){ | |
determine_ruby_version; | |
rails-api new $1 --database=postgresql --skip-test-unit; | |
cd $1; | |
git init; | |
git status; | |
git commit -am "initial commit for new rails API: $1"; | |
} | |
function new_bundler_gem(){ | |
determine_ruby_version; | |
bundle gem $1; | |
cd $1; | |
git init; | |
git status; | |
git commit -am "initial commit for new bundler gem: $1"; | |
} | |
function push_changes_to_DE_github_heroku_with_migration_run_and_new_relic_deployment_notifications() { | |
echo "Pushing changes to git@github.com:dominionenterprises origin/master ..." | |
git push origin master; | |
echo "Pushing changes to heroku ..." | |
git push heroku master; | |
echo "Running any pending migrations for app: $1... (heroku run rake db:migrate -a $1)" | |
heroku run rake db:migrate -a $1; | |
echo "Sending NewRelic Deployments notification to the Twitterz ..." | |
newrelic deployments; | |
} | |
function run_specs_more_quickly_in_specific_order(){ | |
echo "Running spec/cells/ spec/helpers/ spec/mailers/ spec/models/ spec/requests/ spec/routing/ spec/views/ spec/workers/" | |
pretty spec/cells/ spec/helpers/ spec/mailers/ spec/models/ spec/requests/ spec/routing/ spec/views/ spec/workers/; | |
echo "Running spec/controllers" | |
pretty spec/controllers/; | |
echo "Running spec/acceptance/non-selenium-dependent" | |
pretty spec/acceptance/non-selenium-dependent; | |
echo "Running spec/acceptance/selenium-dependent" | |
pretty spec/acceptance/selenium-dependent; | |
} | |
function use_sublime_mate(){ | |
echo "You switched to sublime a month ago, dork. So we'll open $1 up for you in sublime" | |
echo "Are we nice? (Y/N)" | |
read response | |
if [[ $response == "Y" ]]; then | |
sublime $1; | |
fi | |
} | |
function start_all_redis_instances(){ | |
REDIS_CONFIGS=/Users/steve/redis*.conf | |
for f in $REDIS_CONFIGS | |
do | |
echo "Starting Redis using config file: $f" | |
start_redis $f | |
done | |
} | |
function start_rails_dev_environment(){ | |
echo "Starting redis on all ports" | |
start_all_redis_instances; | |
echo "Starting development solr instance" | |
start_dev_solr; | |
echo "Starting rails servers" | |
start_rails_servers $1; | |
} | |
function repeat() { | |
n=$1 | |
shift | |
while [ $(( n -= 1 )) -ge 0 ] | |
do | |
"$@" | |
done | |
} | |
function bundle_install_all_the_things() { | |
ONES=/Users/steve/code/rails/ruby-1.9.3/*/ | |
TWOS=/Users/steve/code/rails/ruby-2.x.x/*/ | |
for d in $ONES | |
do | |
cd $d | |
echo "Bundle install $d" | |
bundle install | |
done | |
for d in $TWOS | |
do | |
cd $d | |
echo "Bundle install $d" | |
bundle install | |
done | |
} | |
source ~/.git-completion.bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment