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
aa5d2114
Commit
aa5d2114
authored
Feb 25, 2013
by
Eloy Durán
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://github.com/synyx/CocoaPods
into synyx-master
parents
34da3f79
6588e6a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
http.rb
lib/cocoapods/downloader/http.rb
+11
-2
http_spec.rb
spec/unit/http_spec.rb
+11
-0
No files found.
lib/cocoapods/downloader/http.rb
View file @
aa5d2114
...
...
@@ -26,6 +26,16 @@ module Pod
options
[
:type
]
||
type_with_url
(
url
)
end
def
should_flatten?
if
options
.
has_key?
:flatten
options
[
:flatten
]
# spec file can always override
elsif
[
:tgz
,
:tar
,
:tbz
].
include?
type
true
# those archives flatten by default
else
false
# all others (actually only .zip) default not to flatten
end
end
private
def
type_with_url
(
url
)
if
url
=~
/.zip$/
...
...
@@ -74,8 +84,7 @@ module Pod
raise
UnsupportedFileTypeError
.
new
"Unsupported file type:
#{
type
}
"
end
# If the archive is a tarball and it only contained a folder, move its contents to the target (#727)
if
[
:tgz
,
:tar
,
:tbz
].
include?
type
if
should_flatten?
contents
=
target_path
.
children
contents
.
delete
(
full_filename
)
entry
=
contents
.
first
...
...
spec/unit/http_spec.rb
View file @
aa5d2114
...
...
@@ -101,4 +101,15 @@ describe Pod::Downloader::Http do
# Archive contains 4 files, and the archive is 1
Dir
.
glob
(
downloader
.
target_path
+
'*'
).
count
.
should
==
4
+
1
end
it
'should flatten zip archives, when the spec explicitly demands it'
do
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://github.com/kevinoneill/Useful-Bits/archive/1.0.zip'
,
:flatten
=>
true
))
downloader
.
download
# Archive contains one folder, which contains 8 items. The archive is 1, and the
# parent folder that we moved stuff out of is 1.
Dir
.
glob
(
downloader
.
target_path
+
'*'
).
count
.
should
==
8
+
1
+
1
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