aboutsummaryrefslogtreecommitdiffstats
path: root/config/initializers
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-10-14 19:09:25 +0100
committerMark Longair <mhl@pobox.com>2013-10-15 10:27:37 +0100
commit944b1432fa06ba7a67f2a90c3528c95b6853120c (patch)
tree7a49412add8c1014ff0d63243dd40ba217b7f820 /config/initializers
parent48ede95299e286c03a45966b00990b544b727206 (diff)
Make theme URL to theme name mapping consistent
The code that extracted the theme name from each entry in THEME_URLS (in order to require code from a directory whose leaf name is the theme name) only supported git URLs that ended in '.git'. However, the themes:install rake task usefully supports a wider range of git URLs - for example, all of the following were supported: /home/whoever/themes/blah-theme => blah-theme /home/whoever/themes/blah-theme/ => blah-theme git://wherever/blah-theme.git => blah-theme ssh://wherever/blah-theme.git// => blah-theme This commit factors out a theme_url_to_theme_name method, adds tests for it, and uses that method in both: lib/tasks/themes.rake config/initializers/theme_loader.rb ... so that a wider range of theme URLs are consistently supported.
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/alaveteli.rb1
-rw-r--r--config/initializers/theme_loader.rb3
2 files changed, 2 insertions, 2 deletions
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb
index 8ae78c80c..685ddebb8 100644
--- a/config/initializers/alaveteli.rb
+++ b/config/initializers/alaveteli.rb
@@ -50,6 +50,7 @@ require 'normalize_string'
require 'alaveteli_file_types'
require 'alaveteli_localization'
require 'message_prominence'
+require 'theme'
AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales,
AlaveteliConfiguration::default_locale)
diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb
index 1ad2d01f1..b3ae11e1e 100644
--- a/config/initializers/theme_loader.rb
+++ b/config/initializers/theme_loader.rb
@@ -18,7 +18,6 @@ if Rails.env == "test"
end
else
for url in AlaveteliConfiguration::theme_urls.reverse
- theme_name = url.sub(/.*\/(.*).git/, "\\1")
- require_theme(theme_name)
+ require_theme theme_url_to_theme_name(url)
end
end