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
79fa28ac
Commit
79fa28ac
authored
Sep 11, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up after downloading. In the case of git that means removing the .git dir from the clone.
parent
99819b9f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
17 deletions
+26
-17
install.rb
lib/cocoa_pods/command/install.rb
+1
-1
downloader.rb
lib/cocoa_pods/downloader.rb
+17
-10
specification.rb
lib/cocoa_pods/specification.rb
+8
-6
No files found.
lib/cocoa_pods/command/install.rb
View file @
79fa28ac
...
...
@@ -3,7 +3,7 @@ module Pod
class
Install
<
Command
def
run
if
spec
=
Specification
.
from_podfile
(
podfile
)
spec
.
install_dependent_specifications!
(
pods_root
)
spec
.
install_dependent_specifications!
(
pods_root
,
true
)
else
$stderr
.
puts
"No Podfile found in current working directory."
end
...
...
lib/cocoa_pods/downloader.rb
View file @
79fa28ac
module
Pod
class
Downloader
def
self
.
for_source
(
source
)
def
self
.
for_source
(
source
,
pod_root
)
options
=
source
.
dup
if
url
=
options
.
delete
(
:git
)
Git
.
new
(
url
,
options
)
Git
.
new
(
pod_root
,
url
,
options
)
else
raise
"Unsupported download strategy `
#{
source
.
inspect
}
'."
end
end
def
initialize
(
url
,
options
)
@
url
,
@options
=
url
,
options
def
initialize
(
pod_root
,
url
,
options
)
@
pod_root
,
@url
,
@options
=
pod_root
,
url
,
options
end
class
Git
<
Downloader
...
...
@@ -22,11 +22,14 @@ module Pod
# * sync output
executable
:git
def
download_to
(
pod_root
)
checkout
=
pod_root
+
'source'
def
source_dir
@pod_root
+
'source'
end
def
download
if
tag
=
@options
[
:tag
]
checkout
.
mkdir
Dir
.
chdir
(
checkout
)
do
source_dir
.
mkdir
Dir
.
chdir
(
source_dir
)
do
git
"init"
git
"remote add origin '
#{
@url
}
'"
git
"fetch origin tags/
#{
tag
}
2>&1"
...
...
@@ -34,14 +37,18 @@ module Pod
git
"checkout -b activated-pod-commit 2>&1"
end
elsif
commit
=
@options
[
:commit
]
git
"clone '
#{
@url
}
' '
#{
checkout
}
'"
Dir
.
chdir
(
checkout
)
do
git
"clone '
#{
@url
}
' '
#{
source_dir
}
'"
Dir
.
chdir
(
source_dir
)
do
git
"checkout -b activated-pod-commit
#{
commit
}
2>&1"
end
else
raise
"Either a tag or a commit has to be specified."
end
end
def
clean
(
source_dir
+
'.git'
).
rmtree
end
end
end
end
lib/cocoa_pods/specification.rb
View file @
79fa28ac
...
...
@@ -87,7 +87,7 @@ module Pod
@resolved_dependent_specifications
||=
Resolver
.
new
(
self
).
resolve
end
def
install_dependent_specifications!
(
root
)
def
install_dependent_specifications!
(
root
,
clean
)
resolved_dependent_specifications
.
each
do
|
spec
|
install_spec
=
spec
if
part_of_spec_dep
=
spec
.
read
(
:part_of
)
...
...
@@ -96,12 +96,12 @@ module Pod
else
puts
"-- Installing:
#{
install_spec
}
"
end
install_spec
.
install!
(
root
)
install_spec
.
install!
(
root
,
clean
)
end
end
# User can override this for custom installation
def
install!
(
pods_root
)
def
install!
(
pods_root
,
clean
)
require
'fileutils'
pods_root
.
mkpath
pod_root
=
pods_root
+
"
#{
@name
}
-
#{
@version
}
"
...
...
@@ -110,13 +110,15 @@ module Pod
else
pod_root
.
mkdir
FileUtils
.
cp
(
@defined_in_file
,
pod_root
)
download_to
(
pod_root
)
download_to
(
pod_root
,
clean
)
end
end
# User can override this for custom downloading
def
download_to
(
pod_root
)
Downloader
.
for_source
(
@source
).
download_to
(
pod_root
)
def
download_to
(
pod_root
,
clean
)
downloader
=
Downloader
.
for_source
(
@source
,
pod_root
)
downloader
.
download
downloader
.
clean
if
clean
end
def
from_podfile?
...
...
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