Skip to content

Commit 61829da

Browse files
authored
Merge pull request #16 from CodeMan99/feature/elm-lang
Add feature: elm-lang
2 parents 2c88d6f + 581d474 commit 61829da

File tree

13 files changed

+232
-4
lines changed

13 files changed

+232
-4
lines changed

.devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
2+
"image": "mcr.microsoft.com/devcontainers/javascript-node:4-24-bookworm",
33
"customizations": {
44
"vscode": {
55
"settings": {

src/circleci-cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Install the CircleCI CLI. Also installs the CircleCI extension for vscode.
77

88
```json
99
"features": {
10-
"ghcr.io/CodeMan99/features/circleci-cli:1": {}
10+
"ghcr.io/codeman99/features/circleci-cli:1": {}
1111
}
1212
```
1313

src/deno-cache/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Create a docker named volume at /deno-dir
77

88
```json
99
"features": {
10-
"ghcr.io/CodeMan99/features/deno-cache:0": {}
10+
"ghcr.io/codeman99/features/deno-cache:0": {}
1111
}
1212
```
1313

src/elm-lang/NOTES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Elm-lang
2+
3+
Installs the [Elm](https://elm-lang.org) compiler following the [linux install](https://github.com/elm/compiler/blob/master/installers/linux/README.md) documentation.
4+
5+
```shell
6+
elm --help
7+
```
8+
9+
See the [language guide](https://guide.elm-lang.org), [examples](https://elm-lang.org/examples), and [documentation](https://elm-lang.org/docs) for more information on the language.

src/elm-lang/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# Elm Language Compiler (via Github Releases) (elm-lang)
3+
4+
Install the elm language compiler and related tools
5+
6+
## Example Usage
7+
8+
```json
9+
"features": {
10+
"ghcr.io/codeman99/features/elm-lang:0": {}
11+
}
12+
```
13+
14+
## Options
15+
16+
| Options Id | Description | Type | Default Value |
17+
|-----|-----|-----|-----|
18+
| version | Specify the compiler version | string | 0.19.1 |
19+
| elmPrefix | Where the "elm" binary will be installed | string | /usr/local/bin |
20+
| installFormat | Install the "elm-format" command (via npm if installed) | boolean | true |
21+
| installReview | Install the "elm-review" command (via npm if installed) | boolean | true |
22+
| installTest | Install the "elm-test" command (via npm if installed) | boolean | true |
23+
24+
## Customizations
25+
26+
### VS Code Extensions
27+
28+
- `Elmtooling.elm-ls-vscode`
29+
30+
# Elm-lang
31+
32+
Installs the [Elm](https://elm-lang.org) compiler following the [linux install](https://github.com/elm/compiler/blob/master/installers/linux/README.md) documentation.
33+
34+
```shell
35+
elm --help
36+
```
37+
38+
See the [language guide](https://guide.elm-lang.org), [examples](https://elm-lang.org/examples), and [documentation](https://elm-lang.org/docs) for more information on the language.
39+
40+
41+
---
42+
43+
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/CodeMan99/features/blob/main/src/elm-lang/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"id": "elm-lang",
3+
"name": "Elm Language Compiler (via Github Releases)",
4+
"version": "0.1.0",
5+
"documentationURL": "https://github.com/CodeMan99/features/tree/main/src/elm-lang",
6+
"description": "Install the elm language compiler and related tools",
7+
"options": {
8+
"version": {
9+
"default": "0.19.1",
10+
"description": "Specify the compiler version",
11+
"type": "string"
12+
},
13+
"elmPrefix": {
14+
"default": "/usr/local/bin",
15+
"description": "Where the \"elm\" binary will be installed",
16+
"type": "string"
17+
},
18+
"installFormat": {
19+
"default": true,
20+
"description": "Install the \"elm-format\" command (via npm if installed)",
21+
"type": "boolean"
22+
},
23+
"installReview": {
24+
"default": true,
25+
"description": "Install the \"elm-review\" command (via npm if installed)",
26+
"type": "boolean"
27+
},
28+
"installTest": {
29+
"default": true,
30+
"description": "Install the \"elm-test\" command (via npm if installed)",
31+
"type": "boolean"
32+
}
33+
},
34+
"customizations": {
35+
"vscode": {
36+
"extensions": [
37+
"Elmtooling.elm-ls-vscode"
38+
]
39+
}
40+
},
41+
"installsAfter": [
42+
"ghcr.io/devcontainers/features/node"
43+
]
44+
}

src/elm-lang/install.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
VERSION="${VERSION:-0.19.1}"
6+
ELM_PREFIX="${ELMPREFIX:-/usr/local/bin}"
7+
INSTALL_FORMAT="${INSTALLFORMAT:-true}"
8+
INSTALL_REVIEW="${INSTALLREVIEW:-true}"
9+
INSTALL_TEST="${INSTALLTEST:-true}"
10+
11+
apt_get_update()
12+
{
13+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
14+
echo "Running apt-get update..."
15+
apt-get update -y
16+
fi
17+
}
18+
19+
# Checks if packages are installed and installs them if not
20+
check_packages() {
21+
if ! dpkg -s "$@" > /dev/null 2>&1; then
22+
apt_get_update
23+
apt-get -y install --no-install-recommends "$@"
24+
fi
25+
}
26+
27+
export DEBIAN_FRONTEND=noninteractive
28+
check_packages curl ca-certificates
29+
30+
curl --location --output elm.gz "https://github.com/elm/compiler/releases/download/${VERSION}/binary-for-linux-64-bit.gz"
31+
gunzip elm.gz
32+
install elm "${ELM_PREFIX}"
33+
34+
declare -a PACKAGES
35+
36+
if [[ "${INSTALL_FORMAT}" == "true" ]]; then
37+
PACKAGES+=("elm-format")
38+
fi
39+
40+
if [[ "${INSTALL_REVIEW}" == "true" ]]; then
41+
PACKAGES+=("elm-review")
42+
fi
43+
44+
if [[ "${INSTALL_TEST}" == "true" ]]; then
45+
PACKAGES+=("elm-test")
46+
fi
47+
48+
if command -v npm &> /dev/null && [[ ${#PACKAGES[@]} -gt 0 ]]; then
49+
npm install -g "${PACKAGES[@]}"
50+
fi

src/exercism-cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Install the exercism-cli.
77

88
```json
99
"features": {
10-
"ghcr.io/CodeMan99/features/exercism-cli:1": {}
10+
"ghcr.io/codeman99/features/exercism-cli:1": {}
1111
}
1212
```
1313

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
source dev-container-features-test-lib
6+
7+
check "Elm-lang compiler binary is executable" test -x /usr/local/bin/elm
8+
check "elm --version" elm --version
9+
check "npm tool: elm-format" test -x "$(npm prefix -g)/bin/elm-format"
10+
check "npm tool: elm-review" test -x "$(npm prefix -g)/bin/elm-review"
11+
check "npm tool: elm-test" test -x "$(npm prefix -g)/bin/elm-test"
12+
13+
reportResults
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
source dev-container-features-test-lib
6+
7+
check "Elm-lang compiler binary is executable" test -x /usr/local/bin/elm
8+
check "elm --version" elm --version
9+
check "npm tool: elm-format" test -x "$(npm prefix -g)/bin/elm-format"
10+
check "npm tool: elm-review" test -x "$(npm prefix -g)/bin/elm-review"
11+
check "npm tool: elm-test" test -x "$(npm prefix -g)/bin/elm-test"
12+
13+
reportResults

0 commit comments

Comments
 (0)