Merge branch 'dev'

This commit is contained in:
Raphael Reitzig 2019-07-31 03:09:18 +02:00
commit ba1ab563a3
6 changed files with 59 additions and 27 deletions

5
.editorconfig Normal file
View file

@ -0,0 +1,5 @@
[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
test/*_fish
test/*_bash

View file

@ -1,27 +1,24 @@
env:
- FISH=release-2
- FISH=release-3
matrix:
allow_failures:
- env: FISH=release-3
- FISH=release-2
- FISH=release-3
sudo: required
before_install:
- sudo add-apt-repository -y ppa:fish-shell/${FISH}
- sudo apt-get update
- sudo apt-get -y install fish
- curl -s "https://get.sdkman.io" | bash
- bash test/prepare_tests.sh
- sudo add-apt-repository -y ppa:fish-shell/${FISH}
- sudo apt-get update
- sudo apt-get -y install fish
- curl -s "https://get.sdkman.io" | bash
- bash test/prepare_tests.sh
install:
- mkdir -p "${HOME}"/.config/fish/{completions,conf.d,functions}
- cp completions/* "${HOME}"/.config/fish/completions/
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
- cp functions/* "${HOME}"/.config/fish/functions/
- mkdir -p "${HOME}"/.config/fish/{completions,conf.d,functions}
- cp completions/* "${HOME}"/.config/fish/completions/
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
- cp functions/* "${HOME}"/.config/fish/functions/
- uname -a; fish --version
script:
- ruby test/completion.rb
- fish test/wrapper.fish
- bash -c "sdk install crash 1.3.0; sdk uninstall crash 1.3.0"; fish test/10_zombies_new.fish
- ruby test/completion.rb
- fish test/wrapper.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

View file

@ -5,7 +5,7 @@
Makes command `sdk` from [SDKMAN!] available in fish.
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.

25
test/reinitialize.fish Executable file
View 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

View file

@ -34,7 +34,10 @@ for sdk_cmd in $test_commands
# For nicer diffs: one entry per line, sorted
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
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 "$failures/$check_count checks failed."
exit (math $failures != 0)
exit $failures