Merge pull request #149 from derekstavis/package-dependencies

Implement automatic dependency resolution
pull/180/head
Derek Willian Stavis 9 years ago
commit 93ddd6f213

@ -4,6 +4,7 @@
# OVERVIEW
# Require a plugin:
# - Autoload its functions and completions.
# - Require bundle dependencies.
# - Source its initialization file.
# - Emit its initialization event.
#
@ -16,8 +17,18 @@ function require -a name
and return 0
for path in {$OMF_PATH,$OMF_CONFIG}/pkg/$name
test -d $path; or continue
if autoload $path $path/functions $path/completions
if test -f $path/bundle
for line in (cat $path/bundle)
test (echo $line | cut -d' ' -f1) = package;
and set dependency (basename (echo $line | cut -d' ' -f2));
and require $dependency
end
end
source $path/init.fish ^/dev/null;
or source $path/$name.fish ^/dev/null;
and emit init_$name $path

@ -1,5 +1,7 @@
function omf.bundle.install
set bundle $OMF_CONFIG/bundle
test -n "$argv";
and set bundle $argv
or set bundle $OMF_CONFIG/bundle
if test -f $bundle
set packages (omf.packages.list --installed)

@ -34,6 +34,7 @@ function omf.install -a name_or_url
echo (omf::dim)"Installing $install_type $name"(omf::off)
if omf.repo.clone $url $OMF_PATH/$parent_path/$name
omf.bundle.install $OMF_PATH/$parent_path/$name/bundle
omf.bundle.add $install_type $name_or_url
__omf.install.success "$install_type $name"

@ -19,6 +19,9 @@ function omf.update -a name
not test -e "$path/.git"; and continue
omf.repo.pull $path; and set return_success
set -q return_success;
and omf.bundle.install $path/bundle
end
set -q return_success; and __omf.update.success "$name"

Loading…
Cancel
Save