mirror of https://github.com/jorgebucaran/fisher
commit
8b62b1357f
@ -1,7 +1,45 @@
|
||||
# Changelog
|
||||
# Change Log
|
||||
|
||||
* [0.2.0](#020)
|
||||
* [0.1.0](#010)
|
||||
|
||||
## 0.1.0 - 2016-01-01
|
||||
## 0.2.0 - 2016-01-05
|
||||
|
||||
* Improved README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors.
|
||||
|
||||
* :warning: Removed `fisher update --cache` in favor of `fisher --cache | fisher update` and `fisher uninstall --all` in favor of `fisher --cache | fisher uninstall`.
|
||||
|
||||
* :warning: Fisherman does not move initialization / configuration files following the convention `name`.config.fish to `$fisher_config/functions`, but to `$fisher_config/conf.d` now and evaluates each `*.config.fish` inside at shell start as usual. Closes #13.
|
||||
|
||||
* Added `fisher --cache[=base]` option to retrieve contents in `$fisher_cache`, eliminating flaky usage of `find(1)`. Closes #11.
|
||||
|
||||
* Fisherman now generates information about plugins installed via custom URLs. For the description, a shortened version of the URL is used. For the URL the full URL is used. For tags, the URL is fuzzily checked and tags such as _theme_, _plugin_, _config_ and _omf_ are added. The tag _orphan_ is added by default as well. Finally, the author is generated by retrieving the e-mail or username of the author of the first commit in the plugin's repository. Closes #9 and #14.
|
||||
|
||||
* Changed `--path-in-cache` to `--translate.` This function translates an name or supported URL/URL variation into a path inside `$fisher_cache`. This allows you to treat plugins installed via custom URLs almost like regular plugins if they are installed. Closes #8.
|
||||
|
||||
* Fixed a bug with `mktemp` failing on some systems. Closes #7. Thanks @tobywf.
|
||||
|
||||
* Added [CODE_OF_CONDUCT][code_of_conduct]. Closes #6.
|
||||
|
||||
* Fisherman can now unload themes within the same shell, without having to restart the session. Closes #5.
|
||||
|
||||
* Fisherman can now load themes within the same shell, without having to restart the session using `exec fish`. Shoddy themes, for example those failing to declare global variables with the `-g` flag still require the session to be reset. See [**related**][bobthefish-19]. Closes #4.
|
||||
|
||||
* Move `getopts` implementation to `share/getopts.awk`. Closes #3.
|
||||
|
||||
* Support dots inside URIs in `fisher --validate`. Closes #2.
|
||||
|
||||
* Refactored and improved tests for `install`, `update` and `uninstall`.
|
||||
|
||||
## [0.1.0][v010] - 2016-01-01
|
||||
|
||||
* Initial commit.
|
||||
|
||||
|
||||
:anchor:
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[v010]: https://github.com/fisherman/fisherman/commit/3386ed052ae4a84338c340d37b98c1742f8a45f6
|
||||
[bobthefish-19]: https://github.com/oh-my-fish/theme-bobthefish/pull/19
|
||||
[code_of_conduct]: CODE_OF_CONDUCT.md
|
||||
|
@ -0,0 +1,55 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of
|
||||
fostering an open and welcoming community, we pledge to respect all people who
|
||||
contribute through reporting issues, posting feature requests, updating
|
||||
documentation, submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free
|
||||
experience for everyone, regardless of level of experience, gender, gender
|
||||
identity and expression, sexual orientation, disability, personal appearance,
|
||||
body size, race, ethnicity, age, religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic
|
||||
addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
By adopting this Code of Conduct, project maintainers commit themselves to
|
||||
fairly and consistently applying these principles to every aspect of managing
|
||||
this project. Project maintainers who do not follow or enforce the Code of
|
||||
Conduct may be permanently removed from the project team.
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting a project maintainer at [Fisherman][email]. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. Maintainers are
|
||||
obligated to maintain confidentiality with regard to the reporter of an
|
||||
incident.
|
||||
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 1.3.0, available at
|
||||
[http://contributor-covenant.org/version/1/3/0/][version]
|
||||
|
||||
:anchor:
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[email]: mailto:j@bucaran.me
|
||||
[version]: http://contributor-covenant.org/version/1/3/0/
|
||||
[homepage]: http://contributor-covenant.org
|
@ -0,0 +1,68 @@
|
||||
function add(k, v) {
|
||||
if (seen[k v]++) return
|
||||
print k (v == "" ? "" : " "v)
|
||||
}
|
||||
|
||||
function pop() {
|
||||
return (size <= 0) ? "_" : stack[size--]
|
||||
}
|
||||
|
||||
function push(k) {
|
||||
stack[++size] = k
|
||||
}
|
||||
|
||||
function flush() {
|
||||
while (size) {
|
||||
add(pop())
|
||||
}
|
||||
}
|
||||
|
||||
$0 == "" { next }
|
||||
|
||||
done {
|
||||
add("_" , $1$2$3)
|
||||
next
|
||||
}
|
||||
|
||||
$1 == "--" && !$2 {
|
||||
done = 1
|
||||
next
|
||||
}
|
||||
|
||||
$1 !~ /^-|^--/ {
|
||||
add(pop(), $0)
|
||||
next
|
||||
}
|
||||
|
||||
size { flush() }
|
||||
|
||||
$3 {
|
||||
for (i = 4; i <= NF; i++)
|
||||
$3 = $3" "$i
|
||||
}
|
||||
|
||||
$1 == "--" {
|
||||
if ($3 == "")
|
||||
push($2)
|
||||
else
|
||||
add($2, $3)
|
||||
}
|
||||
|
||||
$1 == "-" {
|
||||
if ($2 == "") {
|
||||
print $1
|
||||
next
|
||||
} else {
|
||||
n = split($2, keys, "")
|
||||
}
|
||||
|
||||
if ($3 == "")
|
||||
push(keys[n])
|
||||
else
|
||||
add(keys[n], $3)
|
||||
|
||||
for (i = 1; i < n; i++)
|
||||
add(keys[i])
|
||||
}
|
||||
|
||||
END { flush() }
|
@ -0,0 +1,3 @@
|
||||
function bar
|
||||
echo bar
|
||||
end
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,8 @@
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
||||
bar
|
@ -0,0 +1,3 @@
|
||||
function baz
|
||||
echo baz
|
||||
end
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1,8 @@
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
||||
baz
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,3 @@
|
||||
function foo
|
||||
echo foo
|
||||
end
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
foo
|
@ -1,28 +0,0 @@
|
||||
function create_mock_source -a path
|
||||
set -e argv[1]
|
||||
|
||||
for name in $argv
|
||||
if not mkdir -p $path/$name/{,functions,completions,man}
|
||||
return 1
|
||||
end
|
||||
|
||||
echo "function $name; end;" >> $path/$name/$name.fish
|
||||
echo > $path/$name/functions/$name.func.fish
|
||||
echo > $path/$name/completions/$name.fish
|
||||
|
||||
for n in (seq 9)
|
||||
mkdir -p $path/$name/man/man$n
|
||||
echo $name >> $path/$name/man/man$n/$name.$n
|
||||
end
|
||||
|
||||
git -C $path/$name init --quiet
|
||||
|
||||
git -C $path/$name config user.email "man@fisher"
|
||||
git -C $path/$name config user.name "fisherman"
|
||||
|
||||
git -C $path/$name add -A > /dev/null
|
||||
git -C $path/$name commit -m "add $name.fish" > /dev/null
|
||||
|
||||
printf "$name\nfile://$path/$name\n$name's plugin\nt a g s\n@$name\n\n"
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
function fisher_mock_config -a path index
|
||||
set -g fisher_config $path/config
|
||||
set -g fisher_cache $fisher_config/cache
|
||||
set -g fisher_index "file://$index"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
function fisher_mock_index
|
||||
for name in $argv[2..-1]
|
||||
printf "$name\nfile://$argv[1]/$name\ninfo\ntag1 tag2\n@$name\n\n"
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
function fisher_mock_repos
|
||||
for name in $argv
|
||||
git -C $name init --quiet
|
||||
git -C $name config user.email "git@fisherman"
|
||||
git -C $name config user.name "fisherman"
|
||||
git -C $name add -A > /dev/null
|
||||
git -C $name commit -m "$name" > /dev/null
|
||||
end
|
||||
end
|
@ -1,66 +1,75 @@
|
||||
source $DIRNAME/helpers/create_mock_source.fish
|
||||
source $DIRNAME/helpers/fisher_mock_repos.fish
|
||||
source $DIRNAME/helpers/fisher_mock_index.fish
|
||||
source $DIRNAME/helpers/fisher_mock_config.fish
|
||||
|
||||
set -l path $DIRNAME/$TESTNAME.test(random)
|
||||
set -l source $path/source
|
||||
set -l index $path/index
|
||||
set -l names foo bar
|
||||
set -l source $DIRNAME/fixtures/source
|
||||
set -l index $path/INDEX
|
||||
set -l names foo bar baz
|
||||
|
||||
function -S setup
|
||||
if not mkdir -p $path
|
||||
return 1
|
||||
end
|
||||
mkdir -p $path
|
||||
|
||||
set -g fisher_config $path/config
|
||||
set -g fisher_cache $fisher_config/cache
|
||||
set -g fisher_index "file://$index"
|
||||
fisher_mock_repos $source/*
|
||||
fisher_mock_index $source $names > $index
|
||||
fisher_mock_config $path $index
|
||||
|
||||
create_mock_source $source $names > $index
|
||||
fisher install $names[1] file://$source/$names[2..3] -q
|
||||
end
|
||||
|
||||
function -S teardown
|
||||
rm -rf $path
|
||||
rm -rf $source/{$names}.git
|
||||
end
|
||||
|
||||
for name in $names
|
||||
test "install by name:<$name>" (
|
||||
fisher install $name --quiet
|
||||
ls $fisher_cache
|
||||
test "install creates config directory if there is none"
|
||||
-d $fisher_config
|
||||
end
|
||||
|
||||
) = $name
|
||||
end
|
||||
test "install creates cache directory if there is none"
|
||||
-d $fisher_cache
|
||||
end
|
||||
|
||||
test "install by url:<file://$source/$name>" (
|
||||
fisher install file://$source/$name --quiet
|
||||
ls $fisher_cache
|
||||
test "adds installed plugins to fishfile"
|
||||
(cat $fisher_config/fishfile | xargs) = "$names"
|
||||
end
|
||||
|
||||
) = $name
|
||||
end
|
||||
test "downloads plugin repos to cache"
|
||||
(fisher --cache=base) = $names
|
||||
end
|
||||
|
||||
test "install several"
|
||||
(printf "%s\n" $names) = (
|
||||
test "download INDEX copy to the cache"
|
||||
(cat $fisher_cache/.index) = (fisher_mock_index $source $names)
|
||||
end
|
||||
|
||||
fisher install $names --quiet
|
||||
ls $fisher_cache)
|
||||
test "add completions/<plugin>.fish to completions directory"
|
||||
(ls $fisher_config/completions) = {$names}.fish
|
||||
end
|
||||
|
||||
test "install from <stdin>"
|
||||
(printf "%s\n" $names) = (
|
||||
for name in $names
|
||||
test "add <plugin>.fish to functions/$name.fish directory"
|
||||
-e $fisher_config/functions/$name.fish
|
||||
end
|
||||
|
||||
printf "%s\n" $names | fisher install --quiet
|
||||
ls $fisher_cache)
|
||||
end
|
||||
for file in $fisher_cache/$name/functions/*.fish
|
||||
test "add functions/*.fish to functions/"(basename $file)
|
||||
-e $fisher_config/functions/(basename $file)
|
||||
end
|
||||
end
|
||||
|
||||
test "add config files to conf.d"
|
||||
-e $fisher_config/conf.d/$name.config.fish
|
||||
end
|
||||
|
||||
test "install updates fishfile"
|
||||
"$names" = (
|
||||
test "add init files to conf.d as <name>.init.config"
|
||||
-e $fisher_config/conf.d/$name.init.config.fish
|
||||
end
|
||||
|
||||
fisher install $names --quiet
|
||||
xargs < $fisher_config/fishfile)
|
||||
test "add manual pages to config/man/"
|
||||
-d $fisher_config/man
|
||||
end
|
||||
end
|
||||
|
||||
test "fail install package by name"
|
||||
"fisher: 'what' not found" = (
|
||||
|
||||
fisher install "what" ^&1
|
||||
echo $status)
|
||||
test "install returns 1 if package can't be installed"
|
||||
(fisher install -q -- "what"; echo $status) = 1
|
||||
end
|
||||
|
@ -1,120 +1,48 @@
|
||||
source $DIRNAME/helpers/create_mock_source.fish
|
||||
source $DIRNAME/helpers/fisher_mock_repos.fish
|
||||
source $DIRNAME/helpers/fisher_mock_index.fish
|
||||
source $DIRNAME/helpers/fisher_mock_config.fish
|
||||
|
||||
set -l path $DIRNAME/$TESTNAME.test(random)
|
||||
set -l source $path/source
|
||||
set -l index $path/index
|
||||
set -l names foo bar
|
||||
set -l source $DIRNAME/fixtures/source
|
||||
set -l index $path/INDEX
|
||||
set -l names foo bar baz
|
||||
|
||||
function -S setup
|
||||
if not mkdir -p $path
|
||||
return 1
|
||||
end
|
||||
|
||||
set -g fisher_config $path/config
|
||||
set -g fisher_cache $fisher_config/cache
|
||||
set -g fisher_index "file://$index"
|
||||
mkdir -p $path
|
||||
|
||||
create_mock_source $source $names > $index
|
||||
fisher_mock_repos $source/*
|
||||
fisher_mock_index $source $names > $index
|
||||
fisher_mock_config $path $index
|
||||
|
||||
fisher install $names --quiet
|
||||
fisher install $names -q
|
||||
fisher uninstall $names -q
|
||||
end
|
||||
|
||||
function -S teardown
|
||||
rm -rf $path
|
||||
rm -rf $source/{$names}.git
|
||||
end
|
||||
|
||||
for name in $names
|
||||
test "uninstall <$name> does not clear cache"
|
||||
(printf "%s\n" $names) = (
|
||||
|
||||
fisher uninstall $name --quiet
|
||||
ls $fisher_cache)
|
||||
test "remove plugin from functions/$name.fish"
|
||||
! -e $fisher_config/functions/$name.fish
|
||||
end
|
||||
|
||||
test "uninstall --force clears package <$name> from cache"
|
||||
(for _name in $names
|
||||
if test $_name != $name
|
||||
printf "%s\n" $_name
|
||||
end
|
||||
end) = (
|
||||
|
||||
fisher uninstall $name --quiet --force
|
||||
ls $fisher_cache)
|
||||
test "remove plugin from completions/$name.fish"
|
||||
! -e $fisher_config/completions/$name.fish
|
||||
end
|
||||
|
||||
test "uninstall <$name> removes functions/$name.fish"
|
||||
(
|
||||
echo 0
|
||||
echo 1
|
||||
) = (
|
||||
|
||||
builtin test -f $fisher_config/functions/$name.fish
|
||||
echo $status
|
||||
|
||||
fisher uninstall $name --quiet
|
||||
|
||||
builtin test -f $fisher_config/functions/$name.fish
|
||||
echo $status)
|
||||
test "remove plugin from conf.d/$name.config.fish"
|
||||
! -e $fisher_config/conf.d/$name.config.fish
|
||||
end
|
||||
|
||||
test "uninstall <$name> removes completions/$name.fish"
|
||||
(
|
||||
echo 0
|
||||
echo 1
|
||||
) = (
|
||||
|
||||
builtin test -f $fisher_config/completions/$name.fish
|
||||
echo $status
|
||||
|
||||
fisher uninstall $name --quiet
|
||||
|
||||
builtin test -f $fisher_config/completions/$name.fish
|
||||
echo $status)
|
||||
end
|
||||
|
||||
test "uninstall <$name> removes man/man.../$name..."
|
||||
(
|
||||
for n in (seq 9)
|
||||
echo 0
|
||||
end
|
||||
|
||||
for n in (seq 9)
|
||||
echo 1
|
||||
end
|
||||
) = (
|
||||
|
||||
for n in (seq 9)
|
||||
builtin test -f $fisher_config/man/man$n/$name.$n
|
||||
echo $status
|
||||
end
|
||||
|
||||
fisher uninstall $name --quiet
|
||||
|
||||
for n in (seq 9)
|
||||
builtin test -f $fisher_config/man/man$n/$name.$n
|
||||
echo $status
|
||||
end)
|
||||
test "remove plugin from conf.d/$name.init.config.fish"
|
||||
! -e $fisher_config/conf.d/$name.init.config.fish
|
||||
end
|
||||
end
|
||||
|
||||
test "remove all installed/enabled plugins"
|
||||
-z (
|
||||
|
||||
fisher uninstall --all --quiet
|
||||
ls $fisher_config/functions
|
||||
ls $fisher_config/completions)
|
||||
end
|
||||
|
||||
test "remove all installed plugins flushing cache"
|
||||
-z (
|
||||
|
||||
fisher uninstall --all --force --quiet
|
||||
ls $fisher_cache)
|
||||
end
|
||||
|
||||
test "uninstall updates fishfile"
|
||||
"$names[2..-1]" = (
|
||||
|
||||
fisher uninstall $names[1] --quiet
|
||||
cat $fisher_config/fishfile | xargs)
|
||||
test "remove plugin manual from man/man%"
|
||||
(for file in $fisher_config/man/**
|
||||
basename $file
|
||||
end | xargs) = (echo {man}(seq 9) | xargs)
|
||||
end
|
||||
|
@ -1,36 +0,0 @@
|
||||
source $DIRNAME/helpers/create_mock_source.fish
|
||||
|
||||
set -l path $DIRNAME/$TESTNAME.test(random)
|
||||
set -l server $path/server
|
||||
set -l home fisherman
|
||||
|
||||
function -S setup
|
||||
set -g fisher_home $path/home
|
||||
|
||||
if not mkdir -p $fisher_home
|
||||
return 1
|
||||
end
|
||||
|
||||
create_mock_source $server $home > /dev/null
|
||||
|
||||
git -C $fisher_home init --quiet
|
||||
git -C $fisher_home remote add origin $server/$home/.git
|
||||
end
|
||||
|
||||
function -S teardown
|
||||
rm -rf $path
|
||||
end
|
||||
|
||||
test "update itself w/ --self"
|
||||
(ls $server/$home) = (
|
||||
|
||||
fisher update --self --quiet ^/dev/null
|
||||
ls $fisher_home)
|
||||
end
|
||||
|
||||
test "update repo at given path via git pull"
|
||||
(ls $server/$home) = (
|
||||
|
||||
fisher update --path=$fisher_home --quiet ^/dev/null
|
||||
ls $fisher_home)
|
||||
end
|
@ -1,64 +1,53 @@
|
||||
source $DIRNAME/helpers/create_mock_source.fish
|
||||
source $DIRNAME/helpers/fisher_mock_repos.fish
|
||||
source $DIRNAME/helpers/fisher_mock_index.fish
|
||||
source $DIRNAME/helpers/fisher_mock_config.fish
|
||||
|
||||
set -l path $DIRNAME/$TESTNAME.test(random)
|
||||
set -l source $path/source
|
||||
set -l index $path/index
|
||||
set -l names foo
|
||||
set -l extra norf
|
||||
set -l source $DIRNAME/fixtures/source
|
||||
set -l source2 $path/source
|
||||
set -l index $path/INDEX
|
||||
set -l names foo bar baz
|
||||
set -l names2 norf
|
||||
|
||||
function -S setup
|
||||
if not mkdir -p $path
|
||||
return 1
|
||||
end
|
||||
mkdir -p $path
|
||||
|
||||
set -g fisher_config $path/config
|
||||
set -g fisher_cache $fisher_config/cache
|
||||
set -g fisher_index "file://$index"
|
||||
fisher_mock_repos $source/*
|
||||
fisher_mock_index $source $names > $index
|
||||
fisher_mock_config $path $index
|
||||
|
||||
create_mock_source $source $names > $index
|
||||
fisher install $names --quiet
|
||||
fisher install $names -q
|
||||
|
||||
# Updates the source repos duplicating the original content.
|
||||
# See helpers/create_mock_source.fish
|
||||
mkdir -p $source2
|
||||
|
||||
create_mock_source $source $names $extra > $index
|
||||
end
|
||||
cp -rf $source $path
|
||||
|
||||
function -S teardown
|
||||
rm -rf $path
|
||||
end
|
||||
for name in $names
|
||||
set -l file $source2/$name/$name.fish
|
||||
sed "s/echo $name/echo $name v2/" $file > $file.tmp
|
||||
mv $file.tmp $file
|
||||
|
||||
for name in $names
|
||||
test "update <$name> package copy in cache"
|
||||
(functions $name $name | xargs) = (
|
||||
fisher_mock_repos $source2/$name
|
||||
|
||||
fisher update $name --quiet
|
||||
fish_indent < $fisher_cache/$name/$name.fish | xargs)
|
||||
git -C $fisher_cache/$name remote rm origin
|
||||
git -C $fisher_cache/$name remote add origin file://$source2/$name
|
||||
end
|
||||
|
||||
test "install <$name> if update is successful"
|
||||
(functions $name $name | xargs) = (
|
||||
|
||||
fisher update $name --quiet
|
||||
fish_indent < $fisher_config/functions/$name.fish | xargs)
|
||||
end
|
||||
fisher_mock_index $source $names $names2 > $index
|
||||
end
|
||||
|
||||
test "update packages via <stdin>"
|
||||
(functions $names $names | xargs) = (
|
||||
|
||||
printf "%s\n" $names | fisher update --quiet
|
||||
cat $fisher_config/functions/{$names}.fish | fish_indent | xargs)
|
||||
function -S teardown
|
||||
rm -rf $path
|
||||
rm -rf $source/{$names}/.git
|
||||
end
|
||||
|
||||
test "update cache"
|
||||
(functions $names $names | xargs) = (
|
||||
|
||||
fisher update --cache --quiet
|
||||
cat $fisher_config/functions/{$names}.fish | fish_indent | xargs)
|
||||
for name in $names
|
||||
test "update <$name> in cache" (
|
||||
fisher update $name -q
|
||||
eval $name) = "$name v2"
|
||||
end
|
||||
end
|
||||
|
||||
test "update index with --index using contents in \$fisher_index" (
|
||||
fisher update --index --quiet
|
||||
awk -F'\n' -v RS='' '{ print $1 }' $fisher_cache/.index) = $names $extra
|
||||
test "update index"
|
||||
(fisher update --index; cat $fisher_config/cache/.index) = (cat $index)
|
||||
end
|
||||
|
Loading…
Reference in New Issue