diff options
| author | Jack Nagel | 2013-04-07 00:49:56 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-04-07 20:59:50 -0500 |
| commit | 53a22e1d4e72c9777dd75ece8635e485786c1324 (patch) | |
| tree | daa681ae51fd98d49e9e9aa862d12dc78047c027 /Library | |
| parent | 446e9888dab891cebe7ca1333f69e5aa26bb2373 (diff) | |
| download | homebrew-53a22e1d4e72c9777dd75ece8635e485786c1324.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.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 27 |
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 |
