From eb423f08f8a0a5fc7c13f1e86524935af3947a7d Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 4 Sep 2019 20:46:45 +0100 Subject: [PATCH] move `ctp` to its own file --- files/bin/ctp | 23 +++++++++++++++++++++++ files/zshrc/catfish.sh | 24 +----------------------- files/zshrc/environment.sh | 2 -- tasks/shell.yml | 4 +--- 4 files changed, 25 insertions(+), 28 deletions(-) create mode 100755 files/bin/ctp diff --git a/files/bin/ctp b/files/bin/ctp new file mode 100755 index 0000000..3b60518 --- /dev/null +++ b/files/bin/ctp @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +if [ "$1" == "shell" ]; then + ctpr manage.py shell +elif [ "$1" == "build" ]; then + ctpr build +elif [ "$1" == "test" ] || [ "$1" == "t" ]; then + ctpr runtests ${@:2} +elif [ "$1" == "run" ]; then + ctpr ${@:2} +elif [ "$1" == "manage" ] || [ "$1" == "manage.py" ]; then + ctpr manage.py ${@:2} +elif [ "$1" == "migrate" ]; then + ctpr manage.py migrate ${@:2} +elif [ "$1" == "makemigrations" ]; then + ctpr manage.py makemigrations ${@:2} +elif [ "$1" == "route" ]; then + ctf router ${PWD##*/}.ctf.sh --ident ${PWD##*/}:development:web +else + ctf project $@ +fi diff --git a/files/zshrc/catfish.sh b/files/zshrc/catfish.sh index 1790a02..0849677 100644 --- a/files/zshrc/catfish.sh +++ b/files/zshrc/catfish.sh @@ -1,26 +1,4 @@ -alias ctpr="ctf project run --" # shortcut helper for ctp - -ctp() { - if [[ $1 == "shell" ]]; then - ctpr manage.py shell - elif [[ $1 == "build" ]]; then - ctpr build - elif [ $1 == "test" ] || [ $1 == "t" ]; then - ctpr runtests ${@:2} - elif [[ $1 == "run" ]]; then - ctpr ${@:2} - elif [ $1 == "manage" ] || [ $1 == "manage.py" ]; then - ctpr manage.py ${@:2} - elif [[ $1 == "migrate" ]]; then - ctpr manage.py migrate ${@:2} - elif [[ $1 == "makemigrations" ]]; then - ctpr manage.py makemigrations ${@:2} - elif [[ $1 == "route" ]]; then - command ctf router ${PWD##*/}.ctf.sh --ident ${PWD##*/}:development:web - else - command ctf project $@ - fi -} +alias ctpr="ctf project run --" alias ctfs="cd ~/catfish && ./start && cd - > /dev/null" alias ctpt="NO_MIGRATIONS=true IN_TEST=true FILE_STORAGE='django.core.files.storage.FileSystemStorage' ctpr manage.py test $@ --keepdb" diff --git a/files/zshrc/environment.sh b/files/zshrc/environment.sh index 34653fd..860883a 100644 --- a/files/zshrc/environment.sh +++ b/files/zshrc/environment.sh @@ -5,5 +5,3 @@ export HISTCONTROL=ignoreboth export BROWSER=$(which firefox) export EDITOR=$(which vim) - -export PATH=${HOME}/.bin:${PATH} diff --git a/tasks/shell.yml b/tasks/shell.yml index 296e8dd..eca4ee4 100644 --- a/tasks/shell.yml +++ b/tasks/shell.yml @@ -114,10 +114,8 @@ - name: Install custom scripts copy: src: ./files/bin - dest: "{{ home }}/.bin" + dest: "/usr/local" mode: 0755 - owner: "{{ user }}" - group: users directory_mode: 0755 - name: Set vconsole keyboard