Sha256: 92361aba0da12e2853fa175d2723b5a4c76166a9735b07a77cb59e33a4bd06bb
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 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 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
3 entries across 3 versions & 1 rubygems