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
af1c8727
Commit
af1c8727
authored
Apr 02, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Downloader] Centralize downloading in Downloader.download
parent
3a30b7a2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
26 deletions
+31
-26
config.rb
lib/cocoapods/config.rb
+6
-4
downloader.rb
lib/cocoapods/downloader.rb
+22
-0
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+1
-5
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-5
integration.rb
spec/integration.rb
+1
-1
abstract_external_source_spec.rb
spec/unit/external_sources/abstract_external_source_spec.rb
+0
-11
No files found.
lib/cocoapods/config.rb
View file @
af1c8727
...
@@ -15,6 +15,7 @@ module Pod
...
@@ -15,6 +15,7 @@ module Pod
:verbose
=>
false
,
:verbose
=>
false
,
:silent
=>
false
,
:silent
=>
false
,
:skip_repo_update
=>
false
,
:skip_repo_update
=>
false
,
:skip_download_cache
=>
!
ENV
[
'COCOAPODS_SKIP_CACHE'
].
nil?
,
:clean
=>
true
,
:clean
=>
true
,
:integrate_targets
=>
true
,
:integrate_targets
=>
true
,
...
@@ -66,6 +67,11 @@ module Pod
...
@@ -66,6 +67,11 @@ module Pod
attr_accessor
:skip_repo_update
attr_accessor
:skip_repo_update
alias_method
:skip_repo_update?
,
:skip_repo_update
alias_method
:skip_repo_update?
,
:skip_repo_update
# @return [Bool] Whether the installer should skip the download cache.
#
attr_accessor
:skip_download_cache
alias_method
:skip_download_cache?
,
:skip_download_cache
public
public
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -82,10 +88,6 @@ module Pod
...
@@ -82,10 +88,6 @@ module Pod
@cache_root
@cache_root
end
end
def
download_cache
@download_cache
||=
Downloader
::
Cache
.
new
(
cache_root
+
'Pods'
)
end
public
public
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
...
lib/cocoapods/downloader.rb
View file @
af1c8727
require
'cocoapods-downloader'
require
'cocoapods-downloader'
require
'claide/informative_error'
require
'claide/informative_error'
require
'fileutils'
require
'tmpdir'
module
Pod
module
Pod
module
Downloader
module
Downloader
require
'cocoapods/downloader/cache'
require
'cocoapods/downloader/cache'
def
self
.
download
(
name_or_spec
,
download_target
,
released:
false
,
downloader_options:
nil
,
head:
false
,
cache_path:
!
Config
.
instance
.
skip_download_cache
&&
Config
.
instance
.
cache_root
+
'Pods'
)
cache_path
,
tmp_cache
=
Pathname
(
Dir
.
mktmpdir
),
true
unless
cache_path
cache
=
Cache
.
new
(
cache_path
)
result
=
cache
.
download_pod
(
name_or_spec
,
released
,
downloader_options
,
head
)
if
download_target
FileUtils
.
rm_rf
download_target
FileUtils
.
cp_r
(
result
.
location
,
download_target
)
end
result
ensure
FileUtils
.
rm_r
cache_path
if
tmp_cache
end
class
DownloaderError
;
include
CLAide
::
InformativeError
;
end
class
DownloaderError
;
include
CLAide
::
InformativeError
;
end
class
Base
class
Base
...
...
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
af1c8727
...
@@ -98,11 +98,7 @@ module Pod
...
@@ -98,11 +98,7 @@ module Pod
title
=
"Pre-downloading: `
#{
name
}
`
#{
description
}
"
title
=
"Pre-downloading: `
#{
name
}
`
#{
description
}
"
UI
.
titled_section
(
title
,
:verbose_prefix
=>
'-> '
)
do
UI
.
titled_section
(
title
,
:verbose_prefix
=>
'-> '
)
do
target
=
sandbox
.
pod_dir
(
name
)
target
=
sandbox
.
pod_dir
(
name
)
target
.
rmtree
if
target
.
exist?
download_result
=
Downloader
.
download
(
name
,
target
,
:downloader_options
=>
params
)
download_result
=
Config
.
instance
.
download_cache
.
download_pod
(
name
,
false
,
params
)
FileUtils
.
cp_r
(
download_result
.
location
,
target
)
spec
=
download_result
.
spec
spec
=
download_result
.
spec
raise
Informative
,
"Unable to find a specification for '
#{
name
}
'."
unless
spec
raise
Informative
,
"Unable to find a specification for '
#{
name
}
'."
unless
spec
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
af1c8727
...
@@ -8,8 +8,6 @@ module Pod
...
@@ -8,8 +8,6 @@ module Pod
# @note This class needs to consider all the activated specs of a Pod.
# @note This class needs to consider all the activated specs of a Pod.
#
#
class
PodSourceInstaller
class
PodSourceInstaller
include
Config
::
Mixin
# @return [Sandbox]
# @return [Sandbox]
#
#
attr_reader
:sandbox
attr_reader
:sandbox
...
@@ -76,9 +74,7 @@ module Pod
...
@@ -76,9 +74,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
download_source
def
download_source
download_result
=
config
.
download_cache
.
download_pod
(
root_spec
,
released?
,
nil
,
head_pod?
)
download_result
=
Downloader
.
download
(
root_spec
,
root
,
:released
=>
released?
,
:head
=>
head_pod?
)
root
.
rmtree
if
root
.
exist?
FileUtils
.
cp_r
(
download_result
.
location
,
root
)
if
@specific_source
=
download_result
.
checkout_options
if
@specific_source
=
download_result
.
checkout_options
sandbox
.
store_checkout_source
(
root_spec
.
name
,
specific_source
)
sandbox
.
store_checkout_source
(
root_spec
.
name
,
specific_source
)
...
...
spec/integration.rb
View file @
af1c8727
...
@@ -99,7 +99,7 @@ describe_cli 'pod' do
...
@@ -99,7 +99,7 @@ describe_cli 'pod' do
s
.
executable
=
"ruby
#{
ROOT
+
'bin/pod'
}
"
s
.
executable
=
"ruby
#{
ROOT
+
'bin/pod'
}
"
s
.
environment_vars
=
{
s
.
environment_vars
=
{
'CP_REPOS_DIR'
=>
ROOT
+
'spec/fixtures/spec-repos'
,
'CP_REPOS_DIR'
=>
ROOT
+
'spec/fixtures/spec-repos'
,
'C
P_AGGRESSIVE_CACHE'
=>
'TRUE'
,
'C
OCOAPODS_SKIP_CACHE'
=>
'TRUE'
,
'XCODEPROJ_DISABLE_XCPROJ'
=>
'TRUE'
,
'XCODEPROJ_DISABLE_XCPROJ'
=>
'TRUE'
,
'CLAIDE_DISABLE_AUTO_WRAP'
=>
'TRUE'
,
'CLAIDE_DISABLE_AUTO_WRAP'
=>
'TRUE'
,
}
}
...
...
spec/unit/external_sources/abstract_external_source_spec.rb
View file @
af1c8727
...
@@ -43,17 +43,6 @@ module Pod
...
@@ -43,17 +43,6 @@ module Pod
},
},
}
}
end
end
it
'checks for JSON podspecs'
do
path
=
config
.
download_cache
.
send
(
:path_for_pod
,
'Reachability'
,
nil
,
@subject
.
params
)
podspec_path
=
path
+
'Reachability.podspec.json'
path
.
mkpath
File
.
open
(
podspec_path
,
'w'
)
{
|
f
|
f
.
write
'{"name":"Reachability"}'
}
Pathname
.
any_instance
.
stubs
(
:rmtree
)
Downloader
::
Git
.
any_instance
.
stubs
(
:download
)
config
.
sandbox
.
expects
(
:store_podspec
).
with
(
'Reachability'
,
%({\n "name": "Reachability"\n}\n)
,
true
,
true
)
@subject
.
send
(
:pre_download
,
config
.
sandbox
)
end
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