From 841c8bedcaab1417d4745319d2dec02c81b4cfae Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 15 Apr 2013 15:00:57 -0500 Subject: [PATCH] Clean up remaining DownloadStrategy initializers --- Library/Homebrew/download_strategy.rb | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 9548a268b7..013cc4ab28 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -470,7 +470,8 @@ class CVSDownloadStrategy < AbstractDownloadStrategy if name.to_s.empty? || name == '__UNKNOWN__' raise NotImplementedError, "strategy requires a name parameter" else - @co = HOMEBREW_CACHE + "#{name}--cvs" + @unique_token = "#{name}--cvs" + @co = Pathname.new("#{HOMEBREW_CACHE}/#{@unique_token}") end end @@ -521,8 +522,12 @@ end class MercurialDownloadStrategy < AbstractDownloadStrategy def initialize name, package super - @unique_token="#{name}--hg" unless name.to_s.empty? or name == '__UNKNOWN__' - @clone=HOMEBREW_CACHE+@unique_token + + if name.to_s.empty? || name == '__UNKNOWN__' + raise NotImplementedError, "strategy requires a name parameter" + else + @clone = Pathname.new("#{HOMEBREW_CACHE}/#{name}--hg") + end end def cached_location; @clone; end @@ -568,8 +573,12 @@ end class BazaarDownloadStrategy < AbstractDownloadStrategy def initialize name, package super - @unique_token="#{name}--bzr" unless name.to_s.empty? or name == '__UNKNOWN__' - @clone=HOMEBREW_CACHE+@unique_token + + if name.to_s.empty? || name == '__UNKNOWN__' + raise NotImplementedError, "strategy requires a name parameter" + else + @clone = Pathname.new("#{HOMEBREW_CACHE}/#{name}--bzr") + end end def cached_location; @clone; end @@ -618,8 +627,11 @@ end class FossilDownloadStrategy < AbstractDownloadStrategy def initialize name, package super - @unique_token="#{name}--fossil" unless name.to_s.empty? or name == '__UNKNOWN__' - @clone=HOMEBREW_CACHE+@unique_token + if name.to_s.empty? || name == '__UNKNOWN__' + raise NotImplementedError, "strategy requires a name parameter" + else + @clone = Pathname.new("#{HOMEBREW_CACHE}/#{name}--fossil") + end end def cached_location; @clone; end