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
8ecd4bcf
Commit
8ecd4bcf
authored
May 14, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integration of Specificaiton refactor.
parent
38765151
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
144 additions
and
133 deletions
+144
-133
cocoa_pod.rb
lib/cocoapods/command/presenter/cocoa_pod.rb
+1
-1
spec.rb
lib/cocoapods/command/spec.rb
+7
-5
dependency.rb
lib/cocoapods/dependency.rb
+14
-19
downloader.rb
lib/cocoapods/downloader.rb
+1
-1
documentation.rb
lib/cocoapods/generator/documentation.rb
+2
-2
installer.rb
lib/cocoapods/installer.rb
+18
-18
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+2
-2
local_pod.rb
lib/cocoapods/local_pod.rb
+28
-15
platform.rb
lib/cocoapods/platform.rb
+3
-1
resolver.rb
lib/cocoapods/resolver.rb
+3
-3
downloader_spec.rb
spec/functional/downloader_spec.rb
+38
-38
integration_spec.rb
spec/integration_spec.rb
+1
-0
dependency_spec.rb
spec/unit/dependency_spec.rb
+0
-9
downloader_spec.rb
spec/unit/downloader_spec.rb
+2
-3
http_spec.rb
spec/unit/http_spec.rb
+11
-12
local_pod_spec.rb
spec/unit/local_pod_spec.rb
+1
-1
platform_spec.rb
spec/unit/platform_spec.rb
+6
-0
resolver_spec.rb
spec/unit/resolver_spec.rb
+6
-3
No files found.
lib/cocoapods/command/presenter/cocoa_pod.rb
View file @
8ecd4bcf
...
...
@@ -47,7 +47,7 @@ module Pod
end
def
platform
spec
.
platform
.
to_s
spec
.
available_platforms
.
sort
{
|
a
,
b
|
a
.
to_s
.
downcase
<=>
b
.
to_s
.
downcase
}.
join
(
' - '
)
end
def
license
...
...
lib/cocoapods/command/spec.rb
View file @
8ecd4bcf
...
...
@@ -135,8 +135,8 @@ module Pod
@specs_to_lint
||=
begin
podspecs_to_lint
.
map
do
|
podspec
|
root_spec
=
Specification
.
from_file
(
podspec
)
# TODO
if a spec has a main subspec require it's subspecs recursively
root_spec
.
main_subspec
==
root_spec
?
root_spec
:
root_spec
.
subspecs
# TODO
find a way to lint subspecs
# root_spec.preferred_dependency ? root_spec.subspec_dependencies : root_spec
end
.
flatten
end
end
...
...
@@ -150,6 +150,8 @@ module Pod
class
Linter
include
Config
::
Mixin
# TODO: Add check to ensure that attributes inherited by subspecs are not duplicated ?
attr_accessor
:quick
,
:lenient
attr_reader
:spec
,
:file
attr_reader
:errors
,
:warnings
,
:notes
...
...
@@ -271,7 +273,7 @@ module Pod
# attributes with multiplatform values
return
messages
unless
platform_valid?
messages
<<
"Missing source_files"
if
spec
.
source_files
.
empty?
&&
spec
.
subspecs
.
empty?
&&
spec
.
dependenci
es
.
empty?
messages
<<
"Missing source_files"
if
spec
.
source_files
.
empty?
&&
spec
.
subspecs
.
empty?
&&
spec
.
resourc
es
.
empty?
messages
+=
paths_starting_with_a_slash_errors
messages
end
...
...
@@ -283,7 +285,7 @@ module Pod
end
def
platform_valid?
[
nil
,
:ios
,
:osx
].
include?
(
spec
.
platform
.
name
)
!
spec
.
platform
||
[
:ios
,
:osx
].
include?
(
spec
.
platform
.
name
)
end
def
paths_starting_with_a_slash_errors
...
...
@@ -313,6 +315,7 @@ module Pod
text
=
@file
.
read
messages
=
[]
messages
<<
"Missing license type"
unless
license
[
:type
]
messages
<<
"Missing license file or text"
unless
license
[
:file
]
||
license
[
:text
]
messages
<<
"The summary is not meaningful"
if
spec
.
summary
=~
/A short description of/
messages
<<
"The description is not meaningful"
if
spec
.
description
&&
spec
.
description
=~
/An optional longer description of/
messages
<<
"The summary should end with a dot"
if
@spec
.
summary
!~
/.*\./
...
...
@@ -381,7 +384,6 @@ module Pod
messages
+=
check_spec_files_exists
(
:source_files
,
'*.{h,m,mm,c,cpp}'
)
messages
+=
check_spec_files_exists
(
:resources
)
messages
<<
"license file not found = '
#{
spec
.
license
[
:file
]
}
' -> did not match any file"
if
spec
.
license
&&
spec
.
license
[
:file
]
&&
pod_dir
.
glob
(
spec
.
license
[
:file
]).
empty?
# messages << "Missing license file or text" unless license[:file] || license[:text]
messages
.
compact
end
end
...
...
lib/cocoapods/dependency.rb
View file @
8ecd4bcf
...
...
@@ -5,8 +5,6 @@ require 'open-uri'
module
Pod
class
Dependency
<
Gem
::
Dependency
attr_accessor
:only_part_of_other_pod
alias_method
:only_part_of_other_pod?
,
:only_part_of_other_pod
attr_reader
:external_source
attr_accessor
:specification
...
...
@@ -14,7 +12,7 @@ module Pod
def
initialize
(
*
name_and_version_requirements
,
&
block
)
if
name_and_version_requirements
.
empty?
&&
block
@inline_podspec
=
true
@specification
=
Specification
.
new
(
&
block
)
.
main_subspec
@specification
=
Specification
.
new
(
&
block
)
super
(
@specification
.
name
,
@specification
.
version
)
elsif
!
name_and_version_requirements
.
empty?
&&
block
.
nil?
...
...
@@ -27,23 +25,20 @@ module Pod
raise
Informative
,
"A dependency needs either a name and version requirements, "
\
"a source hash, or a block which defines a podspec."
end
@only_part_of_other_pod
=
false
end
def
==
(
other
)
super
&&
@only_part_of_other_pod
==
other
.
only_part_of_other_pod
&&
(
@specification
?
@specification
==
other
.
specification
:
@external_source
==
other
.
external_source
)
super
&&
(
@specification
?
@specification
==
other
.
specification
:
@external_source
==
other
.
external_source
)
end
def
subspec_dependency?
@name
.
include?
(
'/'
)
end
def
inline?
@inline_podspec
end
def
external?
!
@external_source
.
nil?
end
...
...
@@ -75,7 +70,7 @@ module Pod
end
version
.
empty?
?
@name
:
"
#{
@name
}
(
#{
version
}
)"
end
def
specification_from_sandbox
(
sandbox
,
platform
)
@external_source
.
specification_from_sandbox
(
sandbox
,
platform
)
end
...
...
@@ -126,33 +121,33 @@ module Pod
raise
Informative
,
"Unknown external source parameters for
#{
name
}
:
#{
params
}
"
end
end
class
AbstractExternalSource
include
Config
::
Mixin
attr_reader
:name
,
:params
def
initialize
(
name
,
params
)
@name
,
@params
=
name
,
params
end
def
specification_from_sandbox
(
sandbox
,
platform
)
if
local_pod
=
sandbox
.
installed_pod_named
(
name
,
platform
)
local_pod
.
specification
local_pod
.
top_
specification
else
copy_external_source_into_sandbox
(
sandbox
)
local_pod
=
sandbox
.
installed_pod_named
(
name
,
platform
)
local_pod
.
clean
if
config
.
clean?
local_pod
.
specification
local_pod
.
top_
specification
end
end
def
==
(
other_source
)
return
if
other_source
.
nil?
name
==
other_source
.
name
&&
params
==
other_source
.
params
end
end
class
GitSource
<
AbstractExternalSource
def
copy_external_source_into_sandbox
(
sandbox
)
puts
" * Pre-downloading: '
#{
name
}
'"
unless
config
.
silent?
...
...
@@ -161,7 +156,7 @@ module Pod
downloader
.
clean
if
config
.
clean?
end
end
def
description
"from `
#{
@params
[
:git
]
}
'"
.
tap
do
|
description
|
description
<<
", commit `
#{
@params
[
:commit
]
}
'"
if
@params
[
:commit
]
...
...
@@ -180,7 +175,7 @@ module Pod
output_path
.
open
(
'w'
)
{
|
f
|
f
<<
io
.
read
}
end
end
def
description
"from `
#{
@params
[
:podspec
]
}
'"
end
...
...
lib/cocoapods/downloader.rb
View file @
8ecd4bcf
...
...
@@ -11,7 +11,7 @@ module Pod
extend
Executable
def
self
.
for_pod
(
pod
)
spec
=
pod
.
specification
spec
=
pod
.
top_
specification
for_target
(
pod
.
root
,
spec
.
source
.
dup
)
end
...
...
lib/cocoapods/generator/documentation.rb
View file @
8ecd4bcf
...
...
@@ -12,9 +12,9 @@ module Pod
def
initialize
(
pod
)
@pod
=
pod
@specification
=
pod
.
specification
@specification
=
pod
.
top_
specification
@target_path
=
pod
.
sandbox
.
root
+
'Documentation'
+
pod
.
name
@options
=
pod
.
specification
.
documentation
||
{}
@options
=
@
specification
.
documentation
||
{}
end
def
name
...
...
lib/cocoapods/installer.rb
View file @
8ecd4bcf
...
...
@@ -48,30 +48,30 @@ module Pod
pods
.
each
do
|
pod
|
unless
config
.
silent?
marker
=
config
.
verbose
?
"
\n
-> "
.
green
:
''
puts
pod
.
exists?
?
"
#{
marker
}
Using
#{
pod
}
"
:
"
#{
marker
}
Installing
#{
pod
}
"
.
green
submarker
=
" "
*
marker
.
length
<<
" - "
puts
"
#{
submarker
}#{
pod
.
subspecs
.
map
{
|
s
|
s
.
name
.
gsub
(
pod
.
specification
.
name
+
'/'
,
''
)
}
.join("
\
n
" << submarker)}"
unless
pod
.
subspecs
.
empty?
puts
marker
<<
(
pod
.
exists?
?
"Using
#{
pod
}
"
:
"Installing
#{
pod
}
"
.
green
)
end
unless
pod
.
exists?
should_install
=
!
pod
.
exists?
if
should_install
downloader
=
Downloader
.
for_pod
(
pod
)
downloader
.
download
if
config
.
clean
# downloader.clean
pod
.
clean
end
end
if
(
!
pod
.
exists?
&&
config
.
generate_docs?
)
||
config
.
force_doc?
doc_generator
=
Generator
::
Documentation
.
new
(
pod
)
if
doc_generator
.
already_installed?
puts
"Using Existing Documentation for
#{
pod
.
specification
}
"
.
green
if
config
.
verbose?
else
puts
"Installing Documentation for
#{
pod
.
specification
}
"
.
green
if
config
.
verbose?
doc_generator
.
generate
(
config
.
doc_install?
)
end
end
generate_docs
(
pod
)
pod
.
clean
if
config
.
clean
&&
should_install
end
end
#TODO: move to generator ?
def
generate_docs
(
pod
)
doc_generator
=
Generator
::
Documentation
.
new
(
pod
)
if
(
config
.
generate_docs?
&&
!
doc_generator
.
already_installed?
)
||
config
.
force_doc?
message
=
"Installing documentation"
doc_generator
.
generate
(
config
.
doc_install?
)
else
message
=
"Using existing documentation"
end
puts
"-> "
.
green
<<
message
<<
" for
#{
pod
.
name
}
(
#{
pod
.
top_specification
.
version
}
)"
if
config
.
verbose?
end
def
install!
...
...
@@ -195,7 +195,7 @@ module Pod
end
def
pod_for_spec
(
spec
,
platform
)
@pods_by_spec
[
platform
][
spec
.
top_level_parent
.
name
]
||=
LocalPod
.
new
(
spec
.
top_level_parent
,
@sandbox
,
platform
)
@pods_by_spec
[
platform
][
spec
.
top_level_parent
.
name
]
||=
LocalPod
.
new
(
spec
,
@sandbox
,
platform
)
end
private
...
...
lib/cocoapods/installer/target_installer.rb
View file @
8ecd4bcf
...
...
@@ -41,7 +41,7 @@ module Pod
header
.
puts
"#import
#{
@target_definition
.
platform
==
:ios
?
'<UIKit/UIKit.h>'
:
'<Cocoa/Cocoa.h>'
}
"
header
.
puts
"#endif"
pods
.
each
do
|
pod
|
if
prefix_header_contents
=
pod
.
specification
.
prefix_header_contents
if
prefix_header_contents
=
pod
.
top_
specification
.
prefix_header_contents
header
.
puts
header
.
puts
prefix_header_contents
elsif
prefix_header
=
pod
.
prefix_header_file
...
...
@@ -63,7 +63,7 @@ module Pod
@target
=
@project
.
add_pod_target
(
@target_definition
.
label
,
@target_definition
.
platform
)
pods
.
each
do
|
pod
|
xcconfig
.
merge!
(
pod
.
specification
.
xcconfig
)
xcconfig
.
merge!
(
pod
.
xcconfig
)
pod
.
add_to_target
(
@target
)
# TODO: this doesn't need to be done here, it has nothing to do with the target
...
...
lib/cocoapods/local_pod.rb
View file @
8ecd4bcf
...
...
@@ -2,13 +2,12 @@ module Pod
class
LocalPod
attr_reader
:top_specification
,
:specifications
# TODO: fix accross the app
alias
:specification
:top_specification
attr_reader
:sandbox
def
initialize
(
specification
,
sandbox
,
platform
)
@top_specification
,
@sandbox
=
specification
,
sandbox
@top_specification
,
@sandbox
=
specification
.
top_level_parent
,
sandbox
@top_specification
.
activate_platform
(
platform
)
@specifications
=
[]
@specifications
=
[]
<<
specification
end
def
self
.
from_podspec
(
podspec
,
sandbox
,
platform
)
...
...
@@ -66,10 +65,12 @@ module Pod
# remove empty diretories
Dir
.
glob
(
"
#{
root
}
/**/{*,.*}"
).
sort_by
(
&
:length
).
reverse
.
# Clean the deepest paths first
reject
{
|
d
|
d
=~
/\/\.\.?$/
}
.
# Remove the `.` and `..` paths
select
{
|
d
|
File
.
directory?
d
}
.
# Get only directories
each
{
|
d
|
Dir
.
rmdir
d
if
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
}
# Remove the paths only if it is empty
sort_by
(
&
:length
).
reverse
.
# Clean the deepest paths first to determine if the containing folders are empty
reject
{
|
d
|
d
=~
/\/\.\.?$/
}
.
# Remove the `.` and `..` paths
select
{
|
d
|
File
.
directory?
(
d
)
}
.
# Get only directories or symlinks to directories
each
do
|
d
|
FileUtils
.
rm_rf
(
d
)
if
File
.
symlink?
(
d
)
||
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
# Remove the dirs/symlink only if it is empty
end
end
def
prefix_header_file
...
...
@@ -94,17 +95,20 @@ module Pod
end
def
used_files
source_files
(
false
)
+
resources
(
false
)
+
readme_file
+
license_file
+
[
prefix_header_file
]
source_files
(
false
)
+
resources
(
false
)
+
[
readme_file
,
license_file
,
prefix_header_file
]
+
expanded_paths
(
'*.podspec'
)
+
preserve_paths
end
def
readme_file
expanded_paths
(
'README.*'
)
expanded_paths
(
'README.*'
)
.
first
end
def
license_file
expanded_paths
(
%w[ LICENSE licence.txt ]
)
expanded_paths
(
%w[ LICENSE licence.txt ]
)
.
first
end
def
preserve_paths
chained_expanded_paths
(
:preserve_paths
)
end
def
header_files
source_files
.
select
{
|
f
|
f
.
extname
==
'.h'
}
...
...
@@ -116,18 +120,27 @@ module Pod
end
end
def
xcconfig
specifications
.
map
{
|
s
|
s
.
xcconfig
}.
reduce
(
:merge
)
end
#TODO: fix
def
add_to_target
(
target
)
implementation_files
.
each
do
|
file
|
target
.
add_source_file
(
file
,
nil
,
specification
.
compiler_flags
.
strip
)
target
.
add_source_file
(
file
,
nil
,
top_
specification
.
compiler_flags
.
strip
)
end
end
def
compiler_flags
end
def
requires_arc?
specification
.
requires_arc
top_
specification
.
requires_arc
end
def
dependencies
specification
.
dependencies
top_
specification
.
dependencies
end
private
...
...
@@ -145,14 +158,14 @@ module Pod
def
copy_header_mappings
header_files
.
inject
({})
do
|
mappings
,
from
|
from_without_prefix
=
from
.
relative_path_from
(
relative_root
)
to
=
specification
.
header_dir
+
specification
.
copy_header_mapping
(
from_without_prefix
)
to
=
top_specification
.
header_dir
+
top_
specification
.
copy_header_mapping
(
from_without_prefix
)
(
mappings
[
to
.
dirname
]
||=
[])
<<
from
mappings
end
end
def
chained_expanded_paths
(
accessor
,
options
=
{})
specifications
.
map
{
|
s
|
expanded_paths
(
s
.
send
(
accessor
),
options
)
}.
compact
.
reduce
(:
+
)
.
uniq
specifications
.
map
{
|
s
|
expanded_paths
(
s
.
send
(
accessor
),
options
)
}.
compact
.
flatten
.
uniq
end
def
expanded_paths
(
patterns
,
options
=
{})
...
...
lib/cocoapods/platform.rb
View file @
8ecd4bcf
...
...
@@ -36,7 +36,9 @@ module Pod
def
supports?
(
other
)
return
true
if
@symbolic_name
.
nil?
||
other
.
nil?
@symbolic_name
==
other
.
name
&&
(
deployment_target
.
nil?
||
other
.
deployment_target
.
nil?
||
deployment_target
>=
other
.
deployment_target
)
os_check
=
@symbolic_name
==
other
.
name
version_check
=
(
deployment_target
.
nil?
||
other
.
deployment_target
.
nil?
||
deployment_target
>=
other
.
deployment_target
)
os_check
&&
version_check
end
def
to_s
...
...
lib/cocoapods/resolver.rb
View file @
8ecd4bcf
...
...
@@ -22,7 +22,7 @@ module Pod
@podfile
.
target_definitions
.
values
.
each
do
|
target_definition
|
puts
"
\n
Resolving dependencies for target `
#{
target_definition
.
name
}
' (
#{
target_definition
.
platform
}
)"
.
green
if
config
.
verbose?
@loaded_specs
=
[]
find_dependency_s
et
s
(
@podfile
,
target_definition
.
dependencies
,
target_definition
)
find_dependency_s
pec
s
(
@podfile
,
target_definition
.
dependencies
,
target_definition
)
targets_and_specs
[
target_definition
]
=
@specs
.
values_at
(
*
@loaded_specs
).
sort_by
(
&
:name
)
end
...
...
@@ -49,7 +49,7 @@ module Pod
end
end
def
find_dependency_s
et
s
(
dependent_specification
,
dependencies
,
target_definition
)
def
find_dependency_s
pec
s
(
dependent_specification
,
dependencies
,
target_definition
)
@log_indent
+=
1
dependencies
.
each
do
|
dependency
|
puts
' '
*
@log_indent
+
"-
#{
dependency
}
"
if
config
.
verbose?
...
...
@@ -62,7 +62,7 @@ module Pod
@specs
[
spec
.
name
]
=
spec
spec
.
activate_platform
(
target_definition
.
platform
)
# And recursively load the dependencies of the spec.
find_dependency_s
et
s
(
spec
,
spec
.
dependencies
,
target_definition
)
if
spec
.
dependencies
find_dependency_s
pec
s
(
spec
,
spec
.
dependencies
,
target_definition
)
if
spec
.
dependencies
end
validate_platform!
(
spec
||
@specs
[
dependency
.
name
],
target_definition
)
end
...
...
spec/functional/downloader_spec.rb
View file @
8ecd4bcf
...
...
@@ -7,28 +7,28 @@ describe "Pod::Downloader" do
describe
"for Git"
do
extend
SpecHelper
::
TemporaryDirectory
it
"check's out a specific commit"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
fixture
(
'banana-lib'
),
:commit
=>
'fd56054'
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
.
download
(
@pod
.
root
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
it
"check's out a specific tag"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
.
download
(
@pod
.
root
+
'README'
).
read
.
strip
.
should
==
'v1.0'
end
it
"removes the .git directory when cleaning"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
fixture
(
'banana-lib'
)
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
...
...
@@ -37,60 +37,60 @@ describe "Pod::Downloader" do
(
@pod
.
root
+
'.git'
).
should
.
not
.
exist
end
end
describe
"for Github repositories, with :download_only set to true"
do
extend
SpecHelper
::
TemporaryDirectory
it
"downloads HEAD with no other options specified"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/lukeredpath/libPusher.git"
,
:download_only
=>
true
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
VCR
.
use_cassette
(
'tarballs'
,
:record
=>
:new_episodes
)
{
downloader
.
download
}
# deliberately keep this assertion as loose as possible for now
(
@pod
.
root
+
'README.md'
).
readlines
[
0
].
should
=~
/libPusher/
end
it
"downloads a specific tag when specified"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/lukeredpath/libPusher.git"
,
:tag
=>
'v1.1'
,
:download_only
=>
true
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
VCR
.
use_cassette
(
'tarballs'
,
:record
=>
:new_episodes
)
{
downloader
.
download
}
# deliberately keep this assertion as loose as possible for now
(
@pod
.
root
+
'libPusher.podspec'
).
readlines
.
grep
(
/1.1/
).
should
.
not
.
be
.
empty
end
it
"downloads a specific commit when specified"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/lukeredpath/libPusher.git"
,
:commit
=>
'eca89998d5'
,
:download_only
=>
true
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
VCR
.
use_cassette
(
'tarballs'
,
:record
=>
:new_episodes
)
{
downloader
.
download
}
# deliberately keep this assertion as loose as possible for now
(
@pod
.
root
+
'README.md'
).
readlines
[
0
].
should
=~
/PusherTouch/
end
it
'deletes the downloaded tarball after unpacking it'
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/lukeredpath/libPusher.git"
,
:download_only
=>
true
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
VCR
.
use_cassette
(
'tarballs'
,
:record
=>
:new_episodes
)
{
downloader
.
download
}
downloader
.
clean
(
@pod
.
root
+
'tarball.tar.gz'
).
should
.
not
.
exist
end
it
"removes the .git directory when cleaning"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/lukeredpath/libPusher.git"
,
:download_only
=>
false
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
...
...
@@ -98,21 +98,21 @@ describe "Pod::Downloader" do
downloader
.
clean
(
@pod
.
root
+
'.git'
).
should
.
not
.
exist
end
end
describe
"for Mercurial"
do
it
"check's out a specific revision"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:hg
=>
fixture
(
'mercurial-repo'
),
:revision
=>
'46198bb3af96'
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
.
download
(
@pod
.
root
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
it
"removes the .hg directory when cleaning"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:hg
=>
fixture
(
'mercurial-repo'
)
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
...
...
@@ -121,28 +121,28 @@ describe "Pod::Downloader" do
(
@pod
.
root
+
'.hg'
).
should
.
not
.
exist
end
end
describe
"for Subversion"
do
it
"check's out a specific revision"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
"
,
:revision
=>
'1'
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
.
download
(
@pod
.
root
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
it
"check's out a specific tag"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/tags/tag-1"
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
.
download
(
@pod
.
root
+
'README'
).
read
.
strip
.
should
==
'tag 1'
end
it
"removes the .svn directories when cleaning"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/trunk"
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
...
...
@@ -156,7 +156,7 @@ describe "Pod::Downloader" do
extend
SpecHelper
::
TemporaryDirectory
it
"download file and unzip it"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:http
=>
'http://dl.google.com/googleadmobadssdk/googleadmobsearchadssdkios.zip'
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
...
...
@@ -167,7 +167,7 @@ describe "Pod::Downloader" do
end
it
"removes the .zip when cleaning"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
@pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:http
=>
'http://dl.google.com/googleadmobadssdk/googleadmobsearchadssdkios.zip'
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
...
...
@@ -176,7 +176,7 @@ describe "Pod::Downloader" do
(
@pod
.
root
+
'file.zip'
).
should
.
not
.
exist
end
end
end
spec/integration_spec.rb
View file @
8ecd4bcf
...
...
@@ -155,6 +155,7 @@ else
end
end
Pod
::
Specification
.
any_instance
.
stubs
(
:clean_paths
).
returns
([
'JSONKit/CHANGELOG.md'
])
installer
=
SpecHelper
::
Installer
.
new
(
podfile
)
installer
.
install!
...
...
spec/unit/dependency_spec.rb
View file @
8ecd4bcf
...
...
@@ -7,15 +7,6 @@ describe "Pod::Dependency" do
dep1
.
merge
(
dep2
).
should
==
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1.8'
,
'1.9'
)
end
it
"is equal to another dependency if `part_of_other_pod' is the same"
do
dep1
=
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1'
)
dep1
.
only_part_of_other_pod
=
true
dep2
=
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1'
)
dep1
.
should
.
not
==
dep2
dep2
.
only_part_of_other_pod
=
true
dep1
.
should
==
dep2
end
it
"returns the name of the dependency, or the name of the pod of which this is a subspec"
do
dep
=
Pod
::
Dependency
.
new
(
'RestKit'
)
dep
.
top_level_spec_name
.
should
==
'RestKit'
...
...
spec/unit/downloader_spec.rb
View file @
8ecd4bcf
...
...
@@ -2,12 +2,11 @@ require File.expand_path('../../spec_helper', __FILE__)
def
stub_pod_with_source
(
source_options
)
specification
=
stub
(
:part_of_other_pod?
=>
false
,
:source
=>
source_options
)
stub
(
'pod'
)
do
stubs
(
:root
).
returns
(
temporary_sandbox
.
root
)
stubs
(
:specification
).
returns
(
specification
)
stubs
(
:
top_
specification
).
returns
(
specification
)
end
end
...
...
@@ -22,7 +21,7 @@ describe "Pod::Downloader" do
it
'returns a github downloader when the :git URL is on github'
do
pod
=
Pod
::
LocalPod
.
new
(
fixture_spec
(
'banana-lib/BananaLib.podspec'
),
temporary_sandbox
,
Pod
::
Platform
.
ios
)
pod
.
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/CocoaPods/CocoaPods"
)
pod
.
top_
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/CocoaPods/CocoaPods"
)
downloader
=
Pod
::
Downloader
.
for_pod
(
pod
)
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
GitHub
end
...
...
spec/unit/http_spec.rb
View file @
8ecd4bcf
...
...
@@ -2,12 +2,11 @@ require File.expand_path('../../spec_helper', __FILE__)
def
stub_pod_with_source
(
source_options
)
specification
=
stub
(
:part_of_other_pod?
=>
false
,
:source
=>
source_options
)
stub
(
'pod'
)
do
stubs
(
:root
).
returns
(
temporary_sandbox
.
root
)
stubs
(
:specification
).
returns
(
specification
)
stubs
(
:
top_
specification
).
returns
(
specification
)
end
end
...
...
@@ -19,20 +18,20 @@ describe Pod::Downloader::Http do
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:zip
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.tar'
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:tar
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.tgz'
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:tgz
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0'
,
:type
=>
:zip
...
...
@@ -40,7 +39,7 @@ describe Pod::Downloader::Http do
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:zip
end
it
'should download file and extract it with proper type'
do
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.zip'
...
...
@@ -48,28 +47,28 @@ describe Pod::Downloader::Http do
downloader
.
expects
(
:download_file
).
with
(
anything
())
downloader
.
expects
(
:extract_with_type
).
with
(
anything
(),
:zip
).
at_least_once
downloader
.
download
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.tgz'
))
downloader
.
expects
(
:download_file
).
with
(
anything
())
downloader
.
expects
(
:extract_with_type
).
with
(
anything
(),
:tgz
).
at_least_once
downloader
.
download
downloader
.
download
end
it
'should raise error when unsupported filetype is pass'
do
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.rar'
))
downloader
.
expects
(
:download
).
raises
(
Pod
::
Downloader
::
Http
::
UnsupportedFileTypeError
)
downloader
.
download
rescue
nil
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0'
,
:type
=>
:rar
))
downloader
.
expects
(
:download
).
raises
(
Pod
::
Downloader
::
Http
::
UnsupportedFileTypeError
)
downloader
.
download
rescue
nil
end
end
spec/unit/local_pod_spec.rb
View file @
8ecd4bcf
...
...
@@ -73,7 +73,7 @@ describe Pod::LocalPod do
end
it
"can add it's source files to a target with any specially configured compiler flags"
do
@pod
.
specification
.
compiler_flags
=
'-d some_flag'
@pod
.
top_
specification
.
compiler_flags
=
'-d some_flag'
target
=
mock
(
'target'
)
target
.
expects
(
:add_source_file
).
with
(
anything
,
anything
,
"-d some_flag"
)
@pod
.
add_to_target
(
target
)
...
...
spec/unit/platform_spec.rb
View file @
8ecd4bcf
...
...
@@ -98,4 +98,10 @@ describe "Pod::Platform#supports?" do
p1
.
should
.
supports?
(
p2
)
p2
.
should
.
supports?
(
p1
)
end
it
"doesn't supports a platform with a different operating system"
do
p1
=
Pod
::
Platform
.
new
(
:ios
)
p2
=
Pod
::
Platform
.
new
(
:osx
)
p1
.
should
.
not
.
supports?
(
p2
)
end
end
spec/unit/resolver_spec.rb
View file @
8ecd4bcf
...
...
@@ -18,7 +18,7 @@ describe "Pod::Resolver" do
Pod
::
Config
.
instance
=
@config_before
end
it
"holds the context state, such as cached specification sets"
do
x
it
"holds the context state, such as cached specification sets"
do
@resolver
.
resolve
@resolver
.
cached_sets
.
values
.
sort_by
(
&
:name
).
should
==
[
Pod
::
Spec
::
Set
.
new
(
config
.
repos_dir
+
'master/A2DynamicDelegate'
),
...
...
@@ -26,7 +26,7 @@ describe "Pod::Resolver" do
].
sort_by
(
&
:name
)
end
it
"returns all specs needed for the dependency"
do
x
it
"returns all specs needed for the dependency"
do
specs
=
@resolver
.
resolve
.
values
.
flatten
specs
.
map
(
&
:class
).
uniq
.
should
==
[
Pod
::
Specification
]
specs
.
map
(
&
:name
).
sort
.
should
==
%w{ A2DynamicDelegate BlocksKit }
...
...
@@ -80,6 +80,7 @@ describe "Pod::Resolver" do
resolver
=
Pod
::
Resolver
.
new
(
@podfile
,
stub
(
'sandbox'
))
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{
FileMD5Hash
ISO8601DateFormatter
LibComponentLogging-Core
LibComponentLogging-NSLog
RestKit/Network
...
...
@@ -120,10 +121,11 @@ describe "Pod::Resolver" do
@podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
dependency
do
|
s
|
s
.
main_subspec
=
'JSON'
s
.
name
=
'RestKit'
s
.
version
=
'0.10.0'
s
.
preferred_dependency
=
'JSON'
s
.
subspec
'JSON'
do
|
js
|
js
.
dependency
'RestKit/Network'
js
.
dependency
'RestKit/UI'
...
...
@@ -146,6 +148,7 @@ describe "Pod::Resolver" do
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{
LibComponentLogging-Core
LibComponentLogging-NSLog
RestKit
RestKit/JSON
RestKit/Network
RestKit/ObjectMapping/CoreData
...
...
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