Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- github.com-cli
- helix-editor.com
- jj-vcs.dev
- jnsahaj-lumen
- lazygit
- jq
- k9scli.io
Expand Down Expand Up @@ -97,6 +98,7 @@ jobs:
- github.com-cli
- helix-editor.com
- jj-vcs.dev
- jnsahaj-lumen
- lazygit
- jq
- k9scli.io
Expand Down
17 changes: 17 additions & 0 deletions src/jnsahaj-lumen/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "jnsahaj/lumen",
"id": "jnsahaj-lumen",
"version": "1.0.0",
"description": "Install \"lumen\" binary - AI-powered git diff viewer and commit message generator",
"documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/jnsahaj-lumen",
"options": {
"version": {
"type": "string",
"default": "latest",
"proposals": [
"latest"
],
"description": "Version of \"lumen\" to install."
}
}
}
62 changes: 62 additions & 0 deletions src/jnsahaj-lumen/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
set -o errexit
set -o pipefail
set -o noclobber
set -o nounset
set -o allexport
readonly cratesPackage='lumen'
readonly binaryName='lumen'
readonly binaryTargetFolder='/usr/local/bin'
readonly name='lumen'
apt_get_update() {
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
apt_get_checkinstall() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
apt_get_update
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@"
fi
}
apt_get_cleanup() {
apt-get clean
rm -rf /var/lib/apt/lists/*
}
echo_banner() {
local text="$1"
echo -e "\e[1m\e[97m\e[41m$text\e[0m"
}
utils_check_version() {
local version=$1
if ! [[ "${version:-}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
printf >&2 '=== [ERROR] Option "version" (value: "%s") is not "latest" or valid semantic version format "X.Y.Z" !\n' \
"$version"
exit 1
fi
}
install() {
utils_check_version "$VERSION"
apt_get_checkinstall curl ca-certificates build-essential
export RUSTUP_HOME=/usr/local/rustup
export CARGO_HOME=/usr/local/cargo
if ! command -v cargo >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --no-modify-path --default-toolchain stable
fi
export PATH=/usr/local/cargo/bin:$PATH
if [ "$VERSION" == 'latest' ] || [ -z "$VERSION" ]; then
cargo install "$cratesPackage"
else
cargo install "$cratesPackage" --version "$VERSION"
fi
readonly binaryTargetPath="${binaryTargetFolder}/${binaryName}"
ln -sf /usr/local/cargo/bin/"$binaryName" "$binaryTargetPath"
chmod 755 "$binaryTargetPath"
apt_get_cleanup
}
echo_banner "devcontainer.community"
echo "Installing $name..."
install "$@"
echo "(*) Done!"
12 changes: 12 additions & 0 deletions test/jnsahaj-lumen/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

# Optional: Import test library bundled with the devcontainer CLI
source dev-container-features-test-lib

# Feature-specific tests
check "execute command" bash -c "lumen --version"

# Report results
reportResults
Loading