From b2811947f37120e19e956aca5a26050abb691321 Mon Sep 17 00:00:00 2001 From: hophacker Date: Mon, 31 Dec 2018 11:27:52 +0800 Subject: [PATCH] install required tools before install yadr --- Rakefile | 29 ----------------------------- install.sh | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Rakefile b/Rakefile index 51da67d..11b66c3 100644 --- a/Rakefile +++ b/Rakefile @@ -32,10 +32,6 @@ task :install => [:submodule_init, :submodules] do Rake::Task["install_vundle"].execute end - Rake::Task["install_utilities"].execute - - Rake::Task["install_zsh"].execute - Rake::Task["install_ycm"].execute Rake::Task["install_prezto"].execute @@ -55,31 +51,6 @@ task :install_prezto do end end -task :install_utilities do - run %{ - if [ "$(uname)" = "Darwin" ]; then - brew install git - elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then - apt install git fc-cache -y - fi - } -end - -task :install_zsh do - if want_to_install?('zsh') - run %{ - which zsh - if [ $? -ne 0 ]; then - if [ "$(uname)" = "Darwin" ]; then - brew install zsh - elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then - apt install zsh -y - fi - fi - } - end -end - task :install_ycm do if want_to_install?('YouCompleteMe') run %{ diff --git a/install.sh b/install.sh index 545eff8..cfecc5a 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,29 @@ #!/bin/sh +exists () { + which $1 &> /dev/null; echo $? +} + +declare -a tools=("zsh" "git" "rake") + +for tool in "${tools[@]}"; do + if [ `exists $tool` != "0" ]; then + if [ "$(uname)" = "Darwin" ]; then + brew install $tool + elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then + apt $tool -y + fi + fi +done + +if [ `exists fc-cache` != "0" ]; then + if [ "$(uname)" = "Darwin" ]; then + brew install fontconfig + elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then + apt fc-cache -y + fi +fi + if [ ! -d "$HOME/.yadr" ]; then echo "Installing YADR for the first time" git clone --depth=1 https://github.com/rallets-network/dotfiles.git "$HOME/.yadr"