(GH-198) Add extended option to hugo feature (#240)

Prior to this change, the hugo feature only supported specifying the
version of Hugo to install. Hugo is available in two builds: standard,
which the feature already installs, and extended, which includes
functionality for post-processing CSS/SCSS/SASS and JavaScript.

This change adds a new `extended` option to the hugo feature, allowing
users to specify that they require the extended build of Hugo. It
defaults to `false` and installs the standard build of Hugo.

- Resolves #198
This commit is contained in:
Mikey Lombardi (He/Him) 2022-11-15 10:19:33 -06:00 committed by GitHub
parent ada30c21f5
commit 474444fa9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{ {
"id": "hugo", "id": "hugo",
"version": "1.0.6", "version": "1.1.0",
"name": "Hugo", "name": "Hugo",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/hugo", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/hugo",
"options": { "options": {
@ -11,6 +11,11 @@
], ],
"default": "latest", "default": "latest",
"description": "Select or enter a version." "description": "Select or enter a version."
},
"extended": {
"type": "boolean",
"default": false,
"description": "Install Hugo extended for SASS/SCSS changes"
} }
}, },
"containerEnv": { "containerEnv": {

View file

@ -106,7 +106,14 @@ if ! hugo version &> /dev/null ; then
arch="64bit" arch="64bit"
fi fi
hugo_filename="hugo_${VERSION}_Linux-${arch}.tar.gz" # Install extended version of hugo if desired
if [ "${EXTENDED}" = "true" ]; then
extended="extended_"
else
extended=""
fi
hugo_filename="hugo_${extended}${VERSION}_Linux-${arch}.tar.gz"
curl -fsSLO --compressed "https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${hugo_filename}" curl -fsSLO --compressed "https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${hugo_filename}"
tar -xzf "$hugo_filename" -C "$installation_dir" tar -xzf "$hugo_filename" -C "$installation_dir"

View file

@ -0,0 +1,12 @@
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Ensure extended version is installed
check "extended_installed" bash -c "hugo version | grep extended"
# Report result
reportResults

11
test/hugo/scenarios.json Normal file
View file

@ -0,0 +1,11 @@
{
"install_hugo_extended": {
"image": "mcr.microsoft.com/devcontainers/base",
"features": {
"hugo": {
"version": "latest",
"extended": true
}
}
}
}