From 944b1432fa06ba7a67f2a90c3528c95b6853120c Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Mon, 14 Oct 2013 19:09:25 +0100 Subject: 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. --- lib/tasks/themes.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/tasks') diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake index a8d16f108..1eed92f1e 100644 --- a/lib/tasks/themes.rake +++ b/lib/tasks/themes.rake @@ -85,7 +85,7 @@ namespace :themes do def install_theme(theme_url, verbose, deprecated=false) deprecation_string = deprecated ? " using deprecated THEME_URL" : "" - theme_name = File.basename(theme_url, '.git') + theme_name = theme_url_to_theme_name theme_url puts "Installing theme #{theme_name}#{deprecation_string} from #{theme_url}" uninstall(theme_name, verbose) if installed?(theme_name) install_theme_using_git(theme_name, theme_url, verbose) -- cgit v1.2.3