diff options
author | Mark Longair <mhl@pobox.com> | 2013-12-03 12:01:07 +0000 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-12-03 14:05:02 +0000 |
commit | d4e75c6715c7ab15b257bbdd42625301783e84f6 (patch) | |
tree | e6cfc05c5c70f327e34ea711c28d3f89557e42fd /lib/tasks/themes.rake | |
parent | 986b812ed34f5515e32fbd12165c175054ab3a1d (diff) |
Try to uninstall the old theme from vendor/plugins and lib/themes
The theme install task would fail if there's an old theme present
in vendor/plugins, since it doesn't try to uninstall the plugin from
that location, only the new location. Then when the install.rb
in the new plugin runs, it'll complain that there's a
public/alavetelitheme symlink already present.
This commit changes themes:install to try to uninstall the plugin
from both locations.
Diffstat (limited to 'lib/tasks/themes.rake')
-rw-r--r-- | lib/tasks/themes.rake | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake index 7651145ca..65b142a63 100644 --- a/lib/tasks/themes.rake +++ b/lib/tasks/themes.rake @@ -9,6 +9,14 @@ namespace :themes do File.join(plugin_dir, theme_name) end + def old_theme_dir(theme_name) + File.join(Rails.root, "vendor", "plugins", theme_name) + end + + def possible_theme_dirs(theme_name) + [theme_dir(theme_name), old_theme_dir(theme_name)] + end + def checkout(commitish) puts "Checking out #{commitish}" if verbose system "git checkout #{commitish}" @@ -61,13 +69,14 @@ namespace :themes do end def uninstall(theme_name, verbose=false) - dir = theme_dir(theme_name) - if File.directory?(dir) - run_hook(theme_name, 'uninstall', verbose) - puts "Removing '#{dir}'" if verbose - rm_r dir - else - puts "Plugin doesn't exist: #{dir}" + possible_theme_dirs(theme_name).each do |dir| + if File.directory?(dir) + run_hook(theme_name, 'uninstall', verbose) + puts "Removing '#{dir}'" if verbose + rm_r dir + else + puts "Plugin doesn't exist: #{dir}" + end end end @@ -80,7 +89,7 @@ namespace :themes do end def installed?(theme_name) - File.directory?(theme_dir(theme_name)) + possible_theme_dirs(theme_name).any? { |dir| File.directory? dir } end def install_theme(theme_url, verbose, deprecated=false) |