Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/add fishtape option to fish feature #25

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Install

```console
yarn install
```

## Tests

Pass a feature and a base image, _e.g._:

```fish
just test fish mcr.microsoft.com/devcontainers/base:debian
```
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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}} .
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "devcontainer-features",
"devDependencies": {
"@devcontainers/cli": "^0.23.2",
"gitmoji-cli": "^7.0.2"
}
}
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
Comment on lines +26 to +28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not edit README.md directly as it is automatically generated from devcontainer-feature.json and NOTES.md.

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
Loading