Encapsulating functions install_gem_pkg for easy gem sources replacement
Signed-off-by: Liu Yinsi liuyinsi@163.com --- sbin/install-dependencies.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index f2a9155f6..8bd1a1ddb 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -6,6 +6,13 @@ PROJECT_DIR=$(dirname $SCRIPT_DIR) . $PROJECT_DIR/lib/env.sh
# choose install function base on DISTRIBUTION + +install_gem_pkg() +{ + gem sources -r https://rubygems.org/ -a https://gems.ruby-china.com/ + sudo gem install -f git activesupport rest-client faye-websocket +} + linux_dep() { source /etc/os-release @@ -13,7 +20,7 @@ linux_dep() ubuntu|debian) export DEBIAN_FRONTEND=noninteractive sudo apt-get install -yqm ruby-dev libssl-dev gcc g++ - sudo gem install -f faye-websocket git activesupport rest-client + install_gem_pkg ;; openEuler|fedora|rhel|centos) if type dnf > /dev/null 2>&1; then @@ -21,7 +28,7 @@ linux_dep() else sudo yum install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git lftp fi - sudo gem install -f git activesupport rest-client faye-websocket + install_gem_pkg ;; *) echo "$ID not support! please install dependencies manually." @@ -34,7 +41,7 @@ mac_dep() { brew install ruby write_shell_profile "export PATH=/usr/local/opt/ruby/bin:$PATH" - sudo gem install -f git activesupport rest-client + install_gem_pkg }
run()