Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0f11225
Add bin/install for homebrew
binhapp Apr 23, 2019
a6ed5ba
Handle cache for travisAdd nvm install
binhapp Apr 23, 2019
2d7ee7b
Remove hook install on travis
binhapp Apr 23, 2019
01033a0
Remove symbolic link
binhapp Apr 23, 2019
b64b9cf
Remove install npm lts
binhapp Apr 23, 2019
a39e724
Update ./bin/install
binhapp Apr 23, 2019
ff6996f
Add z, fix install oh-my-zsh on travis
binhapp Apr 23, 2019
2521cea
Fix wrong path rvm
binhapp Apr 24, 2019
d580a01
Fix wrong dotfiles directory on travis ci
binhapp Apr 24, 2019
fb89f5d
Add dotfiles.sh
binhapp Apr 24, 2019
251ba66
Add shell functions
binhapp Apr 24, 2019
c1fe385
Fix build on travis ci
binhapp Apr 24, 2019
ffcee97
Change ruby version
binhapp Apr 24, 2019
3567e48
Remove alias dotfiles
binhapp Apr 24, 2019
31fb646
Add function update_dotfiles
binhapp Apr 24, 2019
5eab789
Change node version
binhapp Apr 24, 2019
8b80fcd
Change function to upgrade_dotfiles
binhapp Apr 24, 2019
849f2ff
Update README
binhapp Apr 24, 2019
f59e87f
Add newline for file
binhapp Apr 24, 2019
2dfda81
Add gem install xcode-install
binhapp Apr 24, 2019
952c112
Add brew_cask_install and macos
binhapp Apr 24, 2019
0f3876e
Handle exit code
binhapp Apr 25, 2019
a431a2a
Revert handle exit code
binhapp Apr 25, 2019
ce6c596
Add shell function link_file
binhapp Apr 25, 2019
dd5f49d
Add shell function backup_vscode_extensions sync_vscode_extensions
binhapp Apr 25, 2019
9e7bebb
Add shell function for brew_cask_list
binhapp Apr 25, 2019
ee6e4c0
Update shell command install_dotfiles
binhapp Apr 25, 2019
cab4f7d
Add shell function load_*
binhapp Apr 25, 2019
5d35e4e
Remove alias xcode
binhapp Apr 25, 2019
b8c2117
Remove alias restree
binhapp Apr 25, 2019
00478a9
Fix typo
binhapp Apr 25, 2019
80c94f2
Add PATH for vscode
binhapp Apr 25, 2019
4041c17
Update function load_java
binhapp Apr 25, 2019
503e7e6
unset ANDROID_HOME if not install
binhapp Apr 25, 2019
d3cf959
Fix wrong link config spectacle
binhapp Apr 25, 2019
8c7c369
Add config remove auto newline for vscode
binhapp Apr 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .config/brew_cask_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alfred
android-studio
calibre
google-chrome
iterm2
skype
slack
sourcetree
spectacle
spotify
visual-studio-code
File renamed without changes.
7 changes: 7 additions & 0 deletions .config/vscode_extensions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dbaeumer.vscode-eslint
eamodio.gitlens
Orta.vscode-jest
ryanluker.vscode-coverage-gutters
shd101wyy.markdown-preview-enhanced
vscodevim.vim
vsmobile.vscode-react-native
3 changes: 3 additions & 0 deletions .functions/backup_brew_cask_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
backup_brew_cask_list() {
brew cask list > $DOTFILES_DIR/.config/brew_cask_list.txt
}
3 changes: 3 additions & 0 deletions .functions/backup_vscode_extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
backup_vscode_extensions() {
code --list-extensions > $DOTFILES_DIR/.config/vscode_extensions.txt
}
10 changes: 10 additions & 0 deletions .functions/brew_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
brew_install() {
brew install carthage
brew install python
brew install rbenv
brew install tree
brew install watchman
brew install zsh-autosuggestions
brew install zsh-completions
brew install zsh-syntax-highlighting
}
6 changes: 6 additions & 0 deletions .functions/clone_z.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
clone_z() {
if [ -d ~/.zrupa ]; then
return
fi
git clone https://github.com/rupa/z ~/.zrupa
}
7 changes: 7 additions & 0 deletions .functions/download_fonts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
download_fonts() {
FONT_PATH="$HOME/Library/Fonts/Meslo LG M Regular for Powerline.ttf"
if [ -f "$FONT_PATH" ]; then
return
fi
curl https://raw.githubusercontent.com/powerline/fonts/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf --output "$FONT_PATH"
}
7 changes: 7 additions & 0 deletions .functions/gem_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gem_install() {
echo N | rbenv install $(cat ~/.ruby-version)
rbenv local $(cat ~/.ruby-version)
gem install cocoapods
gem install fastlane
gem install xcode-install
}
17 changes: 17 additions & 0 deletions .functions/install_dotfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
install_dotfiles() {
clone_z
download_fonts
link_dotfiles
install_oh_my_zsh
install_homebrew
install_rbenv
install_nvm
source ~/.zshrc
brew_install
pip3_install && source ~/.zshrc
gem_install
npm_install
sync_brew_cask_list
sync_vscode_extensions
macos
}
6 changes: 6 additions & 0 deletions .functions/install_homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
install_homebrew() {
if type brew >/dev/null 2>&1; then
return
fi
mkdir ~/.homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C ~/.homebrew
}
6 changes: 6 additions & 0 deletions .functions/install_nvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
install_nvm() {
if type nvm >/dev/null 2>&1; then
return
fi
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
}
7 changes: 7 additions & 0 deletions .functions/install_oh_my_zsh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
install_oh_my_zsh() {
if [ -d ~/.oh-my-zsh ]; then
return
fi
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
sudo chsh -s /bin/zsh "$USER"
}
3 changes: 3 additions & 0 deletions .functions/install_rbenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
install_rbenv() {
brew install rbenv
}
14 changes: 14 additions & 0 deletions .functions/link_dotfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
link_dotfiles() {
link_file .zshrc
link_file .vimrc
link_file .ruby-version
link_file .gemrc
link_file .nvmrc
link_file .vmdrc
link_file .gitignore_global
link_file .config/powerline-shell/config.json
link_file Library/Application\ Support/Spectacle/Shortcuts.json
link_file Library/Application\ Support/Code/User/settings.json
link_file Library/Application\ Support/Code/User/keybindings.json
link_file Library/Preferences/com.googlecode.iterm2.plist
}
7 changes: 7 additions & 0 deletions .functions/link_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
link_file() {
file="$1"
srcfile="$DOTFILES_DIR/$file"
desfile="$HOME/$file"
mkdir -p "$(dirname "$desfile")"
ln -f -s "$srcfile" "$desfile"
}
12 changes: 12 additions & 0 deletions .functions/load_android_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load_android_sdk() {
export ANDROID_HOME=$HOME/Library/Android/sdk
if [ ! -d "$ANDROID_HOME" ]; then
unset ANDROID_HOME
return
fi
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
alias emulator=$ANDROID_HOME/tools/emulator
}
load_android_sdk
4 changes: 4 additions & 0 deletions .functions/load_java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load_java() {
export JAVA_HOME=`/usr/libexec/java_home --request`
export PATH=$JAVA_HOME/bin:$PATH
}
8 changes: 8 additions & 0 deletions .functions/load_nvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load_nvm() {
if [ ! -d ~/.nvm ]; then
return
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
}
17 changes: 17 additions & 0 deletions .functions/load_powerline_shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load_powerline_shell() {
if ! type powerline-shell >/dev/null 2>&1; then
return
fi
function powerline_precmd() {
PS1="$(powerline-shell --shell zsh $?)"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
install_powerline_precmd
}
6 changes: 6 additions & 0 deletions .functions/load_rbenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load_rbenv() {
if ! type rbenv >/dev/null 2>&1; then
return
fi
eval "$(rbenv init -)"
}
3 changes: 3 additions & 0 deletions .functions/load_z.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load_z() {
[ -d ~/.zrupa ] && . ~/.zrupa/z.sh
}
10 changes: 10 additions & 0 deletions .functions/load_zsh_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function load_zsh_plugins() {
if ! type brew >/dev/null 2>&1; then
return
fi
brew_dir=$(brew --prefix)
source $brew_dir/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $brew_dir/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fpath=($brew_dir/share/zsh-completions $fpath)
}
load_zsh_plugins
3 changes: 3 additions & 0 deletions .functions/macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
macos() {
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
}
6 changes: 6 additions & 0 deletions .functions/npm_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
npm_install() {
nvm install $(cat ~/.nvmrc)
nvm alias default $(cat ~/.nvmrc)
npm install -g yarn
npm install -g vmd
}
3 changes: 3 additions & 0 deletions .functions/pip3_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip3_install() {
pip3 install powerline-shell
}
6 changes: 6 additions & 0 deletions .functions/sync_brew_cask_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sync_brew_cask_list() {
casks=(`cat $DOTFILES_DIR/.config/brew_cask_list.txt`)
for cask in "${casks[@]}"; do
brew cask install $cask || brew cask install $cask --force
done
}
3 changes: 3 additions & 0 deletions .functions/sync_vscode_extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sync_vscode_extensions() {
cat $DOTFILES_DIR/.config/vscode_extensions.txt | xargs -L1 code --install-extension
}
4 changes: 4 additions & 0 deletions .functions/uninstal_rbenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
uninstall_rbenv() {
rm -rf `rbenv root`
brew uninstall rbenv
}
4 changes: 4 additions & 0 deletions .functions/uninstall_homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
uninstall_homebrew() {
echo y | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
for d in /usr/local/*; do sudo rm -rf $d; done
}
3 changes: 3 additions & 0 deletions .functions/uninstall_nvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
uninstall_nvm() {
rm -rf ~/.nvm
}
4 changes: 4 additions & 0 deletions .functions/uninstall_rvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
uninstall_rvm() {
echo yes | rvm implode
rm -rf ~/.rvm
}
7 changes: 7 additions & 0 deletions .functions/upgrade_dotfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
upgrade_dotfiles() {
DOTFILES_DIR=~/.dotfiles
if [ -d "$DOTFILES_DIR" ]; then
(cd "$DOTFILES_DIR"; git add . && git stash && git pull)
fi
install_dotfiles
}
2 changes: 1 addition & 1 deletion .gemrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
echo "gem: --no-document"
gem: --no-document
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v8.11.3
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.3
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
os: osx
sudo: true
language: objective-c
os:
- osx
install:
- curl https://raw.githubusercontent.com/blcsntb/mac-setup/master/mac-setup | bash -s all
- curl https://raw.githubusercontent.com/blcsntb/mac-setup/dotfiles/dotfiles.sh | bash
- source ~/.dotfiles/dotfiles.sh
- install_dotfiles
script:
- ~/mac-setup/mac-setup all
- upgrade_dotfiles
62 changes: 14 additions & 48 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,54 +1,20 @@
ZSH_THEME="robbyrussell"

export ZSH=~/.oh-my-zsh

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

export PATH=$HOME/.homebrew/bin:$PATH

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export PATH=$JAVA_HOME/bin:$PATH

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

export MAC_SETUP_DIR="$HOME/mac-setup"

alias mac='~/mac-setup/mac-setup'
alias mac-update='mac all && source ~/.zshrc'
alias emulator=$ANDROID_HOME/tools/emulator
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES && killall Finder'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO && killall Finder'
alias xcode='open -a Xcode'
alias stree='open -a SourceTree'
alias restree='killall Sourcetree && stree'
alias gff='git flow feature'
alias sourcetree='open -a SourceTree'

function powerline_precmd() {
PS1="$(powerline-shell --shell zsh $?)"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
install_powerline_precmd
ZSH_THEME="robbyrussell"
export ZSH=~/.oh-my-zsh
export REACT_EDITOR=code
export PATH=$HOME/.homebrew/bin:$PATH
export PATH=/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin:$PATH

source $ZSH/oh-my-zsh.sh
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source $MAC_SETUP_DIR/vscode/.vscode

# Note the source command must be at the end of ~/.zshrc.
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

eval "$(rbenv init -)"
source ~/.dotfiles/dotfiles.sh
load_zsh_plugins
load_powerline_shell
load_z
load_rbenv
load_nvm
load_java
load_android_sdk
Loading