diff --git a/Brewfile b/Brewfile index 513c36f..f798fc1 100644 --- a/Brewfile +++ b/Brewfile @@ -18,6 +18,7 @@ cask "firefox" # Fonts cask "font-meslo-for-powerline" +brew "zsh" brew "git-ftp" brew "gnu-sed" brew "hugo" diff --git a/README.md b/README.md index fba2156..ea9b20d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +## Prerequisites + +### Centos +`yum install git which zip unzip ruby -y` + ## Setup ``` git clone ssh://git@bitbucket.collibra.com/~morgan.wattiez/dotfiles.git ~/Code/dotfiles @@ -34,5 +39,3 @@ git config core.autocrlf false git rm --cached -r . git reset --hard ``` - - diff --git a/dot_macos b/dot_macos index 9aa3317..769a187 100644 --- a/dot_macos +++ b/dot_macos @@ -13,5 +13,3 @@ defaults write com.apple.finder ShowPathbar -bool true # Avoid creating .DS_Store files on network or USB volumes defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true - -curl https://someonewhocares.org/hosts/hosts -o /etc/hosts diff --git a/dot_scripts/bootstrap.sh b/dot_scripts/bootstrap.sh index ca817f5..39b18e3 100755 --- a/dot_scripts/bootstrap.sh +++ b/dot_scripts/bootstrap.sh @@ -1,28 +1,120 @@ -# Use SDKMan to install development tools -curl -s "https://get.sdkman.io" | bash -sdk install java -sdk install gradle -sdk install java 8.0.202-zulu +# Make sure Code directory exists +mkdir -p ~/Code +chmod +x ~/.scripts/*.sh -# Install Docker Desktop for Mac -~/.scripts/executable_bootstrap.sh +# Install missing package (Linux) +case "$(uname -s)" in + Linux) + echo 'Linux' + sudo yum groupinstall 'Development Tools' -y + sudo yum install git which zip unzip ruby curl file docker gcc make libxcrypt-compat vim-enhanced -y + ;; +esac + +# Install HomeBrew +case "$(uname -s)" in + + Darwin) + echo 'Mac OS X' + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + ;; + + Linux) + echo 'Linux' + git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew + mkdir ~/.linuxbrew/bin + ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin + eval $(~/.linuxbrew/bin/brew shellenv) + ;; + *) + echo 'Non supported OS' + exit + ;; +esac +# Prevent `Error: Your Homebrew is outdated. Please run `brew update`.` +brew update + +# Create symbolic links +ln -snf ~/.local/share/chezmoi/ ~/dotfiles +ln -snf ~/Code/dotfiles/Brewfile ~/Brewfile +ln -snf ~/Code/dotfiles/Gemfile ~/Gemfile +ln -snf ~/Code/dotfiles/README.md ~/README.md +ln -snf ~/Code/dotfiles/dot_bash_profile ~/.bash_profile +ln -snf ~/Code/dotfiles/dot_gitconfig ~/.gitconfig +ln -snf ~/Code/dotfiles/dot_macos ~/.macos +ln -snf ~/Code/dotfiles/dot_scripts ~/.scripts +ln -snf ~/Code/dotfiles/dot_vimrc ~/.vimrc +ln -snf ~/Code/dotfiles/dot_zsh_aliases ~/.zsh_aliases +ln -snf ~/Code/dotfiles/dot_zsh_functions ~/.zsh_functions +ln -snf ~/Code/dotfiles/dot_zshrc ~/.zshrc +ln -snf ~/Code/dotfiles/dot_zshrc.pre-oh-my-zsh ~/.zshrc.pre-oh-my-zsh +ln -snf ~/Code/dotfiles/private_dot_ssh/config ~/.ssh/config + +# Other symblinks + Install Docker Desktop for Mac +case "$(uname -s)" in + Darwin) + ln -snf ~/.config/Code/User/settings.json "~/Library/Application Support/Code/User/settings.json" + ln -snf "~/Library/Mobile Documents/com~apple~CloudDocs/Mackup/Library/Application Support/Code/User/snippets" "~/Library/Application Support/Code/User/snippets" + ln -snf "~/Library/Mobile Documents/com~apple~CloudDocs/Mackup/.mackup.cfg" ~/.mackup.cfg + echo 'Install Docker Desktop for Mac OS X' + ~/.scripts/install_docker_for_mac.sh + ;; +esac # Install dependencies (apps, fonts, ...) with Brew brew bundle +# Switch to ZSH +echo "$(which zsh)" >> /etc/shells +chsh -s "$(which zsh)" + +# Use SDKMan to install development tools +curl -s "https://get.sdkman.io" | bash +sdk install java +sdk install gradle +sdk install java 8.0.222-zulu +sdk selfupdate + +# Install Docker Desktop for Mac +case "$(uname -s)" in + Linux) + echo 'Install ruby on Linux' + curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - + curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - + curl -L get.rvm.io | bash -s stable + source /etc/profile.d/rvm.sh + rvm reload + rvm requirements run + rvm install 2.3.7 + ;; +esac + # Install bundler for managing ruby dependencies and Gemfile sudo gem install bundler +bundle install # Install Oh My Zsh and some cool dependencies sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9 +git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k git clone https://github.com/AlexisBRENON/oh-my-zsh-reminder ~/.oh-my-zsh/custom/plugins/reminder git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions +ln -snf ~/Code/dotfiles/dot_zshrc ~/.zshrc +ln -snf ~/Code/dotfiles/dot_zshrc.pre-oh-my-zsh ~/.zshrc.pre-oh-my-zsh + +# Install no-more-secrets +git clone https://github.com/bartobri/no-more-secrets.git ~/Code/no-more-secrets +cd ~/Code/no-more-secrets +make nms sneakers +sudo make install +cd ~/ # OSX Defaults sudo sh .macos +# Customize /etc/hosts +curl https://someonewhocares.org/hosts/hosts -o /etc/hosts + # Install NPM dependencies npm install -g jira-node-cli --save @@ -32,17 +124,22 @@ sudo pip install --upgrade pip curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python3 get-pip.py sudo pip3 install --upgrade pip -ln -s /usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/pip pip3 -export PATH=$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/ -pip3 install pipenv -pyenv install 3.6.0 +case "$(uname -s)" in + Darwin) + ln -snf /usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/pip pip3 + export PATH=$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/ + ;; +esac + +# was used for some slack cli in python... https://pypi.org/project/slack-cli/ +# pip3 install pipenv +# pyenv install 3.6.0 # Install AWS-CLI -pip3 install boto3 -pip3 install awscli +pip3 install boto3 awscli # Upgrade -upgrade.sh +~/.scripts/upgrade.sh # Reload -reload.sh +~/.scripts/reload.sh diff --git a/dot_scripts/executable_bootstrap.sh b/dot_scripts/install_docker_for_mac.sh similarity index 100% rename from dot_scripts/executable_bootstrap.sh rename to dot_scripts/install_docker_for_mac.sh diff --git a/dot_scripts/reload.sh b/dot_scripts/reload.sh index 4db9bca..b8a47aa 100644 --- a/dot_scripts/reload.sh +++ b/dot_scripts/reload.sh @@ -1,6 +1,13 @@ #!/usr/bin/env zsh +export SDKMAN_DIR="$HOME/.sdkman" +[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" +chmod +x ~/.scripts/*.sh source ~/.zshrc -sdk use java 8.0.202-zulu +sdk use java 8.0.222-zulu brew bundle # OSX Defaults -sudo sh .macos +case "$(uname -s)" in + Darwin) + sudo sh .macos + ;; +esac diff --git a/dot_scripts/upgrade.sh b/dot_scripts/upgrade.sh index 35af66b..1024d99 100644 --- a/dot_scripts/upgrade.sh +++ b/dot_scripts/upgrade.sh @@ -1,3 +1,5 @@ +export SDKMAN_DIR="$HOME/.sdkman" +[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" sdk selfupdate brew update #brew upgrade diff --git a/dot_zshrc b/dot_zshrc index d864de8..edf9508 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -2,7 +2,7 @@ # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. -export ZSH="/Users/morganwattiez/.oh-my-zsh" +export ZSH="$HOME/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, @@ -92,15 +92,20 @@ source $ZSH/oh-my-zsh.sh # For a full list of active aliases, run `alias`. . ~/.zsh_aliases . ~/.zsh_functions -. ~/.scripts/executable_bootstrap.sh - - eval "$(fasd --init auto)" -unlink "$HOME/Library/Application Support/Code/User/settings.json" -ln -s "$HOME/.config/Code/User/settings.json" "$HOME/Library/Application Support/Code/User/settings.json" + #cm apply -sh ~/.scripts/resume.sh +case "$(uname -s)" in + Darwin) + echo 'Install Docker Desktop for Mac OS X' + ~/.scripts/install_docker_for_mac.sh + unlink "$HOME/Library/Application Support/Code/User/settings.json" + ln -s "$HOME/.config/Code/User/settings.json" "$HOME/Library/Application Support/Code/User/settings.json" + sh ~/.scripts/resume.sh + ;; +esac + # check if we have new jira issues istherenewissues @@ -109,5 +114,10 @@ export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" #sdk use java 8.0.202-zulu -export PATH=$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/ + +case "$(uname -s)" in + Darwin) + export PATH=$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/ + ;; +esac export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"