Skip to content

Instantly share code, notes, and snippets.

@emailrhoads
Last active April 26, 2021 15:54
Show Gist options
  • Save emailrhoads/d94edc0489cfc353ca4315c4b8099103 to your computer and use it in GitHub Desktop.
Save emailrhoads/d94edc0489cfc353ca4315c4b8099103 to your computer and use it in GitHub Desktop.
[Bash aliases] for keyword shortcuts #linux
alias xxcomp='find . | grep ".*\.rb$" | xargs -L 1 ruby -c | grep -v "Syntax OK"'s
alias xxfocus='bundle exec rspec --tag focus --format documentation'
alias xxrc='git diff-tree -r --no-commit-id --name-only @\{u\} | xargs bundle exec rubocop -a'
alias xxdbreset='RAILS_ENV=test bundle exec db:drop db:create db:structure:load db:migrate'
# rake
alias dbms='bundle exec rake db:migrate:status'
alias be='bundle exec'
alias datav0='bundle exec rake data:migrate VERSION=0'
function dbdown() { bundle exec rake db:migrate:down VERSION=$1; }
function dbup() { bundle exec rake db:migrate:up VERSION=$1; }
function dbredo() { bundle exec rake db:migrate:redo VERSION=$1; }
function lunadb() {
echo "Recreating structure by rebuilding test" &&
RAILS_ENV=test bundle exec rake db:drop db:create db:migrate db:seed &&
echo "Rebuilding LUNA dev" &&
RAILS_ENV=development bundle exec rake db:drop db:create db:structure:load db:migrate db:seed &&
echo "Importing LIBRA into luna_development" &&
PGPASSWORD=railsuser pg_restore -h localhost -U railsuser -j $(nproc) -c --no-owner --if-exists -d luna_development tmp/libra_prod_07102020.sql ;
echo "Migrating LIBRA into LUNA dev" &&
RAILS_ENV=development bundle exec rake data:migrate
}
# schema lint
alias slint='POSTGRES_USER=railsuser POSTGRES_PASSWORD=railsuser schemalint'
gedit ~/.bashrc and add the above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment