aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-04-07 00:49:56 -0500
committerJack Nagel2013-04-07 20:59:50 -0500
commit8cf0f34aa75aff18383fc4aa105d831be941f59f (patch)
treef5fcc73672431b040dc6fb83f20d516ec04b223b
parent2288f631973b708224d0296f3b6a276c9a714d97 (diff)
downloadbrew-8cf0f34aa75aff18383fc4aa105d831be941f59f.tar.bz2
Download strategies require a usable name
We should handle this case in some predictable way, but until we do, let's raise a more appropriate exception. It would also be good to get rid of the duplication here.
-rw-r--r--Library/Homebrew/download_strategy.rb27
1 files changed, 20 insertions, 7 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 80631d86c..27542a3fd 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -209,9 +209,14 @@ class SubversionDownloadStrategy < AbstractDownloadStrategy
def initialize name, package
super
@@svn ||= 'svn'
- @unique_token="#{name}--svn" unless name.to_s.empty? or name == '__UNKNOWN__'
- @unique_token += "-HEAD" if ARGV.include? '--HEAD'
- @co=HOMEBREW_CACHE+@unique_token
+
+ if name.to_s.empty? || name == '__UNKNOWN__'
+ raise NotImplementedError, "strategy requires a name parameter"
+ else
+ @co = HOMEBREW_CACHE + "#{name}--svn"
+ end
+
+ @co << "-HEAD" if ARGV.build_head?
end
def cached_location
@@ -307,8 +312,12 @@ class GitDownloadStrategy < AbstractDownloadStrategy
def initialize name, package
super
@@git ||= 'git'
- @unique_token="#{name}--git" 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 = HOMEBREW_CACHE + "#{name}--git"
+ end
end
def cached_location
@@ -457,8 +466,12 @@ end
class CVSDownloadStrategy < AbstractDownloadStrategy
def initialize name, package
super
- @unique_token="#{name}--cvs" unless name.to_s.empty? or name == '__UNKNOWN__'
- @co=HOMEBREW_CACHE+@unique_token
+
+ if name.to_s.empty? || name == '__UNKNOWN__'
+ raise NotImplementedError, "strategy requires a name parameter"
+ else
+ @co = HOMEBREW_CACHE + "#{name}--cvs"
+ end
end
def cached_location; @co; end