Skip to content

Commit 29038ca

Browse files
committed
feat(fish): add option to install fishtape
test default devcontainer (without fishtape) and one with the option enable
1 parent 36925bf commit 29038ca

File tree

7 files changed

+35
-10
lines changed

7 files changed

+35
-10
lines changed

justfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
set shell := ["fish", "-c"]
2-
3-
41
test feature image:
52
devcontainer features test \
63
--skip-scenarios \
74
--features {{feature}} \
85
--base-image {{image}} .
6+
7+
test-with-scenarios feature image:
8+
devcontainer features test \
9+
--features {{feature}} \
10+
--base-image {{image}} .

src/fish/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
# fish (fish)
33

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

66
## Example Usage
77

88
```json
99
"features": {
1010
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {
11-
"version": "latest"
11+
"fishtape": true
1212
}
1313
}
1414
```
@@ -17,10 +17,12 @@ Installs fish shell and Fisher plugin manager (optionally)
1717

1818
| Options Id | Description | Type | Default Value |
1919
|-----|-----|-----|-----|
20-
| fisher | Install Fisher plugin manager | boolean | true |
21-
22-
20+
| `fisher` | Install [Fisher][fisher] plugin manager | boolean | `true` |
21+
| `fishtape` | Install [Fishtape][fishtape], 100% pure-Fish test runner | boolean | `false` |
2322

2423
---
2524

2625
_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`._
26+
27+
[fisher]: https://github.com/jorgebucaran/fisher
28+
[fishtape]: https://github.com/jorgebucaran/fishtape

src/fish/devcontainer-feature.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"type": "boolean",
1010
"default": true,
1111
"description": "Install Fisher plugin manager"
12+
},
13+
"fishtape": {
14+
"type": "boolean",
15+
"default": false,
16+
"description": "Install Fishtape, 100% pure-Fish test runner"
1217
}
1318
},
1419
"customizations": {

src/fish/install.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

33
FISHER=${FISHER:-"true"}
4+
FISHTAPE=${FISHTAPE:-"false"}
45
USERNAME=${USERNAME:-"automatic"}
56

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

122+
# Install Fishtape
123+
if [ "${FISHTAPE}" = "true" ]; then
124+
echo "Installing Fishtape..."
125+
fish -c 'fisher install jorgebucaran/fishtape'
126+
if [ "${USERNAME}" != "root" ]; then
127+
su $USERNAME -c 'fish -c "fisher install jorgebucaran/fishtape"'
128+
fi
129+
fish -c "fishtape -v"
130+
fi
131+
132+
121133
# Clean up
122134
cleanup
123135

test/fish/alpine.sh renamed to test/fish/alpine_with_fishtape.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ source dev-container-features-test-lib
2020
check "fish" fish -v
2121
echo "Testing with user: ${NON_ROOT_USER}"
2222
check "fisher" su "${NON_ROOT_USER}" -c 'fish -c "fisher -v"'
23+
check "fishtape is available" su "${NON_ROOT_USER}" -c 'fish -c "type -q fishtape"'
2324

2425
# Report result
2526
reportResults

test/fish/scenarios.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"alpine": {
2+
"alpine_with_fishtape": {
33
"image": "mcr.microsoft.com/devcontainers/base:alpine",
44
"features": {
5-
"fish": {}
5+
"fish": {
6+
"fishtape": true
7+
}
68
}
79
}
810
}

test/fish/test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ case "${ID}" in
7272
esac
7373
echo "Testing with user: ${NON_ROOT_USER}"
7474
check "fisher" su "${NON_ROOT_USER}" -c 'fish -c "fisher -v"'
75+
check "fishtape is not available" test ! "$(su "${NON_ROOT_USER}" -c 'fish -c "type -q fishtape"')"
7576

7677
# Report result
7778
reportResults

0 commit comments

Comments
 (0)