From fb6c2992ba1f85927c7ac6e565d507a0868718b8 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Mon, 29 Aug 2016 22:18:27 -0500 Subject: [PATCH] Do not overwrite themes when installing from bundle (#385) --- pkg/omf/functions/cli/omf.cli.install.fish | 5 +++ .../packages/omf.packages.install.fish | 37 +++++++------------ 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/pkg/omf/functions/cli/omf.cli.install.fish b/pkg/omf/functions/cli/omf.cli.install.fish index e20abe2..828df24 100644 --- a/pkg/omf/functions/cli/omf.cli.install.fish +++ b/pkg/omf/functions/cli/omf.cli.install.fish @@ -10,6 +10,11 @@ function omf.cli.install omf.packages.install $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; and set fail_count (math $fail_count + 1) end diff --git a/pkg/omf/functions/packages/omf.packages.install.fish b/pkg/omf/functions/packages/omf.packages.install.fish index b7253f3..3b3680d 100644 --- a/pkg/omf/functions/packages/omf.packages.install.fish +++ b/pkg/omf/functions/packages/omf.packages.install.fish @@ -11,7 +11,6 @@ function __omf.packages.install.error.already end 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-) set install_type "theme" set parent_path "themes" @@ -29,34 +28,26 @@ function omf.packages.install -a name_or_url end if test -e $OMF_PATH/$parent_path/$name - if test "$install_type" = theme - omf.theme.set $name - else - __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) + __omf.packages.install.error.already "$install_type $name_or_url" + return $OMF_INVALID_ARG + end - 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 + echo (omf::dim)"Installing $install_type $name"(omf::off) - # Run the install hook. - if not omf.packages.run_hook $OMF_PATH/$parent_path/$name install - __omf.packages.install.error "$install_type $name" - return $OMF_UNKNOWN_ERR - end + 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.packages.install.success "$install_type $name" - - if test "$install_type" = theme - omf.theme.set $name - end - else + # Run the install hook. + if not omf.packages.run_hook $OMF_PATH/$parent_path/$name install __omf.packages.install.error "$install_type $name" return $OMF_UNKNOWN_ERR end + + __omf.packages.install.success "$install_type $name" + else + __omf.packages.install.error "$install_type $name" + return $OMF_UNKNOWN_ERR end return 0