-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8befc51
commit 65e0114
Showing
9 changed files
with
84 additions
and
1 deletion.
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,7 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# can't symlink to ../jd or else YP_DIR detection in ../jd fails | ||
|
||
YP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
${YP_DIR}/bin/jd "$@" |
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,13 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# NOTE since this folder is meant to be appended to $PATH as | ||
# PATH=${PATH}:path/to/yplatform/bin/.jd | ||
# calling 'jd' might call the system executable 'jd'. | ||
# This scripts assumes that there's no system executable 'yp-jd', | ||
# so it will always call our 'bin/jd' script. | ||
|
||
# can't symlink to ../jd or else YP_DIR detection in ../jd fails | ||
|
||
YP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
${YP_DIR}/bin/jd "$@" |
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,44 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
YP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
source ${YP_DIR}/sh/common.inc.sh | ||
|
||
# shellcheck disable=SC1091 | ||
VSN=$(source ${YP_DIR}/CONST.inc && echo "${YP_JD_VSN}") | ||
JD_URL=https://github.com/josephburnett/jd/releases/download | ||
|
||
case ${OS_SHORT}-${ARCH_NORMALIZED} in | ||
darwin-amd64|darwin-arm64) | ||
# local arm64; not available in a github release | ||
BINARY=jd-${ARCH_NORMALIZED}-${OS_SHORT} | ||
;; | ||
linux-linux-amd64|linux-arm64) | ||
# local arm64; not available in a github release | ||
BINARY=jd-${ARCH_NORMALIZED}-${OS_SHORT} | ||
;; | ||
*) | ||
echo_err "jd: ${OS_SHORT}-${ARCH_NORMALIZED} is an unsupported OS-ARCH." | ||
exit 1 | ||
;; | ||
esac | ||
ASSET_LOCAL=${YP_DIR}/bin/jd-${VSN}/${BINARY} | ||
ASSET_REMOTE=${JD_URL}/v${VSN}/${BINARY} | ||
BINARY_LOCAL=${ASSET_LOCAL} | ||
|
||
[[ -f ${BINARY_LOCAL} ]] || { | ||
ASSET_LOCAL=${HOME}/.cache/yplatform/jd-${VSN}/${BINARY} | ||
BINARY_LOCAL=${ASSET_LOCAL} | ||
} | ||
|
||
[[ -f ${BINARY_LOCAL} ]] || { | ||
echo_info "Fetching ${ASSET_REMOTE}..." | ||
mkdir -p $(dirname ${ASSET_LOCAL}) | ||
curl -qfsSL \ | ||
-o ${ASSET_LOCAL} \ | ||
${ASSET_REMOTE} | ||
chmod +x ${BINARY_LOCAL} | ||
} | ||
|
||
echo_info "Proxying to 'jd' as ${BINARY_LOCAL}." | ||
${BINARY_LOCAL} "$@" |
Binary file not shown.
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
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