From 70483b49d0607047e9970fc02b8ee40d6992c759 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Mon, 1 Apr 2019 23:54:31 +0800 Subject: [PATCH] feat(install-plugins.sh): git-clone or update plugins --- install-plugins.sh | 17 +++++++++++++++++ travis-install-plugins.sh | 12 ------------ travis-install.sh | 11 ++++++++--- 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100755 install-plugins.sh delete mode 100755 travis-install-plugins.sh diff --git a/install-plugins.sh b/install-plugins.sh new file mode 100755 index 000000000..467572fac --- /dev/null +++ b/install-plugins.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +for slug in "$@" +do + plugin_project="${slug##*/}" + plugin_dir="plugins/${plugin_project#librime-}" + if [[ -d "${plugin_dir}" ]] + then + echo "Updating plugin: ${plugin_dir}" + git -C "${plugin_dir}" checkout master + git -C "${plugin_dir}" pull + else + git clone --depth 1 "https://github.com/${slug}.git" "${plugin_dir}" + fi +done diff --git a/travis-install-plugins.sh b/travis-install-plugins.sh deleted file mode 100755 index 69d797a0d..000000000 --- a/travis-install-plugins.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -for slug in "$@" -do - plugin_project="${slug##*/}" - plugin_dir="plugins/${plugin_project#librime-}" - git clone --depth 1 "https://github.com/${slug}.git" "${plugin_dir}" - - if [[ -e "${plugin_dir}/travis-install.sh" ]]; then - bash "${plugin_dir}/travis-install.sh" - fi -done diff --git a/travis-install.sh b/travis-install.sh index b29586afd..63d5aa2a1 100755 --- a/travis-install.sh +++ b/travis-install.sh @@ -19,10 +19,15 @@ if [[ "$TRAVIS_OS_NAME" == linux ]]; then make -C thirdparty/src/opencc build sudo env "PATH=$PATH" make -C thirdparty/src/opencc install elif [[ "$TRAVIS_OS_NAME" == osx ]]; then - make -f xcode.mk thirdparty + make xcode/thirdparty fi if [[ -n "${RIME_PLUGINS}" ]]; then - # intentionally not quoted: ${RIME_PLUGIN} is a space separated list of slugs - bash ./travis-install-plugins.sh ${RIME_PLUGINS} + # intentionally unquoted: ${RIME_PLUGINS} is a space separated list of slugs + bash ./install-plugins.sh ${RIME_PLUGINS} + for plugin_dir in plugins/*; do + if [[ -e "${plugin_dir}/travis-install.sh" ]]; then + bash "${plugin_dir}/travis-install.sh" + fi + done fi