Sha256: 7adaebbae3761f4c35f7386154ebbaa225e3e2f556b94c07af7929b29179e83d
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
#!/bin/bash -eux # Downloads and extract the scripts. # The extracted folder from github looks like this: # branch-name.tar.gz => forger-branch-name # master.tar.gz => forger-master # v1.0.0.tar.gz => forger-1.0.0 function extract_forger_scripts() { local temp_folder local url local filename rm -rf /opt/forger # clean start temp_folder="/opt/forger-temp" rm -rf "$temp_folder" mkdir -p "$temp_folder" ( cd "$temp_folder" <% # Examples: # FORGER_CODE=v1.0.0 # FORGER_CODE=master # FORGER_CODE=branch-name # # https://github.com/tongueroo/forger/archive/v1.0.0.tar.gz # https://github.com/tongueroo/forger/archive/master.tar.gz code_version = ENV['FORGER_CODE'] code_version ||= "v#{Forger::VERSION}" %> url="https://github.com/tongueroo/forger/archive/<%= code_version %>.tar.gz" filename=$(basename "$url") folder="${filename%.tar.gz}" # remove extension folder="${folder#v}" # remove leading v character folder="forger-$folder" # IE: forger-1.0.0 # install wget if not installed if ! type wget > /dev/null 2>&1 ; then if type yum > /dev/null 2>&1 ; then yum install -y wget elif type apt-get > /dev/null 2>&1 ; then apt-get update apt-get install -y wget fi fi # install tar if not installed if ! type tar > /dev/null 2>&1 ; then if type yum > /dev/null 2>&1 ; then yum install -y tar elif type apt-get > /dev/null 2>&1 ; then apt-get update apt-get install -y tar fi fi wget "$url" tar zxf "$filename" mv "$temp_folder/$folder/lib/forger/scripts" /opt/forger rm -rf "$temp_folder" chmod a+x -R /opt/forger ) } extract_forger_scripts
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
forger-2.0.1 | lib/forger/script/templates/extract_forger_scripts.sh |
forger-2.0.0 | lib/forger/script/templates/extract_forger_scripts.sh |