-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Install GHCup inside the plugin directory (#12)
- Loading branch information
Showing
11 changed files
with
98 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.devenv/ | ||
.direnv/ | ||
.ghcup/ | ||
node_modules/ | ||
|
||
.pre-commit-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
asdf_plugin_path() { | ||
echo "$(dirname "$(dirname "$0")")" | ||
} | ||
|
||
ghcup_bin_dir() { | ||
echo "$(asdf_plugin_path)/.ghcup/bin" | ||
} | ||
|
||
ensure_ghcup() { | ||
if ! test -f "$(ghcup_bin_dir)/ghcup" | ||
then | ||
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env \ | ||
BOOTSTRAP_HASKELL_MINIMAL=1 \ | ||
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ | ||
GHCUP_INSTALL_BASE_PREFIX="$(asdf_plugin_path)" \ | ||
sh > /dev/null | ||
fi | ||
} | ||
|
||
list_all_versions() { | ||
ensure_ghcup | ||
"$(ghcup_bin_dir)/ghcup" list -t "$1" -r | awk '{printf $2" "}' | ||
} | ||
|
||
ver() { | ||
echo "$1" | awk -F . '{ printf("%02d%02d", $1,$2); }' | ||
} | ||
|
||
install_version() { | ||
local tool="$1" | ||
local version="$2" | ||
local path="$3" | ||
|
||
ensure_ghcup | ||
|
||
if [[ "$tool" == "ghc" ]] || { [[ "$tool" == "hls" ]] && [[ $(ver "$version") -ge $(ver "1.7") ]]; } | ||
then | ||
"$(ghcup_bin_dir)/ghcup" install "$tool" "$version" -i "$path" | ||
else | ||
"$(ghcup_bin_dir)/ghcup" install "$tool" "$version" -i "${path}/bin" | ||
fi | ||
} |
Submodule bats
updated
45 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
# vi: ft=bash | ||
|
||
setup() { | ||
load 'test_helper/bats-assert/load' | ||
load 'test_helper/bats-support/load' | ||
load 'test_helper/bats-assert/load' | ||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" | ||
PATH="$DIR/../bin:$PATH" | ||
} | ||
|
||
@test "cabal" { | ||
source ./bin/list-all | ||
run main cabal | ||
run list-all cabal | ||
assert_success | ||
assert_output --partial "3.8.1.0" | ||
} | ||
|
||
@test "ghc" { | ||
source ./bin/list-all | ||
run main ghc | ||
run list-all ghc | ||
assert_success | ||
assert_output --partial "9.4.2" | ||
} | ||
|
||
@test "hls" { | ||
source ./bin/list-all | ||
run main hls | ||
run list-all hls | ||
assert_success | ||
assert_output --partial "1.7.0.0" | ||
} | ||
|
||
@test "stack" { | ||
source ./bin/list-all | ||
run main stack | ||
run list-all stack | ||
assert_success | ||
assert_output --partial "2.7.5" | ||
} |
Submodule bats-support
updated
5 files
+8 −0 | load.bash | |
+2 −2 | src/output.bash | |
+27 −0 | test/50-output-10-batslib_err.bats | |
+33 −0 | test/50-output-19-batslib_decorate.bats | |
+1 −0 | test/cat |