From fcfbc0b2ad08d461a32519c1330abad8f4dd52c4 Mon Sep 17 00:00:00 2001 From: Manfred Endres Date: Thu, 28 Nov 2019 16:49:25 +0100 Subject: [PATCH] Fix 2.0 installer script Hey I made some adjustments to your changes for the new installer package. * Add missing `fastlane_shim` file * remove ssl certificate environment line from `bundle-env` * added option switch `-u` to skip prompts for autoupdate/install --- bundle-env | 1 - fastlane_shim | 20 ++++++++++++++++++++ install | 9 +++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 fastlane_shim diff --git a/bundle-env b/bundle-env index d58a609..901573c 100755 --- a/bundle-env +++ b/bundle-env @@ -17,7 +17,6 @@ unset GEM_CACHE # necessary. export PATH=$BIN:$PATH -export SSL_CERT_FILE=$PREFIX/share/cacert.pem export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8 diff --git a/fastlane_shim b/fastlane_shim new file mode 100755 index 0000000..f2d86a3 --- /dev/null +++ b/fastlane_shim @@ -0,0 +1,20 @@ +#!/bin/bash + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" +done +DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + +function gem_cleanup() { + EXCLUDE_SYSTEM_GEMS="true" "${DIR}/bundle/bin/bundle-env" gem cleanup +} + +if [ "$1" = "update_fastlane" ]; then + "${DIR}/bundle/bin/bundle-env" gem update --no-document fastlane + gem_cleanup +else + exec "${DIR}/bundle/bin/bundle-env" fastlane "$@" +fi; diff --git a/install b/install index fad07d3..f47aba6 100755 --- a/install +++ b/install @@ -12,10 +12,10 @@ PACKAGED_FASTLANE_VERSION_FILE="$FASTLANE_DIR/PACKAGED_FASTLANE_VERSION.txt" PACKAGED_RUBY_VERSION_FILE="$FASTLANE_DIR/PACKAGED_RUBY_VERSION.txt" usage() { - echo "./install [-u] [-p] [-b]" - echo " -u : Uninstall fastlane if it exists in $FASTLANE_DIR" + echo "./install [-p] [-b] [-a]" echo " -p : Don't update the path automatically" echo " -b : Installed via homebrew" + echo " -a : autoupdate ruby-build and openssl" exit 1 } @@ -24,6 +24,7 @@ while getopts ":pub" opt; do case $opt in p ) SKIP_SETTING_PATH=1;; b ) INSTALLED_VIA_HOMEBREW=true;; + a ) NO_PROMPS=1;; * ) usage ;; esac done @@ -52,6 +53,10 @@ install_or_upgrade_via_homebrew() prompt_to_install_or_upgrade() { + if [ "$NO_PROMPS" == "1" ]; then + return + fi + PACKAGE=$1 read -p "The installer needs to install/upgrade $PACKAGE with brew. Is that okay? (y/N) " -n 1 choice