-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic support for DevContainer feature
- Loading branch information
Showing
3 changed files
with
100 additions
and
0 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,17 @@ | ||
{ | ||
"id": "hyde", | ||
"name": "Hyde", | ||
"description": "A tool to handle Jekyll posts and pages", | ||
"documentationURL": "https://github.com/Kralizek/Hyde", | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/common-utils" | ||
], | ||
"options": { | ||
"version": { | ||
"type": "string", | ||
"proposals": ["latest"], | ||
"default": "latest", | ||
"description": "Select the version of Hyde to install, if not latest." | ||
} | ||
} | ||
} |
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,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
TOOL_VERSION=${VERSION:-"latest"} | ||
|
||
set -e | ||
|
||
find_version_from_git_tags() { | ||
local variable_name=$1 | ||
local requested_version=${!variable_name} | ||
if [ "${requested_version}" = "none" ]; then return; fi | ||
local repository=$2 | ||
local prefix=${3:-"tags/v"} | ||
local separator=${4:-"."} | ||
local last_part_optional=${5:-"false"} | ||
if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then | ||
local escaped_separator=${separator//./\\.} | ||
local last_part | ||
if [ "${last_part_optional}" = "true" ]; then | ||
last_part="(${escaped_separator}[0-9]+)?" | ||
else | ||
last_part="${escaped_separator}[0-9]+" | ||
fi | ||
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+${last_part}$" | ||
local version_list="$(git ls-remote --tags ${repository} | grep -oP "${regex}" | tr -d ' ' | tr "${separator}" "." | sort -rV)" | ||
if [ "${requested_version}" = "latest" ] || [ "${requested_version}" = "current" ] || [ "${requested_version}" = "lts" ]; then | ||
declare -g ${variable_name}="$(echo "${version_list}" | head -n 1)" | ||
else | ||
set +e | ||
declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" | ||
set -e | ||
fi | ||
fi | ||
if [ -z "${!variable_name}" ] || ! echo "${version_list}" | grep "^${!variable_name//./\\.}$" > /dev/null 2>&1; then | ||
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 | ||
exit 1 | ||
fi | ||
echo "${variable_name}=${!variable_name}" | ||
} | ||
|
||
find_version_from_git_tags TOOL_VERSION https://github.com/Kralizek/Hyde | ||
|
||
mkdir -p /tmp/hydetool | ||
pushd /tmp/hydetool | ||
|
||
echo "Downloading Hyde..." | ||
|
||
wget https://github.com/Kralizek/Hyde/releases/download/v${TOOL_VERSION}/hyde-linux-x64.zip | ||
exit_code=$? | ||
|
||
set -e | ||
if [ "$exit_code" != "0" ]; then | ||
echo "(!) hyde version ${TOOL_VERSION} failed to download." | ||
exit 1 | ||
fi | ||
|
||
popd | ||
|
||
pushd ~/.local/bin | ||
|
||
unzip /tmp/hydetool/hyde-linux-x64.zip | ||
|
||
rm -rf /tmp/hydetool |