-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: download, pre-remove, post-add scripts. Improved loggin… (#17)
refactor: logging and progress bar on download refactor: pull download out to own script docs: explain structure to contributors fix: shellcheck feat: check dependencies, use pre-remove and post-add scripts fix: deps check fix: improve docs fix: unbound array variable
- Loading branch information
Showing
11 changed files
with
184 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# shellcheck source=../lib/helpers.bash | ||
source "$(dirname "$0")/../lib/helpers.bash" | ||
# shellcheck source=../lib/utils.bash | ||
source "$(dirname "$0")/../lib/utils.bash" | ||
|
||
download() { | ||
local gcs_bucket_name="cloud-sdk-release" | ||
local gcs_object | ||
local status_code | ||
gcs_object="$(construct_gcs_object "${ASDF_INSTALL_VERSION}" "$(get_os_name)" "$(get_os_architecture)")" | ||
|
||
log_info "⏬ downloading ${gcs_object}" | ||
status_code=$(curl -X GET \ | ||
--write-out "%{http_code}" \ | ||
--progress-bar \ | ||
-Lo "${ASDF_DOWNLOAD_PATH}/${gcs_object}" \ | ||
"https://storage.googleapis.com/storage/v1/b/${gcs_bucket_name}/o/${gcs_object}?alt=media") | ||
|
||
if [[ ${status_code} -eq 404 ]]; then | ||
log_failure_and_exit "gcloud not found for version ${ASDF_INSTALL_VERSION}. Full version required, not just major version numbers." | ||
fi | ||
log_success "downloaded!" | ||
} | ||
|
||
download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# shellcheck source=../lib/utils.bash | ||
source "$(dirname "$0")/../lib/utils.bash" | ||
|
||
check_dependencies "$(dirname "$0")/../lib/dependencies.txt" "warning" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# shellcheck source=../lib/utils.bash | ||
source "$(dirname "$0")/../lib/utils.bash" | ||
|
||
# Google Cloud SDK uninstall instructions - https://cloud.google.com/sdk/docs/uninstall-cloud-sdk | ||
|
||
log_info "ℹ️ Your gcloud project configuration(s) persist in you gcloud configuration directory. Usually ~/.config/gcloud" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bash | ||
curl | ||
echo | ||
getconf | ||
printf | ||
python | ||
rm | ||
source | ||
sort | ||
tar | ||
uname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
function construct_gcs_object() { | ||
local install_version="${1}" | ||
local os_name="${2}" | ||
local os_architecture="${3}" | ||
|
||
echo "google-cloud-sdk-${install_version}-${os_name}-${os_architecture}.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters