Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
932091f9
Commit
932091f9
authored
11 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
VCSDownloadStrategy: pull construction of @clone into superclass
parent
ed7f8fae
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/download_strategy.rb
+16
-30
16 additions, 30 deletions
Library/Homebrew/download_strategy.rb
with
16 additions
and
30 deletions
Library/Homebrew/download_strategy.rb
+
16
−
30
View file @
932091f9
...
@@ -42,13 +42,14 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
...
@@ -42,13 +42,14 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
def
initialize
name
,
resource
def
initialize
name
,
resource
super
super
@ref_type
,
@ref
=
destructure_spec_hash
(
resource
.
specs
)
@ref_type
,
@ref
=
destructure_spec_hash
(
resource
.
specs
)
@clone
=
HOMEBREW_CACHE
/
cache_filename
end
end
def
destructure_spec_hash
(
spec
)
def
destructure_spec_hash
(
spec
)
spec
.
each
{
|
o
|
return
o
}
spec
.
each
{
|
o
|
return
o
}
end
end
def
cache_filename
(
tag
)
def
cache_filename
(
tag
=
cache_tag
)
if
name
.
empty?
||
name
==
'__UNKNOWN__'
if
name
.
empty?
||
name
==
'__UNKNOWN__'
"
#{
ERB
::
Util
.
url_encode
(
@url
)
}
--
#{
tag
}
"
"
#{
ERB
::
Util
.
url_encode
(
@url
)
}
--
#{
tag
}
"
else
else
...
@@ -56,6 +57,10 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
...
@@ -56,6 +57,10 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
end
end
end
end
def
cache_tag
"__UNKNOWN__"
end
def
cached_location
def
cached_location
@clone
@clone
end
end
...
@@ -316,15 +321,10 @@ class S3DownloadStrategy < CurlDownloadStrategy
...
@@ -316,15 +321,10 @@ class S3DownloadStrategy < CurlDownloadStrategy
end
end
class
SubversionDownloadStrategy
<
VCSDownloadStrategy
class
SubversionDownloadStrategy
<
VCSDownloadStrategy
def
initialize
name
,
resource
@@svn
||=
'svn'
super
@@svn
||=
'svn'
if
ARGV
.
build_head?
def
cache_tag
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"svn-HEAD"
)
}
"
)
ARGV
.
build_head?
?
"svn-HEAD"
:
"svn"
else
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"svn"
)
}
"
)
end
end
end
def
repo_valid?
def
repo_valid?
...
@@ -424,11 +424,9 @@ class UnsafeSubversionDownloadStrategy < SubversionDownloadStrategy
...
@@ -424,11 +424,9 @@ class UnsafeSubversionDownloadStrategy < SubversionDownloadStrategy
end
end
class
GitDownloadStrategy
<
VCSDownloadStrategy
class
GitDownloadStrategy
<
VCSDownloadStrategy
def
initialize
name
,
resource
@@git
||=
'git'
super
@@git
||=
'git'
def
cache_tag
;
"git"
end
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"git"
)
}
"
)
end
def
fetch
def
fetch
ohai
"Cloning
#@url
"
ohai
"Cloning
#@url
"
...
@@ -568,10 +566,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
...
@@ -568,10 +566,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
end
end
class
CVSDownloadStrategy
<
VCSDownloadStrategy
class
CVSDownloadStrategy
<
VCSDownloadStrategy
def
initialize
name
,
resource
def
cache_tag
;
"cvs"
end
super
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"cvs"
)
}
"
)
end
def
fetch
def
fetch
ohai
"Checking out
#{
@url
}
"
ohai
"Checking out
#{
@url
}
"
...
@@ -616,10 +611,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
...
@@ -616,10 +611,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
end
end
class
MercurialDownloadStrategy
<
VCSDownloadStrategy
class
MercurialDownloadStrategy
<
VCSDownloadStrategy
def
initialize
name
,
resource
def
cache_tag
;
"hg"
end
super
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"hg"
)
}
"
)
end
def
hgpath
def
hgpath
# #{HOMEBREW_PREFIX}/share/python/hg is deprecated, but we levae it in for a while
# #{HOMEBREW_PREFIX}/share/python/hg is deprecated, but we levae it in for a while
...
@@ -669,10 +661,7 @@ class MercurialDownloadStrategy < VCSDownloadStrategy
...
@@ -669,10 +661,7 @@ class MercurialDownloadStrategy < VCSDownloadStrategy
end
end
class
BazaarDownloadStrategy
<
VCSDownloadStrategy
class
BazaarDownloadStrategy
<
VCSDownloadStrategy
def
initialize
name
,
resource
def
cache_tag
;
"bzr"
end
super
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"bzr"
)
}
"
)
end
def
bzrpath
def
bzrpath
@path
||=
%W[
@path
||=
%W[
...
@@ -715,10 +704,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
...
@@ -715,10 +704,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
end
end
class
FossilDownloadStrategy
<
VCSDownloadStrategy
class
FossilDownloadStrategy
<
VCSDownloadStrategy
def
initialize
name
,
resource
def
cache_tag
;
"fossil"
end
super
@clone
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE
}
/
#{
cache_filename
(
"fossil"
)
}
"
)
end
def
fossilpath
def
fossilpath
@path
||=
%W[
@path
||=
%W[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment