diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-12-03 17:19:02 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-12-03 17:19:02 +0000 |
commit | 2eb478a4bf9d6f4cf22bbf2fb63a0e16716ec20b (patch) | |
tree | 1a5c812029ab9e6f4617dfe3524fd9f7dbba4372 | |
parent | 41d7734651e0dd506f20bda6243cc8c2ebae0e5f (diff) | |
parent | 0fe4865455786164c95766f514b4625e6061136f (diff) |
Merge branch 'rails-3-develop' of ssh://git.mysociety.org/data/git/public/alaveteli into rails-3-develop
-rw-r--r-- | lib/tasks/themes.rake | 26 | ||||
-rwxr-xr-x | script/rails-post-deploy | 2 |
2 files changed, 19 insertions, 9 deletions
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake index 78ffe73be..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,10 +89,11 @@ 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) + FileUtils.mkdir_p plugin_dir deprecation_string = deprecated ? " using deprecated THEME_URL" : "" theme_name = theme_url_to_theme_name theme_url puts "Installing theme #{theme_name}#{deprecation_string} from #{theme_url}" diff --git a/script/rails-post-deploy b/script/rails-post-deploy index 9b3730323..a88e28b19 100755 --- a/script/rails-post-deploy +++ b/script/rails-post-deploy @@ -99,5 +99,5 @@ bundle exec rake themes:install if [ "$OPTION_STAGING_SITE" = "0" ] then -bundle exec rake assets:precompile + bundle exec rake assets:precompile fi |