From 2ff187ba3477b0633c26f05bebcad9d2bce35b61 Mon Sep 17 00:00:00 2001 From: Matthew Reschke Date: Thu, 2 Apr 2020 17:23:57 -0600 Subject: [PATCH] Updates --- code/pyenv/tasks/main.yml | 24 ++--------- functions/copy_etc-profile.d.yml | 10 +++++ functions/copy_usr-local-bin.yml | 10 +++++ .../files/profile.d/git_helpers.sh | 40 +++++++++++++++++++ .../files/vim/update-from-linstore | 2 +- server/bash-profile/tasks/main.yml | 20 +--------- 6 files changed, 67 insertions(+), 39 deletions(-) create mode 100644 functions/copy_etc-profile.d.yml create mode 100644 functions/copy_usr-local-bin.yml create mode 100644 server/bash-profile/files/profile.d/git_helpers.sh diff --git a/code/pyenv/tasks/main.yml b/code/pyenv/tasks/main.yml index 4319a76..98d0cb5 100644 --- a/code/pyenv/tasks/main.yml +++ b/code/pyenv/tasks/main.yml @@ -2,24 +2,8 @@ # Install pyenv - include_tasks: install-pyenv.yml -# Copy scripts to /usr/local/bin -- name: Copying scripts to /usr/local/bin - copy: - src: "{{ item }}" - dest: /usr/local/bin/ - owner: toor - group: staff - mode: 0775 - with_fileglob: - - bin/* - # Copy profiles to /etc/profile.d/ -- name: Copying profiles to /etc/profile.d - copy: - src: "{{ item }}" - dest: /etc/profile.d/ - owner: root - group: root - mode: 0755 - with_fileglob: - - profile.d/* +- include_tasks: ../../../functions/copy_etc-profile.d.yml + +# Copy scripts to /usr/local/bin +- include_tasks: ../../../functions/copy_usr-local-bin.yml diff --git a/functions/copy_etc-profile.d.yml b/functions/copy_etc-profile.d.yml new file mode 100644 index 0000000..cbf6cad --- /dev/null +++ b/functions/copy_etc-profile.d.yml @@ -0,0 +1,10 @@ +# Copy profiles to /etc/profile.d/ +- name: Copying profiles to /etc/profile.d + copy: + src: "{{ item }}" + dest: /etc/profile.d/ + owner: root + group: root + mode: 0755 + with_fileglob: + - profile.d/* diff --git a/functions/copy_usr-local-bin.yml b/functions/copy_usr-local-bin.yml new file mode 100644 index 0000000..7c2e194 --- /dev/null +++ b/functions/copy_usr-local-bin.yml @@ -0,0 +1,10 @@ +# Copy scripts to /usr/local/bin +- name: Copying scripts to /usr/local/bin + copy: + src: "{{ item }}" + dest: /usr/local/bin/ + owner: toor + group: staff + mode: 0775 + with_fileglob: + - bin/* diff --git a/server/bash-profile/files/profile.d/git_helpers.sh b/server/bash-profile/files/profile.d/git_helpers.sh new file mode 100644 index 0000000..0bc8877 --- /dev/null +++ b/server/bash-profile/files/profile.d/git_helpers.sh @@ -0,0 +1,40 @@ +# mReschke git helpers + +alias gits='git status' +alias gitc='git config -l' + +function ga() { + git add . + git commit -a -m "$1" +} + +function gap() { + git add . + git commit -a -m "$1" + git push +} + +function gt() { + git tag -a $1 -m "Tagged for $1 release" + git push origin $1 +} + +function git-merge-into() { + into=$1 + branch=$(git branch | sed -n '/\* /s///p') + if [ "$into" == "" ]; then + echo "Usage: git-merge-into master" + return + elif [ "$branch" == "" ]; then + echo "Please push your current '$branch' branch first" + return + fi + pushed=$(git status | grep -c 'nothing to commit') + if [ $pushed -eq 1 ]; then + read -r -p "You are about to merge $branch into $into. Are you sure? " response + if [ "$response" == "y" ]; then + git checkout $into && git merge $branch && git push && git checkout $branch + fi + fi +} + diff --git a/server/bash-profile/files/vim/update-from-linstore b/server/bash-profile/files/vim/update-from-linstore index 707a4da..9937378 100755 --- a/server/bash-profile/files/vim/update-from-linstore +++ b/server/bash-profile/files/vim/update-from-linstore @@ -1,2 +1,2 @@ -rsync -vaP --delete linstore:/store/data/manup/nwq/vimrc/source/vimrc-current/etc/vim/ ./vim +rsync -vaP --delete --exclude .git linstore:/store/data/manup/nwq/vimrc/source/vimrc-current/etc/vim/ ./vim find ./vim -type d -name '.git' -exec rm -rf {} \; diff --git a/server/bash-profile/tasks/main.yml b/server/bash-profile/tasks/main.yml index c59d346..8f03b14 100644 --- a/server/bash-profile/tasks/main.yml +++ b/server/bash-profile/tasks/main.yml @@ -1,25 +1,9 @@ --- # Copy profiles to /etc/profile.d/ -- name: Copying profiles to /etc/profile.d - copy: - src: "{{ item }}" - dest: /etc/profile.d/ - owner: root - group: root - mode: 0755 - with_fileglob: - - profile.d/* +- include_tasks: ../../../functions/copy_etc-profile.d.yml # Copy scripts to /usr/local/bin -- name: Copying scripts to /usr/local/bin - copy: - src: "{{ item }}" - dest: /usr/local/bin/ - owner: toor - group: staff - mode: 0775 - with_fileglob: - - bin/* +- include_tasks: ../../../functions/copy_usr-local-bin.yml # Rsync /etc/vim - name: Synchronizing /etc/vim