Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
cef1a627
Commit
cef1a627
authored
Feb 25, 2012
by
Luke Redpath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the downloaders to still work with Dependency objects.
parent
55141923
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
25 deletions
+40
-25
dependency.rb
lib/cocoapods/dependency.rb
+6
-1
downloader.rb
lib/cocoapods/downloader.rb
+23
-13
git.rb
lib/cocoapods/downloader/git.rb
+5
-5
mercurial.rb
lib/cocoapods/downloader/mercurial.rb
+3
-3
subversion.rb
lib/cocoapods/downloader/subversion.rb
+3
-3
No files found.
lib/cocoapods/dependency.rb
View file @
cef1a627
...
@@ -90,13 +90,18 @@ module Pod
...
@@ -90,13 +90,18 @@ module Pod
end
end
else
else
puts
" * Pre-downloading: `
#{
@name
}
'"
unless
config
.
silent?
puts
" * Pre-downloading: `
#{
@name
}
'"
unless
config
.
silent?
Downloader
.
for_source
(
pod_root
,
@external_spec_source
).
download
pod
=
LocalPods
.
new
Downloader
.
for_dependency
(
self
).
download
spec
=
pod_root
+
"
#{
@name
}
.podspec"
spec
=
pod_root
+
"
#{
@name
}
.podspec"
end
end
Specification
.
from_file
(
spec
)
Specification
.
from_file
(
spec
)
end
end
end
end
end
end
def
pod_root
config
.
project_pods_root
+
@name
end
# Taken from RubyGems 1.3.7
# Taken from RubyGems 1.3.7
unless
public_method_defined?
(
:match?
)
unless
public_method_defined?
(
:match?
)
...
...
lib/cocoapods/downloader.rb
View file @
cef1a627
...
@@ -7,26 +7,36 @@ module Pod
...
@@ -7,26 +7,36 @@ module Pod
extend
Executable
extend
Executable
def
self
.
for_pod
(
pod
)
def
self
.
for_pod
(
pod
)
options
=
pod
.
specification
.
source
.
dup
for_target
(
pod
.
root
,
pod
.
specification
.
source
.
dup
)
if
url
=
options
.
delete
(
:git
)
end
Git
.
new
(
pod
,
url
,
options
)
elsif
url
=
options
.
delete
(
:hg
)
def
self
.
for_dependency
(
dependency
)
Mercurial
.
new
(
pod
,
url
,
options
)
for_target
(
dependency
.
pod_root
,
dependency
.
external_spec_source
)
elsif
url
=
options
.
delete
(
:svn
)
Subversion
.
new
(
pod
,
url
,
options
)
else
raise
"Unsupported download strategy `
#{
options
.
inspect
}
'."
end
end
end
attr_reader
:
pod
,
:url
,
:options
attr_reader
:
target_path
,
:url
,
:options
def
initialize
(
pod
,
url
,
options
)
def
initialize
(
target_path
,
url
,
options
)
@pod
,
@url
,
@options
=
pod
,
url
,
options
@target_path
,
@url
,
@options
=
target_path
,
url
,
options
@target_path
.
mkpath
end
end
def
clean
def
clean
# implement in sub-classes
# implement in sub-classes
end
end
private
def
self
.
for_target
(
target_path
,
options
)
if
url
=
options
.
delete
(
:git
)
Git
.
new
(
target_path
,
url
,
options
)
elsif
url
=
options
.
delete
(
:hg
)
Mercurial
.
new
(
target_path
,
url
,
options
)
elsif
url
=
options
.
delete
(
:svn
)
Subversion
.
new
(
target_path
,
url
,
options
)
else
raise
"Unsupported download strategy `
#{
options
.
inspect
}
'."
end
end
end
end
end
end
lib/cocoapods/downloader/git.rb
View file @
cef1a627
...
@@ -14,11 +14,11 @@ module Pod
...
@@ -14,11 +14,11 @@ module Pod
end
end
def
download_head
def
download_head
git
"clone '
#{
url
}
' '
#{
pod
.
root
}
'"
git
"clone '
#{
url
}
' '
#{
target_path
}
'"
end
end
def
download_tag
def
download_tag
pod
.
chdir
do
Dir
.
chdir
(
target_path
)
do
git
"init"
git
"init"
git
"remote add origin '
#{
url
}
'"
git
"remote add origin '
#{
url
}
'"
git
"fetch origin tags/
#{
options
[
:tag
]
}
"
git
"fetch origin tags/
#{
options
[
:tag
]
}
"
...
@@ -28,15 +28,15 @@ module Pod
...
@@ -28,15 +28,15 @@ module Pod
end
end
def
download_commit
def
download_commit
git
"clone '
#{
url
}
' '
#{
pod
.
root
}
'"
git
"clone '
#{
url
}
' '
#{
target_path
}
'"
pod
.
chdir
do
Dir
.
chdir
(
target_path
)
do
git
"checkout -b activated-pod-commit
#{
options
[
:commit
]
}
"
git
"checkout -b activated-pod-commit
#{
options
[
:commit
]
}
"
end
end
end
end
def
clean
def
clean
(
pod
.
root
+
'.git'
).
rmtree
(
target_path
+
'.git'
).
rmtree
end
end
end
end
end
end
...
...
lib/cocoapods/downloader/mercurial.rb
View file @
cef1a627
...
@@ -12,15 +12,15 @@ module Pod
...
@@ -12,15 +12,15 @@ module Pod
end
end
def
download_head
def
download_head
hg
"clone '
#{
url
}
' '
#{
pod
.
root
}
'"
hg
"clone '
#{
url
}
' '
#{
target_path
}
'"
end
end
def
download_revision
def
download_revision
hg
"clone '
#{
url
}
' --rev '
#{
options
[
:revision
]
}
' '
#{
pod
.
root
}
'"
hg
"clone '
#{
url
}
' --rev '
#{
options
[
:revision
]
}
' '
#{
target_path
}
'"
end
end
def
clean
def
clean
(
pod
.
root
+
'.hg'
).
rmtree
(
target_path
+
'.hg'
).
rmtree
end
end
end
end
end
end
...
...
lib/cocoapods/downloader/subversion.rb
View file @
cef1a627
...
@@ -12,15 +12,15 @@ module Pod
...
@@ -12,15 +12,15 @@ module Pod
end
end
def
download_head
def
download_head
svn
"checkout '
#{
url
}
' '
#{
pod
.
root
}
'"
svn
"checkout '
#{
url
}
' '
#{
target_path
}
'"
end
end
def
download_revision
def
download_revision
svn
"checkout '
#{
url
}
' -r '
#{
options
[
:revision
]
}
' '
#{
pod
.
root
}
'"
svn
"checkout '
#{
url
}
' -r '
#{
options
[
:revision
]
}
' '
#{
target_path
}
'"
end
end
def
clean
def
clean
pod
.
root
.
glob
(
'**/.svn'
).
each
(
&
:rmtree
)
target_path
.
glob
(
'**/.svn'
).
each
(
&
:rmtree
)
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment