Skip to content

Commit

Permalink
feat(fish): add option to install fishtape
Browse files Browse the repository at this point in the history
test default devcontainer (without fishtape) and one with the option enable
  • Loading branch information
edouard-lopez committed Nov 7, 2022
1 parent 36925bf commit 29038ca
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 10 deletions.
8 changes: 5 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
set shell := ["fish", "-c"]


test feature image:
devcontainer features test \
--skip-scenarios \
--features {{feature}} \
--base-image {{image}} .

test-with-scenarios feature image:
devcontainer features test \
--features {{feature}} \
--base-image {{image}} .
12 changes: 7 additions & 5 deletions src/fish/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

# fish (fish)

Installs fish shell and Fisher plugin manager (optionally)
Installs fish shell and [Fisher][fisher] plugin manager and optionally [Fishtape][fishtape] test runner.

## Example Usage

```json
"features": {
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {
"version": "latest"
"fishtape": true
}
}
```
Expand All @@ -17,10 +17,12 @@ Installs fish shell and Fisher plugin manager (optionally)

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| fisher | Install Fisher plugin manager | boolean | true |


| `fisher` | Install [Fisher][fisher] plugin manager | boolean | `true` |
| `fishtape` | Install [Fishtape][fishtape], 100% pure-Fish test runner | boolean | `false` |

---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/meaningful-ooo/devcontainer-features/blob/main/src/fish/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

[fisher]: https://github.com/jorgebucaran/fisher
[fishtape]: https://github.com/jorgebucaran/fishtape
5 changes: 5 additions & 0 deletions src/fish/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"type": "boolean",
"default": true,
"description": "Install Fisher plugin manager"
},
"fishtape": {
"type": "boolean",
"default": false,
"description": "Install Fishtape, 100% pure-Fish test runner"
}
},
"customizations": {
Expand Down
12 changes: 12 additions & 0 deletions src/fish/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

FISHER=${FISHER:-"true"}
FISHTAPE=${FISHTAPE:-"false"}
USERNAME=${USERNAME:-"automatic"}

source /etc/os-release
Expand Down Expand Up @@ -118,6 +119,17 @@ if [ "${FISHER}" = "true" ]; then
fish -c "fisher -v"
fi

# Install Fishtape
if [ "${FISHTAPE}" = "true" ]; then
echo "Installing Fishtape..."
fish -c 'fisher install jorgebucaran/fishtape'
if [ "${USERNAME}" != "root" ]; then
su $USERNAME -c 'fish -c "fisher install jorgebucaran/fishtape"'
fi
fish -c "fishtape -v"
fi


# Clean up
cleanup

Expand Down
1 change: 1 addition & 0 deletions test/fish/alpine.sh → test/fish/alpine_with_fishtape.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ source dev-container-features-test-lib
check "fish" fish -v
echo "Testing with user: ${NON_ROOT_USER}"
check "fisher" su "${NON_ROOT_USER}" -c 'fish -c "fisher -v"'
check "fishtape is available" su "${NON_ROOT_USER}" -c 'fish -c "type -q fishtape"'

# Report result
reportResults
6 changes: 4 additions & 2 deletions test/fish/scenarios.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"alpine": {
"alpine_with_fishtape": {
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"features": {
"fish": {}
"fish": {
"fishtape": true
}
}
}
}
1 change: 1 addition & 0 deletions test/fish/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ case "${ID}" in
esac
echo "Testing with user: ${NON_ROOT_USER}"
check "fisher" su "${NON_ROOT_USER}" -c 'fish -c "fisher -v"'
check "fishtape is not available" test ! "$(su "${NON_ROOT_USER}" -c 'fish -c "type -q fishtape"')"

# Report result
reportResults

0 comments on commit 29038ca

Please sign in to comment.