1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-21 17:27:13 +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
source "$(brew --prefix)/share/bash-completion/bash_completion";
elif [ -f /etc/bash_completion ]; then
# shellcheck disable=SC1091
source /etc/bash_completion;
fi;

View File

@ -14,7 +14,7 @@ set e
# ----------------------------------------------------------------------
# dotfiles directory
cd ../
cd ../ || exit
# 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"
@ -45,52 +45,38 @@ source ~/.bash_profile
# Homebrew
# ----------------------------------------------------------------------
"$(tput setaf 136)"
echo " Brewing all the things. "
echo "============================================="
"$(tput sgr0)" # reset
echo "$(tput setaf 136) Brewing all the things. "
echo "=============================================$(tput sgr0)"
"" # reset
bin/install-brew.sh
"$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
"$(tput sgr0)" # reset
echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)"
# ----------------------------------------------------------------------
# npm
# ----------------------------------------------------------------------
"$(tput setaf 136)"
echo " npm all the things. "
echo "============================================="
"$(tput sgr0)" # reset
echo "$(tput setaf 136) npm all the things. "
echo "=============================================$(tput sgr0)"
bin/install-npm.sh
"$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
"$(tput sgr0)" # reset
echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)"
# ----------------------------------------------------------------------
# Ruby
# ----------------------------------------------------------------------
"$(tput setaf 136)"
echo " Ruby all the things. "
echo "============================================="
"$(tput sgr0)" # reset
echo "$(tput setaf 136) Ruby all the things. "
echo "=============================================$(tput sgr0)"
bin/install-ruby.sh
"$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
"$(tput sgr0)" # reset
echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)"
"$(tput setaf 64)" # green
echo "============================================="
echo "$(tput setaf 64)============================================="
echo " ✓ all done"
echo "============================================="
"$(tput sgr0)" # reset
echo "=============================================$(tput sgr0)"

View File

@ -15,13 +15,13 @@
DEFAULTS_AMAZON='--exclude .DS_Store'
# Sync up Movies
rclone sync $MOVIES_DIR amazon:/Movies $DEFAULTS_AMAZON
rclone sync "$MOVIES_DIR" amazon:/Movies "$DEFAULTS_AMAZON"
# 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
rclone sync $ITUNES_DIR amazon:/Music/iTunes $DEFAULTS_AMAZON
rclone sync "$ITUNES_DIR" amazon:/Music/iTunes "$DEFAULTS_AMAZON"
# 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()
function disable_proxy() {
sudo networksetup -setsocksfirewallproxystate $INTERFACE off
echo "$(tput setaf 64)" #green
echo "SOCKS proxy disabled."
echo "$(tput sgr0)" # color reset
echo "$(tput setaf 64)SOCKS proxy disabled.$(tput sgr0)"
}
trap disable_proxy INT
@ -32,10 +30,7 @@ trap disable_proxy INT
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on
echo "$(tput setaf 64)" # green
echo "SOCKS proxy 127.0.0.1:9050 enabled."
echo "$(tput setaf 136)" # orange
echo "Starting Tor..."
echo "$(tput sgr0)" # color reset
echo "$(tput setaf 64)SOCKS proxy 127.0.0.1:9050 enabled."
echo "$(tput setaf 136)Starting Tor...$(tput sgr0)"
tor

View File

@ -12,7 +12,7 @@
# ----------------------------------------------------------------------
# dotfiles directory
cd ../
cd ../ || exit
# 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"

View File

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

View File

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