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
Hide 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
...
@@ -3,7 +3,7 @@ module Pod
class
Install
<
Command
class
Install
<
Command
def
run
def
run
if
spec
=
Specification
.
from_podfile
(
podfile
)
if
spec
=
Specification
.
from_podfile
(
podfile
)
spec
.
install_dependent_specifications!
(
pods_root
)
spec
.
install_dependent_specifications!
(
pods_root
,
true
)
else
else
$stderr
.
puts
"No Podfile found in current working directory."
$stderr
.
puts
"No Podfile found in current working directory."
end
end
...
...
lib/cocoa_pods/downloader.rb
View file @
79fa28ac
module
Pod
module
Pod
class
Downloader
class
Downloader
def
self
.
for_source
(
source
)
def
self
.
for_source
(
source
,
pod_root
)
options
=
source
.
dup
options
=
source
.
dup
if
url
=
options
.
delete
(
:git
)
if
url
=
options
.
delete
(
:git
)
Git
.
new
(
url
,
options
)
Git
.
new
(
pod_root
,
url
,
options
)
else
else
raise
"Unsupported download strategy `
#{
source
.
inspect
}
'."
raise
"Unsupported download strategy `
#{
source
.
inspect
}
'."
end
end
end
end
def
initialize
(
url
,
options
)
def
initialize
(
pod_root
,
url
,
options
)
@
url
,
@options
=
url
,
options
@
pod_root
,
@url
,
@options
=
pod_root
,
url
,
options
end
end
class
Git
<
Downloader
class
Git
<
Downloader
...
@@ -22,11 +22,14 @@ module Pod
...
@@ -22,11 +22,14 @@ module Pod
# * sync output
# * sync output
executable
:git
executable
:git
def
download_to
(
pod_root
)
def
source_dir
checkout
=
pod_root
+
'source'
@pod_root
+
'source'
end
def
download
if
tag
=
@options
[
:tag
]
if
tag
=
@options
[
:tag
]
checkout
.
mkdir
source_dir
.
mkdir
Dir
.
chdir
(
checkout
)
do
Dir
.
chdir
(
source_dir
)
do
git
"init"
git
"init"
git
"remote add origin '
#{
@url
}
'"
git
"remote add origin '
#{
@url
}
'"
git
"fetch origin tags/
#{
tag
}
2>&1"
git
"fetch origin tags/
#{
tag
}
2>&1"
...
@@ -34,14 +37,18 @@ module Pod
...
@@ -34,14 +37,18 @@ module Pod
git
"checkout -b activated-pod-commit 2>&1"
git
"checkout -b activated-pod-commit 2>&1"
end
end
elsif
commit
=
@options
[
:commit
]
elsif
commit
=
@options
[
:commit
]
git
"clone '
#{
@url
}
' '
#{
checkout
}
'"
git
"clone '
#{
@url
}
' '
#{
source_dir
}
'"
Dir
.
chdir
(
checkout
)
do
Dir
.
chdir
(
source_dir
)
do
git
"checkout -b activated-pod-commit
#{
commit
}
2>&1"
git
"checkout -b activated-pod-commit
#{
commit
}
2>&1"
end
end
else
else
raise
"Either a tag or a commit has to be specified."
raise
"Either a tag or a commit has to be specified."
end
end
end
end
def
clean
(
source_dir
+
'.git'
).
rmtree
end
end
end
end
end
end
end
lib/cocoa_pods/specification.rb
View file @
79fa28ac
...
@@ -87,7 +87,7 @@ module Pod
...
@@ -87,7 +87,7 @@ module Pod
@resolved_dependent_specifications
||=
Resolver
.
new
(
self
).
resolve
@resolved_dependent_specifications
||=
Resolver
.
new
(
self
).
resolve
end
end
def
install_dependent_specifications!
(
root
)
def
install_dependent_specifications!
(
root
,
clean
)
resolved_dependent_specifications
.
each
do
|
spec
|
resolved_dependent_specifications
.
each
do
|
spec
|
install_spec
=
spec
install_spec
=
spec
if
part_of_spec_dep
=
spec
.
read
(
:part_of
)
if
part_of_spec_dep
=
spec
.
read
(
:part_of
)
...
@@ -96,12 +96,12 @@ module Pod
...
@@ -96,12 +96,12 @@ module Pod
else
else
puts
"-- Installing:
#{
install_spec
}
"
puts
"-- Installing:
#{
install_spec
}
"
end
end
install_spec
.
install!
(
root
)
install_spec
.
install!
(
root
,
clean
)
end
end
end
end
# User can override this for custom installation
# User can override this for custom installation
def
install!
(
pods_root
)
def
install!
(
pods_root
,
clean
)
require
'fileutils'
require
'fileutils'
pods_root
.
mkpath
pods_root
.
mkpath
pod_root
=
pods_root
+
"
#{
@name
}
-
#{
@version
}
"
pod_root
=
pods_root
+
"
#{
@name
}
-
#{
@version
}
"
...
@@ -110,13 +110,15 @@ module Pod
...
@@ -110,13 +110,15 @@ module Pod
else
else
pod_root
.
mkdir
pod_root
.
mkdir
FileUtils
.
cp
(
@defined_in_file
,
pod_root
)
FileUtils
.
cp
(
@defined_in_file
,
pod_root
)
download_to
(
pod_root
)
download_to
(
pod_root
,
clean
)
end
end
end
end
# User can override this for custom downloading
# User can override this for custom downloading
def
download_to
(
pod_root
)
def
download_to
(
pod_root
,
clean
)
Downloader
.
for_source
(
@source
).
download_to
(
pod_root
)
downloader
=
Downloader
.
for_source
(
@source
,
pod_root
)
downloader
.
download
downloader
.
clean
if
clean
end
end
def
from_podfile?
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