Do not overwrite themes when installing from bundle (#385)

This commit is contained in:
Stephen M. Coakley 2016-08-29 22:18:27 -05:00 committed by GitHub
parent 87cce30562
commit fb6c2992ba
2 changed files with 19 additions and 23 deletions

View File

@ -10,6 +10,11 @@ function omf.cli.install
omf.packages.install $package; omf.packages.install $package;
and require $package and require $package
# If package is a theme, set it to active.
if contains "$package" (omf.packages.list --installed --theme)
omf.theme.set "$package"
end
test $status != 0; test $status != 0;
and set fail_count (math $fail_count + 1) and set fail_count (math $fail_count + 1)
end end

View File

@ -11,7 +11,6 @@ function __omf.packages.install.error.already
end end
function omf.packages.install -a name_or_url function omf.packages.install -a name_or_url
if test \( -e $OMF_PATH/db/themes/$name_or_url \) -o (echo $name_or_url | grep theme-) if test \( -e $OMF_PATH/db/themes/$name_or_url \) -o (echo $name_or_url | grep theme-)
set install_type "theme" set install_type "theme"
set parent_path "themes" set parent_path "themes"
@ -29,34 +28,26 @@ function omf.packages.install -a name_or_url
end end
if test -e $OMF_PATH/$parent_path/$name if test -e $OMF_PATH/$parent_path/$name
if test "$install_type" = theme __omf.packages.install.error.already "$install_type $name_or_url"
omf.theme.set $name return $OMF_INVALID_ARG
else end
__omf.packages.install.error.already "$install_type $name_or_url"
return $OMF_INVALID_ARG
end
else
echo (omf::dim)"Installing $install_type $name"(omf::off)
if omf.repo.clone $url $OMF_PATH/$parent_path/$name echo (omf::dim)"Installing $install_type $name"(omf::off)
omf.bundle.install $OMF_PATH/$parent_path/$name/bundle
omf.bundle.add $install_type $name_or_url
# Run the install hook. if omf.repo.clone $url $OMF_PATH/$parent_path/$name
if not omf.packages.run_hook $OMF_PATH/$parent_path/$name install omf.bundle.install $OMF_PATH/$parent_path/$name/bundle
__omf.packages.install.error "$install_type $name" omf.bundle.add $install_type $name_or_url
return $OMF_UNKNOWN_ERR
end
__omf.packages.install.success "$install_type $name" # Run the install hook.
if not omf.packages.run_hook $OMF_PATH/$parent_path/$name install
if test "$install_type" = theme
omf.theme.set $name
end
else
__omf.packages.install.error "$install_type $name" __omf.packages.install.error "$install_type $name"
return $OMF_UNKNOWN_ERR return $OMF_UNKNOWN_ERR
end end
__omf.packages.install.success "$install_type $name"
else
__omf.packages.install.error "$install_type $name"
return $OMF_UNKNOWN_ERR
end end
return 0 return 0