diff options
| author | Jack Nagel | 2014-12-18 13:06:05 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-12-18 13:06:05 -0500 |
| commit | 0f512e45176fe87a11a17d2ce8e8aeb4e7c3c4f3 (patch) | |
| tree | a22c7793409132c5f8aa842ddf12c7fe96ed90a6 /Library/Homebrew/download_strategy.rb | |
| parent | f86e2f897463a449d66eb8448ebb81708ffb0894 (diff) | |
| download | homebrew-0f512e45176fe87a11a17d2ce8e8aeb4e7c3c4f3.tar.bz2 | |
Move url munging to initialize
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 9e3f29d44..df92f7da5 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -639,6 +639,11 @@ class GitDownloadStrategy < VCSDownloadStrategy end class CVSDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^cvs://], "") + end + def stage cp_r Dir[cached_location+"{.}"], Dir.pwd end @@ -671,7 +676,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy end def split_url(in_url) - parts=in_url.sub(%r[^cvs://], '').split(/:/) + parts = in_url.split(/:/) mod=parts.pop url=parts.join(':') [ mod, url ] @@ -679,6 +684,11 @@ class CVSDownloadStrategy < VCSDownloadStrategy end class MercurialDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^hg://], "") + end + def stage super @@ -703,7 +713,6 @@ class MercurialDownloadStrategy < VCSDownloadStrategy end def clone_repo - url = @url.sub(%r[^hg://], "") safe_system hgpath, "clone", url, cached_location end @@ -713,6 +722,11 @@ class MercurialDownloadStrategy < VCSDownloadStrategy end class BazaarDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^bzr://], "") + end + def stage # The export command doesn't work on checkouts # See https://bugs.launchpad.net/bzr/+bug/897511 @@ -731,7 +745,6 @@ class BazaarDownloadStrategy < VCSDownloadStrategy end def clone_repo - url = @url.sub(%r[^bzr://], "") # "lightweight" means history-less safe_system bzrpath, "checkout", "--lightweight", url, cached_location end @@ -742,6 +755,11 @@ class BazaarDownloadStrategy < VCSDownloadStrategy end class FossilDownloadStrategy < VCSDownloadStrategy + def initialize(name, resource) + super + @url = @url.sub(%r[^fossil://], "") + end + def stage super args = [fossilpath, "open", cached_location] @@ -756,7 +774,6 @@ class FossilDownloadStrategy < VCSDownloadStrategy end def clone_repo - url = @url.sub(%r[^fossil://], "") safe_system fossilpath, "clone", url, cached_location end |
