Skip to content

Commit 70b6a9e

Browse files
authored
Merge pull request #73 from TTWShell/feature/auto-yes
Feature/auto yes
2 parents 460a5ef + 7bf4777 commit 70b6a9e

File tree

3 files changed

+60
-31
lines changed

3 files changed

+60
-31
lines changed

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
sudo: required
2+
3+
language: generic
4+
5+
os:
6+
- linux
7+
- osx
8+
9+
before_install:
10+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:kalakris/cmake && sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test; fi
11+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:bcandrea/backports; fi
12+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi
13+
14+
install:
15+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y cmake gcc-4.8 g++-4.8 clang golang; fi
16+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX="g++-4.8" CC="gcc-4.8" GOROOT="/usr/lib/go" GOPATH=$HOME/gocode PATH=$PATH:$GOPATH/bin; fi
17+
18+
19+
compiler:
20+
- gcc
21+
22+
script:
23+
- ./install.sh
24+
- sudo vim +PluginClean +qall

install-plugins.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
22

33
function install {
4-
sudo cp vimrc $HOME/.vimrc
5-
sudo vim +PluginClean +qall
6-
sudo vim +PluginInstall +qall
4+
cp vimrc $HOME/.vimrc
5+
yes "\n" | sudo vim +PluginClean +qall
6+
yes "\n" | sudo vim +PluginInstall +qall
77
}
88

99
function update {
10-
sudo vim +PluginUpdate +qall
10+
yes "\n" | sudo vim +PluginUpdate +qall
1111
}
1212

1313
function init {
@@ -25,6 +25,8 @@ function init {
2525
}
2626

2727
function rebuild() {
28+
set -e
29+
set -o pipefail
2830
cd ~/.vim/bundle/YouCompleteMe && git submodule update --init --recursive && sudo ./install.py "$@"
2931
}
3032

@@ -33,7 +35,7 @@ function usage {
3335
printf " init\t初始化安装插件\n"
3436
printf " install\t安装新增变更配置\n"
3537
printf " update\t更新配置且更新所有插件。可能会导致ycm不能正常工作,此时需要执行 rebuild 命令\n"
36-
printf " rebuild\trebuild YouCompleteMe。可加YCM build的参数,例如:-clang-completer --gocode-completer\n"
38+
printf " rebuild\trebuild YouCompleteMe。可加YCM build的参数,例如:--clang-completer --gocode-completer\n"
3739
}
3840

3941

install.sh

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env bash
2+
set -e
3+
set -o pipefail
24

35
function echoo {
46
echo -e "\n\033[32m $1 \033[0m"
@@ -9,39 +11,40 @@ function backup {
911

1012
now=`date +%Y%m%dT%H-%M-%S`
1113
for i in $HOME/.vim $HOME/.vimrc; do
12-
echo $i'-->'$i.$now
13-
[ -e $i ] && sudo mv $i $i.$now;
14+
echoo $i' --> '$i.$now
15+
[ -e $i ] && sudo mv $i $i.$now
1416
done
17+
18+
echoo ">>> backup finished"
1519
}
1620

1721
platform=""
1822
for i in "Centos","Centos" "Ubuntu","Ubuntu" "Darwin","MacOSX"; do
19-
key=${i%,*}; value=${i#*,};
20-
if [ `python -mplatform | grep -ic $key` == 1 ]; then
23+
key=${i%,*}; value=${i#*,};
24+
if [ `python -mplatform | grep -ic $key` == 1 ]; then
2125
platform=$value
22-
echoo "You os is $platform."
26+
echoo ">>> You os is $platform."
2327
fi
2428
done
2529

2630

27-
read -p "Rebulid the vim and all plugins, Are you sure(Y/N)? " -n 1 -r
28-
echo
29-
if [[ $REPLY =~ ^[Yy]$ ]]; then
30-
backup
31-
case $platform in
32-
Centos)
33-
sudo bash scripts/init-vim-centos.sh
34-
;;
35-
Ubuntu)
36-
sudo bash scripts/init-vim-ubuntu.sh
37-
;;
38-
MacOSX)
39-
bash scripts/init-vim-osx.sh
40-
echoo ">>> Install fonts for powerline ..."
41-
bash fonts/install-fonts.sh
42-
esac
43-
sudo bash install-plugins.sh init
44-
echoo "Install finished. If you need orther language support, please run: ./install-plugins.sh --help"
45-
else
46-
echoo "User cancels the operation."
47-
fi
31+
backup
32+
33+
case $platform in
34+
Centos)
35+
sudo bash scripts/init-vim-centos.sh
36+
;;
37+
Ubuntu)
38+
sudo bash scripts/init-vim-ubuntu.sh
39+
;;
40+
MacOSX)
41+
echoo ">>> Install dependencies ..."
42+
bash scripts/init-vim-osx.sh
43+
echoo ">>> Install fonts for powerline ..."
44+
bash fonts/install-fonts.sh
45+
;;
46+
esac
47+
48+
sudo bash install-plugins.sh init
49+
50+
echoo "Install finished. If you need orther language support, please run: ./install-plugins.sh --help"

0 commit comments

Comments
 (0)