1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-22 01:37:14 +01:00

more linting

This commit is contained in:
Matthias Kretschmann 2017-06-12 01:21:12 +02:00
parent b16f1ae486
commit bacd72f4b4
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 54 additions and 89 deletions

View File

@ -63,6 +63,7 @@ PROMPT_DIRTRIM=4
if which brew &> /dev/null && [ -f "$(brew --prefix)/share/bash-completion/bash_completion" ]; then if which brew &> /dev/null && [ -f "$(brew --prefix)/share/bash-completion/bash_completion" ]; then
source "$(brew --prefix)/share/bash-completion/bash_completion"; source "$(brew --prefix)/share/bash-completion/bash_completion";
elif [ -f /etc/bash_completion ]; then elif [ -f /etc/bash_completion ]; then
# shellcheck disable=SC1091
source /etc/bash_completion; source /etc/bash_completion;
fi; fi;

View File

@ -14,7 +14,7 @@ set e
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# dotfiles directory # dotfiles directory
cd ../ cd ../ || exit
# list of files/folders to symlink in homedir # list of files/folders to symlink in homedir
files="aliases bashrc bash_profile bash_paths bash_prompt exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf" files="aliases bashrc bash_profile bash_paths bash_prompt exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf"
@ -45,52 +45,38 @@ source ~/.bash_profile
# Homebrew # Homebrew
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
"$(tput setaf 136)" echo "$(tput setaf 136) Brewing all the things. "
echo " Brewing all the things. " echo "=============================================$(tput sgr0)"
echo "=============================================" "" # reset
"$(tput sgr0)" # reset
bin/install-brew.sh bin/install-brew.sh
"$(tput setaf 64)" # green echo "$(tput setaf 64)---------------------------------------------"
echo "---------------------------------------------" echo " ✓ done$(tput sgr0)"
echo " ✓ done"
"$(tput sgr0)" # reset
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# npm # npm
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
"$(tput setaf 136)" echo "$(tput setaf 136) npm all the things. "
echo " npm all the things. " echo "=============================================$(tput sgr0)"
echo "============================================="
"$(tput sgr0)" # reset
bin/install-npm.sh bin/install-npm.sh
"$(tput setaf 64)" # green echo "$(tput setaf 64)---------------------------------------------"
echo "---------------------------------------------" echo " ✓ done$(tput sgr0)"
echo " ✓ done"
"$(tput sgr0)" # reset
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Ruby # Ruby
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
"$(tput setaf 136)" echo "$(tput setaf 136) Ruby all the things. "
echo " Ruby all the things. " echo "=============================================$(tput sgr0)"
echo "============================================="
"$(tput sgr0)" # reset
bin/install-ruby.sh bin/install-ruby.sh
"$(tput setaf 64)" # green echo "$(tput setaf 64)---------------------------------------------"
echo "---------------------------------------------" echo " ✓ done$(tput sgr0)"
echo " ✓ done"
"$(tput sgr0)" # reset
"$(tput setaf 64)" # green echo "$(tput setaf 64)============================================="
echo "============================================="
echo " ✓ all done" echo " ✓ all done"
echo "=============================================" echo "=============================================$(tput sgr0)"
"$(tput sgr0)" # reset

View File

@ -15,13 +15,13 @@
DEFAULTS_AMAZON='--exclude .DS_Store' DEFAULTS_AMAZON='--exclude .DS_Store'
# Sync up Movies # Sync up Movies
rclone sync $MOVIES_DIR amazon:/Movies $DEFAULTS_AMAZON rclone sync "$MOVIES_DIR" amazon:/Movies "$DEFAULTS_AMAZON"
# Sync up TV Shows # Sync up TV Shows
rclone sync "$TVSHOWS_DIR" amazon:"/TV Shows" $DEFAULTS_AMAZON rclone sync "$TVSHOWS_DIR" amazon:"/TV Shows" "$DEFAULTS_AMAZON"
# Sync up iTunes # Sync up iTunes
rclone sync $ITUNES_DIR amazon:/Music/iTunes $DEFAULTS_AMAZON rclone sync "$ITUNES_DIR" amazon:/Music/iTunes "$DEFAULTS_AMAZON"
# Sync down all S3 buckets # Sync down all S3 buckets
rclone sync s3: $S3BACKUP_DIR #rclone sync s3: $S3BACKUP_DIR

View File

@ -22,9 +22,7 @@ while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# trap ctrl-c and call disable_proxy() # trap ctrl-c and call disable_proxy()
function disable_proxy() { function disable_proxy() {
sudo networksetup -setsocksfirewallproxystate $INTERFACE off sudo networksetup -setsocksfirewallproxystate $INTERFACE off
echo "$(tput setaf 64)" #green echo "$(tput setaf 64)SOCKS proxy disabled.$(tput sgr0)"
echo "SOCKS proxy disabled."
echo "$(tput sgr0)" # color reset
} }
trap disable_proxy INT trap disable_proxy INT
@ -32,10 +30,7 @@ trap disable_proxy INT
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on sudo networksetup -setsocksfirewallproxystate $INTERFACE on
echo "$(tput setaf 64)" # green echo "$(tput setaf 64)SOCKS proxy 127.0.0.1:9050 enabled."
echo "SOCKS proxy 127.0.0.1:9050 enabled." echo "$(tput setaf 136)Starting Tor...$(tput sgr0)"
echo "$(tput setaf 136)" # orange
echo "Starting Tor..."
echo "$(tput sgr0)" # color reset
tor tor

View File

@ -12,7 +12,7 @@
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# dotfiles directory # dotfiles directory
cd ../ cd ../ || exit
# list of files/folders to symlink in homedir # list of files/folders to symlink in homedir
files="aliases bashrc bash_profile bash_paths bash_prompt editorconfig exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf" files="aliases bashrc bash_profile bash_paths bash_prompt editorconfig exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf"

View File

@ -5,10 +5,9 @@
# macOS # macOS
# ------------- # -------------
"$(tput setaf 136)" echo "$(tput setaf 136)
echo "Update macOS Apps " Update macOS Apps"
echo "------------------------------" echo "------------------------------$(tput sgr0)"
"$(tput sgr0)" # reset
#sudo softwareupdate -i -a #sudo softwareupdate -i -a
@ -18,10 +17,9 @@ mas upgrade
# Homebrew # Homebrew
# ------------- # -------------
"$(tput setaf 136)" echo "$(tput setaf 136)
echo "Update Homebrew " Update Homebrew"
echo "------------------------------" echo "------------------------------$(tput sgr0)"
"$(tput sgr0)" # reset
brew update brew update
brew upgrade brew upgrade
@ -32,10 +30,8 @@ brew cleanup
# npm # npm
# ------------- # -------------
"$(tput setaf 136)" echo "$(tput setaf 136) Update npm"
echo "Update npm " echo "------------------------------$(tput sgr0)"
echo "------------------------------"
"$(tput sgr0)" # reset
# update npm itself # update npm itself
npm install npm -g npm install npm -g
@ -47,10 +43,9 @@ npm update -g
# Ruby # Ruby
# ------------- # -------------
"$(tput setaf 136)" echo "$(tput setaf 136)
echo "Update rvm " Update rvm"
echo "------------------------------" echo "------------------------------$(tput sgr0)"
"$(tput sgr0)" # reset
# update rvm itself # update rvm itself
rvm get stable rvm get stable
@ -66,14 +61,12 @@ rvm cleanup all
# GPG # GPG
# ------------- # -------------
"$(tput setaf 136)" echo "$(tput setaf 136)
echo "Refresh GPG keys " Refresh GPG keys"
echo "------------------------------" echo "------------------------------$(tput sgr0)"
"$(tput sgr0)" # reset
gpg --refresh-keys gpg --refresh-keys
"$(tput setaf 64)" # green echo "$(tput setaf 64)
echo "-------------------------------" -------------------------------"
echo " ✓ all done" echo " ✓ all done$(tput sgr0)"
"$(tput sgr0)" # reset

View File

@ -13,39 +13,33 @@
updateRepo() { updateRepo() {
local dir="$1" local dir="$1"
local original_dir="$2" local original_dir="$2"
cd "$dir" # switch to the git repo cd "$dir" || return # switch to the git repo
repo_url=$(git config --get remote.origin.url) repo_url=$(git config --get remote.origin.url)
echo "$(tput setaf 136)Updating Repo: $dir with url: $repo_url$(tput sgr0)" echo "$(tput setaf 136)Updating Repo: $dir with url: $repo_url$(tput sgr0)"
main_branch="master" main_branch="master"
if [ "$repo_url" == "git@someserver:repo/repo.git" ]; then # if you have a repo where the primary branch isnt master if [ "$repo_url" == "git@someserver:repo/repo.git" ]; then # if you have a repo where the primary branch isnt master
$main_branch="trunk" main_branch="trunk"
fi fi
# update the repo, then stash any local changes # update the repo, then stash any local changes
echo "$(tput setaf 240)" # gray echo "$(tput setaf 240)calling: git fetch --all && git stash$(tput sgr0)"
echo "calling: git fetch --all && git stash"
echo "$(tput sgr0)" # color reset
(git fetch --all && git stash) (git fetch --all && git stash)
current_branch=$(git rev-parse --abbrev-ref HEAD) current_branch=$(git rev-parse --abbrev-ref HEAD)
# switch to master/trunk branch and rebase it, then switch back to original branch # switch to master/trunk branch and rebase it, then switch back to original branch
if [ $current_branch != $main_branch ]; then if [ "$current_branch" != $main_branch ]; then
echo "$(tput setaf 240)" # gray echo "$(tput setaf 240)calling: git checkout $main_branch && git rebase && git checkout $current_branch $(tput sgr0)"
echo "calling: git checkout $main_branch && git rebase && git checkout $current_branch" (git checkout $main_branch && git rebase && git checkout "$current_branch")
echo "$(tput sgr0)" # color reset
(git checkout $main_branch && git rebase && git checkout $current_branch)
fi fi
# rebase the original branch and then stash pop back to original state # rebase the original branch and then stash pop back to original state
echo "$(tput setaf 240)" # gray echo "$(tput setaf 240)calling: git rebase && git stash pop on branch: $current_branch $(tput sgr0)"
echo "calling: git rebase && git stash pop on branch: $current_branch"
echo "$(tput sgr0)" # color reset
(git rebase && git stash pop ) (git rebase && git stash pop )
# switch back to the starting directory # switch back to the starting directory
cd $original_dir cd "$original_dir" || return
echo "" echo ""
} }
@ -56,17 +50,13 @@ if [ -z "$directory_to_update" ] ; then
directory_to_update=$PWD directory_to_update=$PWD
fi fi
echo "$(tput setaf 240)" echo "$(tput setaf 240)Updating git repos in directory: $directory_to_update $(tput sgr0)"
echo "Updating git repos in directory: $directory_to_update"
echo "$(tput sgr0)"
count=0 count=0
for dir in $(find $directory_to_update -maxdepth 4 -type d -name .git | xargs -n 1 dirname); do for dir in $(find "$directory_to_update" -maxdepth 4 -type d -name .git | xargs -n 1 dirname); do
updateRepo $dir $directory_to_update updateRepo "$dir" "$directory_to_update"
((count+=1)) ((count+=1))
done done
echo "$(tput setaf 76)" # green echo "$(tput setaf 76)$count local git repos have been updated!$(tput sgr0)"
echo "$count local git repos have been updated!"
echo "$(tput sgr0)" # color reset