From 6c4759278e010ff6a47575a3eff14b8516bacdef Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 8 Feb 2009 01:20:12 -0800 Subject: [PATCH] Don't return a trailing slash from templatize or targetize. --- lib/compass/actions.rb | 7 ++++++- lib/compass/commands/project_base.rb | 3 --- lib/compass/installers/base.rb | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/compass/actions.rb b/lib/compass/actions.rb index a853ee40..357ae6c7 100644 --- a/lib/compass/actions.rb +++ b/lib/compass/actions.rb @@ -33,7 +33,7 @@ module Compass msg = "#{basename(dir)} already exists and is not a directory." raise Compass::FilesystemConflict.new(msg) else - logger.record :directory, basename(dir) + logger.record :directory, separate("#{basename(dir)}/") FileUtils.mkdir_p(dir) unless options[:dry_run] end end @@ -94,5 +94,10 @@ module Compass path.gsub(%r{/}, File::SEPARATOR) end + # Removes the trailing separator, if any, from a path. + def strip_trailing_separator(path) + (path[-1..-1] == File::SEPARATOR) ? path[0..-2] : path + end + end end \ No newline at end of file diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 96350820..887559a8 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -69,9 +69,6 @@ module Compass path.index(File::SEPARATOR) == 0 end - def strip_trailing_separator(path) - (path[-1..-1] == File::SEPARATOR) ? path[0..-2] : path - end end end end \ No newline at end of file diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index 8fcafc83..16439df9 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -107,13 +107,13 @@ module Compass # returns an absolute path given a path relative to the current installation target. # Paths can use unix style "/" and will be corrected for the current platform. def targetize(path) - File.join(target_path, separate(path)) + strip_trailing_separator File.join(target_path, separate(path)) end # returns an absolute path given a path relative to the current template. # Paths can use unix style "/" and will be corrected for the current platform. def templatize(path) - File.join(template_path, separate(path)) + strip_trailing_separator File.join(template_path, separate(path)) end def stylesheet_links