mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-06-16 09:20:52 -07:00
Merge branch 'dev'
This commit is contained in:
commit
ba1ab563a3
6 changed files with 59 additions and 27 deletions
5
.editorconfig
Normal file
5
.editorconfig
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
test/*_fish
|
||||||
|
test/*_bash
|
35
.travis.yml
35
.travis.yml
|
@ -1,27 +1,24 @@
|
||||||
env:
|
env:
|
||||||
- FISH=release-2
|
- FISH=release-2
|
||||||
- FISH=release-3
|
- FISH=release-3
|
||||||
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- env: FISH=release-3
|
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
before_install:
|
before_install:
|
||||||
- sudo add-apt-repository -y ppa:fish-shell/${FISH}
|
- sudo add-apt-repository -y ppa:fish-shell/${FISH}
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get -y install fish
|
- sudo apt-get -y install fish
|
||||||
- curl -s "https://get.sdkman.io" | bash
|
- curl -s "https://get.sdkman.io" | bash
|
||||||
- bash test/prepare_tests.sh
|
- bash test/prepare_tests.sh
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- mkdir -p "${HOME}"/.config/fish/{completions,conf.d,functions}
|
- mkdir -p "${HOME}"/.config/fish/{completions,conf.d,functions}
|
||||||
- cp completions/* "${HOME}"/.config/fish/completions/
|
- cp completions/* "${HOME}"/.config/fish/completions/
|
||||||
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
|
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
|
||||||
- cp functions/* "${HOME}"/.config/fish/functions/
|
- cp functions/* "${HOME}"/.config/fish/functions/
|
||||||
|
- uname -a; fish --version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ruby test/completion.rb
|
- ruby test/completion.rb
|
||||||
- fish test/wrapper.fish
|
- fish test/wrapper.fish
|
||||||
- bash -c "sdk install crash 1.3.0; sdk uninstall crash 1.3.0"; fish test/10_zombies_new.fish
|
- fish test/reinitialize.fish
|
||||||
|
- bash -c "sdk install crash 1.3.0; sdk uninstall crash 1.3.0"; fish test/10_zombies_new.fish
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
Makes command `sdk` from [SDKMAN!] available in fish.
|
Makes command `sdk` from [SDKMAN!] available in fish.
|
||||||
Also provides auto-completion and adds binaries from installed SDKs to the PATH.
|
Also provides auto-completion and adds binaries from installed SDKs to the PATH.
|
||||||
|
|
||||||
Tested with fish 2.7.1 and SDKMAN! 5.7.3.
|
Tested with fish 2.7.1 and 3.0.2, and SDKMAN! 5.7.3.
|
||||||
|
|
||||||
:warning: Tests indicate that fish 3.x is incompatible.
|
:warning: Tests indicate that fish 3.x is incompatible.
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ with `sdk` as you would expect.
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
* Completion originally by [Ted Wise](https://github.com/ctwise); see his
|
* Completion originally by [Ted Wise](https://github.com/ctwise); see his
|
||||||
[blog post from 2016](http://tedwise.com/2016/02/26/using-sdkman-with-the-fish-shell).
|
[blog post from 2016](http://tedwise.com/2016/02/26/using-sdkman-with-the-fish-shell).
|
||||||
* Binary loading originally by [Koala Yeung](https://github.com/yookoala);
|
* Binary loading originally by [Koala Yeung](https://github.com/yookoala);
|
||||||
see [his comment on sdkman/sdkman-cli#294](https://github.com/sdkman/sdkman-cli/issues/294#issuecomment-318252058).
|
see [his comment on sdkman/sdkman-cli#294](https://github.com/sdkman/sdkman-cli/issues/294#issuecomment-318252058).
|
||||||
|
|
25
test/reinitialize.fish
Executable file
25
test/reinitialize.fish
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
# If either of
|
||||||
|
# - $SDKMAN_DIR is unset
|
||||||
|
# - $SDKMAN_DIR points to a directory not owned by the current user
|
||||||
|
# is true, sdkman-for-fish should run sdkman's init script.
|
||||||
|
|
||||||
|
# Assumes sdkman-for-fish is installed
|
||||||
|
set proper_value "$SDKMAN_DIR"
|
||||||
|
|
||||||
|
begin
|
||||||
|
set -e SDKMAN_DIR
|
||||||
|
set in_new_shell (fish -lc 'echo $SDKMAN_DIR')
|
||||||
|
if [ "$in_new_shell" != "$proper_value" ]
|
||||||
|
echo "SDKMAN_DIR initialized to $in_new_shell instead of $proper_value"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
set SDKMAN_DIR "/" # belongs to root, who hopefully doesn't run this
|
||||||
|
set in_new_shell (fish -lc 'echo $SDKMAN_DIR')
|
||||||
|
if [ "$in_new_shell" != "$proper_value" ]
|
||||||
|
echo "SDKMAN_DIR reinitialized to $in_new_shell instead of $proper_value"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
|
@ -23,18 +23,21 @@ echo "Testing the sdk wrapper"
|
||||||
set failures 0
|
set failures 0
|
||||||
for sdk_cmd in $test_commands
|
for sdk_cmd in $test_commands
|
||||||
echo " Testing '$sdk_cmd'"
|
echo " Testing '$sdk_cmd'"
|
||||||
bash -c "source \"$sdk_init\" && $sdk_cmd > sout_bash;
|
bash -c "source \"$sdk_init\" && $sdk_cmd > sout_bash;
|
||||||
echo \"\$?\" > status_bash;
|
echo \"\$?\" > status_bash;
|
||||||
echo \"\$PATH\" > path_bash;
|
echo \"\$PATH\" > path_bash;
|
||||||
echo \"\$ANT_HOME\" > anthome_bash"
|
echo \"\$ANT_HOME\" > anthome_bash"
|
||||||
fish -c "$sdk_cmd > sout_fish;
|
fish -c "$sdk_cmd > sout_fish;
|
||||||
echo \"\$status\" > status_fish;
|
echo \"\$status\" > status_fish;
|
||||||
echo \"\$PATH\" > path_fish;
|
echo \"\$PATH\" > path_fish;
|
||||||
echo \"\$ANT_HOME\" > anthome_fish"
|
echo \"\$ANT_HOME\" > anthome_fish"
|
||||||
|
|
||||||
# For nicer diffs: one entry per line, sorted
|
# For nicer diffs: one entry per line, sorted
|
||||||
string split ":" (cat path_bash) | sort > path_bash
|
string split ":" (cat path_bash) | sort > path_bash
|
||||||
string split " " (cat path_fish) | sort > path_fish
|
string split ":" (cat path_fish) \
|
||||||
|
| string split " " \
|
||||||
|
| sort > path_fish
|
||||||
|
# split by spaces for fish 2.*
|
||||||
|
|
||||||
for out in sout status path anthome
|
for out in sout status path anthome
|
||||||
if [ (checksum "$out"_bash) != (checksum "$out"_fish) ]
|
if [ (checksum "$out"_bash) != (checksum "$out"_fish) ]
|
||||||
|
@ -52,4 +55,4 @@ rm {sout,status,path}_{bash,fish}
|
||||||
|
|
||||||
echo "Ran $test_count commands with 3 checks each."
|
echo "Ran $test_count commands with 3 checks each."
|
||||||
echo "$failures/$check_count checks failed."
|
echo "$failures/$check_count checks failed."
|
||||||
exit (math $failures != 0)
|
exit $failures
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue