More tests, smarter manifest.

This commit is contained in:
Jorge Bucaran 2016-03-08 22:16:59 +09:00
parent 9ae8cce31c
commit ade58a01b7
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30
12 changed files with 104 additions and 64 deletions

View file

@ -1,13 +1,12 @@
# Change Log # Change Log
## [1.2.0][v120] - Not released yet ## [1.2.0][v120] - Not released yet
* Introduce set_color_custom function that prompts can define to customize *fish_color_* variables. The user current color palette is saved to $fisher_config/fish_colors and restored when the prompt is disabled #144. * Introduce set_color_custom function that prompts can define to customize *fish_color_* variables. The current color palette is saved to $fisher_config/fish_colors and restored when the prompt is disabled / uninstalled #144.
* Fix bug where fisher_path_is_prompt was not picking up prompts that define its functions inside a functions directory. #155. * Fix a bug where fisher_path_is_prompt was not picking up prompts that define functions inside a functions directory. #155.
* Add test stubs for missing test cases. We'll get around those eventually. * Add support to read oh-my-fish bundle file package declarations.
## [1.1.0][v110] - 2016-03-02 ## [1.1.0][v110] - 2016-03-02

View file

@ -1,5 +1,5 @@
function __fisher_config_color_reset function __fisher_config_color_reset
if test ! -f "$fisher_config/fish_colors" if test ! -f "$path"
set -U fish_color_normal normal set -U fish_color_normal normal
set -U fish_color_command 005fd7 purple set -U fish_color_command 005fd7 purple
set -U fish_color_param 00afff cyan set -U fish_color_param 00afff cyan
@ -8,8 +8,10 @@ function __fisher_config_color_reset
set -U fish_color_error red --bold set -U fish_color_error red --bold
set -U fish_color_escape cyan set -U fish_color_escape cyan
set -U fish_color_operator cyan set -U fish_color_operator cyan
set -U fish_color_end green
set -U fish_color_quote brown set -U fish_color_quote brown
set -U fish_color_autosuggestion 555 yellow set -U fish_color_autosuggestion 555 yellow
set -U fish_color_user green
set -U fish_color_valid_path --underline set -U fish_color_valid_path --underline
set -U fish_color_cwd green set -U fish_color_cwd green
set -U fish_color_cwd_root red set -U fish_color_cwd_root red
@ -21,35 +23,39 @@ function __fisher_config_color_reset
set -U fish_pager_color_description 555 yellow set -U fish_pager_color_description 555 yellow
set -U fish_pager_color_progress cyan set -U fish_pager_color_progress cyan
set -U fish_color_history_current cyan set -U fish_color_history_current cyan
set -U fish_color_host normal
return return
end end
set -l IFS \n set -l IFS \n
read -laz fish_colors < $fisher_config/fish_colors read -laz fish_colors < $path
set -U fish_color_normal (echo $fish_colors[1] | tr " " \n) set -U fish_color_normal (echo $fish_colors[1] | tr " " \n)
set -U fish_color_command (echo $fish_colors[2] | tr " " \n) set -U fish_color_command (echo $fish_colors[2] | tr " " \n)
set -U fish_color_param (echo $fish_colors[3] | tr " " \n) set -U fish_color_param (echo $fish_colors[3] | tr " " \n)
set -U fish_color_redirection (echo $fish_colors[4] | tr " " \n) set -U fish_color_redirection (echo $fish_colors[4] | tr " " \n)
set -U fish_color_comment (echo $fish_colors[5] | tr " " \n) set -U fish_color_comment (echo $fish_colors[5] | tr " " \n)
set -U fish_color_error (echo $fish_colors[6] | tr " " \n) set -U fish_color_error (echo $fish_colors[6] | tr " " \n)
set -U fish_color_escape (echo $fish_colors[7] | tr " " \n) set -U fish_color_escape (echo $fish_colors[7] | tr " " \n)
set -U fish_color_operator (echo $fish_colors[8] | tr " " \n) set -U fish_color_operator (echo $fish_colors[8] | tr " " \n)
set -U fish_color_quote (echo $fish_colors[9] | tr " " \n) set -U fish_color_end (echo $fish_colors[9] | tr " " \n)
set -U fish_color_autosuggestion (echo $fish_colors[10] | tr " " \n) set -U fish_color_quote (echo $fish_colors[10] | tr " " \n)
set -U fish_color_valid_path (echo $fish_colors[11] | tr " " \n) set -U fish_color_autosuggestion (echo $fish_colors[11] | tr " " \n)
set -U fish_color_cwd (echo $fish_colors[12] | tr " " \n) set -U fish_color_user (echo $fish_colors[12] | tr " " \n)
set -U fish_color_cwd_root (echo $fish_colors[13] | tr " " \n) set -U fish_color_valid_path (echo $fish_colors[13] | tr " " \n)
set -U fish_color_match (echo $fish_colors[14] | tr " " \n) set -U fish_color_cwd (echo $fish_colors[14] | tr " " \n)
set -U fish_color_search_match (echo $fish_colors[15] | tr " " \n) set -U fish_color_cwd_root (echo $fish_colors[15] | tr " " \n)
set -U fish_color_selection (echo $fish_colors[16] | tr " " \n) set -U fish_color_match (echo $fish_colors[16] | tr " " \n)
set -U fish_pager_color_prefix (echo $fish_colors[17] | tr " " \n) set -U fish_color_search_match (echo $fish_colors[17] | tr " " \n)
set -U fish_pager_color_completion (echo $fish_colors[18] | tr " " \n) set -U fish_color_selection (echo $fish_colors[18] | tr " " \n)
set -U fish_pager_color_description (echo $fish_colors[19] | tr " " \n) set -U fish_pager_color_prefix (echo $fish_colors[19] | tr " " \n)
set -U fish_pager_color_progress (echo $fish_colors[20] | tr " " \n) set -U fish_pager_color_completion (echo $fish_colors[20] | tr " " \n)
set -U fish_color_history_current (echo $fish_colors[21] | tr " " \n) set -U fish_pager_color_description (echo $fish_colors[21] | tr " " \n)
set -U fish_pager_color_progress (echo $fish_colors[22] | tr " " \n)
set -U fish_color_history_current (echo $fish_colors[23] | tr " " \n)
set -U fish_color_host (echo $fish_colors[24] | tr " " \n)
rm -f $fisher_config/fish_colors rm -f $path
end end

View file

@ -1,26 +1,31 @@
function __fisher_config_color_save function __fisher_config_color_save -a path
if test ! -f "$fisher_config/fish_colors" if test -f "$path"
printf "%s\n" \ return 1
"$fish_color_normal" \
"$fish_color_command" \
"$fish_color_param" \
"$fish_color_redirection" \
"$fish_color_comment" \
"$fish_color_error" \
"$fish_color_escape" \
"$fish_color_operator" \
"$fish_color_quote" \
"$fish_color_autosuggestion" \
"$fish_color_valid_path" \
"$fish_color_cwd" \
"$fish_color_cwd_root" \
"$fish_color_match" \
"$fish_color_search_match" \
"$fish_color_selection" \
"$fish_pager_color_prefix" \
"$fish_pager_color_completion" \
"$fish_pager_color_description" \
"$fish_pager_color_progress" \
"$fish_color_history_current" > "$fisher_config/fish_colors"
end end
printf "%s\n" \
"$fish_color_normal" \
"$fish_color_command" \
"$fish_color_param" \
"$fish_color_redirection" \
"$fish_color_comment" \
"$fish_color_error" \
"$fish_color_escape" \
"$fish_color_operator" \
"$fish_color_end" \
"$fish_color_quote" \
"$fish_color_autosuggestion" \
"$fish_color_user" \
"$fish_color_valid_path" \
"$fish_color_cwd" \
"$fish_color_cwd_root" \
"$fish_color_match" \
"$fish_color_search_match" \
"$fish_color_selection" \
"$fish_pager_color_prefix" \
"$fish_pager_color_completion" \
"$fish_pager_color_description" \
"$fish_pager_color_progress" \
"$fish_color_history_current" \
"$fish_color_host" > "$path"
end end

View file

@ -1,5 +1,11 @@
function __fisher_file function __fisher_file
awk -v FS=\t ' awk -v FS=\t '
/^[ \t]*package / {
gsub("^[ \t]*package ", "https://github.com/oh-my-fish/plugin-")
printf("%s\n", $0)
next
}
/@http/ { /@http/ {
gsub("@.*$", "", $1) gsub("@.*$", "", $1)
} }

View file

@ -14,7 +14,7 @@ function __fisher_plugin_disable -a plugin path option
__fisher_plugin_unlink $fisher_config/$target $name __fisher_plugin_unlink $fisher_config/$target $name
if test "$name" = set_color_custom if test "$name" = set_color_custom
__fisher_config_color_reset __fisher_config_color_reset "$fisher_config/fish_colors"
end end
end end
end end

View file

@ -37,7 +37,8 @@ function __fisher_plugin_enable -a plugin path
__fisher_plugin_source $plugin $fisher_config/$target __fisher_plugin_source $plugin $fisher_config/$target
if test "$name" = set_color_custom if test "$name" = set_color_custom
__fisher_config_color_save debug "Colors"
__fisher_config_color_save "$fisher_config/fish_colors"
set_color_custom set_color_custom
end end
end end

View file

@ -129,8 +129,8 @@ function fisher_search -d "Search plugin index"
end end
set -l color_name (set_color $fish_color_command) set -l color_name (set_color $fish_color_command)
set -l color_url (set_color $fish_color_cwd -u) set -l color_url (set_color $fish_color_quote -u)
set -l color_tag (set_color $fish_color_cwd) set -l color_tag (set_color $fish_color_quote)
set -l color_weak (set_color white) set -l color_weak (set_color white)
set -l color_author (set_color -u) set -l color_author (set_color -u)
set -l color_normal (set_color $fish_color_normal) set -l color_normal (set_color $fish_color_normal)

View file

@ -1,3 +1,24 @@
test "$TESTNAME - Todo" set -l path $DIRNAME/.t-$TESTNAME-(random)
-z ""
function -S setup
mkdir -p $path/{foo,bar}
__fisher_config_color_save $path/foo/fish_colors
touch $path/bar/fish_colors
end
function -S teardown
rm -rf $path
end
test "$TESTNAME - Create fish_colors in path"
-s $path/foo/fish_colors
end
test "$TESTNAME - Create fish_colors in path"
1 = (
__fisher_config_color_save $path/bar/fish_colors
echo $status
)
end end

View file

@ -37,3 +37,5 @@ https://github.com/quux/fisher-thud
# may include other files too, but there should be only *one* fish file. # may include other files too, but there should be only *one* fish file.
gisty@https://gist.github.com/xxxx gisty@https://gist.github.com/xxxx
package mof

View file

@ -8,3 +8,4 @@ https://github.com/quux/fish-fred
https://github.com/quux/fisher-thud https://github.com/quux/fisher-thud
/Users/fisherboy/Projects/fisherman/plugins/chomp /Users/fisherboy/Projects/fisherman/plugins/chomp
gisty@https://gist.github.com/xxxx gisty@https://gist.github.com/xxxx
package mof

View file

@ -8,3 +8,4 @@ https://github.com/quux/fish-fred
https://github.com/quux/fisher-thud https://github.com/quux/fisher-thud
/Users/fisherboy/Projects/fisherman/plugins/chomp /Users/fisherboy/Projects/fisherman/plugins/chomp
gisty gisty
https://github.com/oh-my-fish/plugin-mof

View file

@ -1,11 +1,9 @@
set -l manifest $DIRNAME/fixtures/manifest set -l manifest $DIRNAME/fixtures/manifest
set -l plugins foo bar baz norf zerg quux hoge foobar fred thud chomp boo loo gisty set -l plugins foo bar baz quux hoge foobar fred thud chomp gisty mof
test "$TESTNAME - Parse fishfile and retrieve plugin names with fisher list fishfile" test "$TESTNAME - Parse fishfile and retrieve plugin names with fisher list fishfile"
$plugins = (
# We use fisher list <file> to parse <file> and then extract the plugin's name fisher list $manifest/fishfile
# as it will be used by the CLI. See also `test/name.fish`. )
(fisher list $manifest/fishfile) = $plugins
end end