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
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
97 additions
and
86 deletions
+97
-86
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
+4
-9
downloader.rb
lib/cocoapods/downloader.rb
+1
-1
documentation.rb
lib/cocoapods/generator/documentation.rb
+2
-2
installer.rb
lib/cocoapods/installer.rb
+15
-15
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+2
-2
local_pod.rb
lib/cocoapods/local_pod.rb
+27
-14
platform.rb
lib/cocoapods/platform.rb
+3
-1
resolver.rb
lib/cocoapods/resolver.rb
+3
-3
downloader_spec.rb
spec/functional/downloader_spec.rb
+15
-15
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
+1
-2
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,13 +25,10 @@ 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?
...
...
@@ -138,12 +133,12 @@ module Pod
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
...
...
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
generate_docs
(
pod
)
pod
.
clean
if
config
.
clean
&&
should_install
end
end
if
(
!
pod
.
exists?
&&
config
.
generate_docs?
)
||
config
.
force_doc?
#TODO: move to generator ?
def
generate_docs
(
pod
)
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?
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
end
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
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
each
{
|
d
|
Dir
.
rmdir
d
if
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
}
# Remove the paths only if it is empty
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
...
...
@@ -9,7 +9,7 @@ describe "Pod::Downloader" 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
)
...
...
@@ -19,7 +19,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -28,7 +28,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -42,7 +42,7 @@ describe "Pod::Downloader" 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
)
...
...
@@ -54,7 +54,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -66,7 +66,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -78,7 +78,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -90,7 +90,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -103,7 +103,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -112,7 +112,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -124,7 +124,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -133,7 +133,7 @@ describe "Pod::Downloader" do
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
)
...
...
@@ -142,7 +142,7 @@ describe "Pod::Downloader" do
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
)
...
...
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
...
...
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