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
aef7ea0f
Commit
aef7ea0f
authored
Nov 09, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Install a library from a podspec defined on a dependency in a Podfile.
parent
ddc5ac50
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
30 deletions
+34
-30
dependency.rb
lib/cocoapods/dependency.rb
+4
-9
downloader.rb
lib/cocoapods/downloader.rb
+2
-1
resolver.rb
lib/cocoapods/resolver.rb
+2
-2
specification.rb
lib/cocoapods/specification.rb
+1
-1
integration_spec.rb
spec/integration_spec.rb
+25
-0
dependency_spec.rb
spec/unit/dependency_spec.rb
+0
-14
podfile_spec.rb
spec/unit/podfile_spec.rb
+0
-3
No files found.
lib/cocoapods/dependency.rb
View file @
aef7ea0f
...
@@ -13,6 +13,7 @@ module Pod
...
@@ -13,6 +13,7 @@ module Pod
def
initialize
(
*
name_and_version_requirements
,
&
block
)
def
initialize
(
*
name_and_version_requirements
,
&
block
)
if
name_and_version_requirements
.
empty?
&&
block
if
name_and_version_requirements
.
empty?
&&
block
@inline_podspec
=
true
@specification
=
Specification
.
new
(
&
block
)
@specification
=
Specification
.
new
(
&
block
)
super
(
@specification
.
name
,
@specification
.
version
)
super
(
@specification
.
name
,
@specification
.
version
)
...
@@ -35,17 +36,11 @@ module Pod
...
@@ -35,17 +36,11 @@ module Pod
(
@specification
?
@specification
==
other
.
specification
:
@external_spec_source
==
other
.
external_spec_source
)
(
@specification
?
@specification
==
other
.
specification
:
@external_spec_source
==
other
.
external_spec_source
)
end
end
def
external_podspec?
# In case this dependency was defined with either a repo url, :podspec, or block,
!
@external_spec_source
.
nil?
# this method will return the Specification instance.
end
def
inline_podspec?
!
@specification
.
nil?
end
def
specification
def
specification
@specification
||=
begin
@specification
||=
begin
if
external_podspec?
if
@external_spec_source
pod_root
=
Config
.
instance
.
project_pods_root
+
@name
pod_root
=
Config
.
instance
.
project_pods_root
+
@name
spec
=
nil
spec
=
nil
if
@external_spec_source
[
:podspec
]
if
@external_spec_source
[
:podspec
]
...
...
lib/cocoapods/downloader.rb
View file @
aef7ea0f
...
@@ -20,6 +20,7 @@ module Pod
...
@@ -20,6 +20,7 @@ module Pod
executable
:git
executable
:git
def
download
def
download
@pod_root
.
dirname
.
mkpath
if
@options
[
:tag
]
if
@options
[
:tag
]
download_tag
download_tag
elsif
@options
[
:commit
]
elsif
@options
[
:commit
]
...
@@ -34,7 +35,7 @@ module Pod
...
@@ -34,7 +35,7 @@ module Pod
end
end
def
download_tag
def
download_tag
@pod_root
.
mk
dir
@pod_root
.
mk
path
Dir
.
chdir
(
@pod_root
)
do
Dir
.
chdir
(
@pod_root
)
do
git
"init"
git
"init"
git
"remote add origin '
#{
@url
}
'"
git
"remote add origin '
#{
@url
}
'"
...
...
lib/cocoapods/resolver.rb
View file @
aef7ea0f
...
@@ -23,8 +23,8 @@ module Pod
...
@@ -23,8 +23,8 @@ module Pod
end
end
def
find_dependency_set
(
dependency
)
def
find_dependency_set
(
dependency
)
if
dependency
.
external_podspec?
if
external_spec
=
dependency
.
specification
Specification
::
Set
::
External
.
new
(
dependency
.
specification
)
Specification
::
Set
::
External
.
new
(
external_spec
)
else
else
Source
.
search
(
dependency
)
Source
.
search
(
dependency
)
end
end
...
...
lib/cocoapods/specification.rb
View file @
aef7ea0f
...
@@ -286,8 +286,8 @@ module Pod
...
@@ -286,8 +286,8 @@ module Pod
# end
# end
def
install!
def
install!
puts
"==> Installing:
#{
self
}
"
unless
config
.
silent?
puts
"==> Installing:
#{
self
}
"
unless
config
.
silent?
if
defined_in_file
&&
!
(
config
.
project_pods_root
+
defined_in_file
.
basename
).
exist?
config
.
project_pods_root
.
mkpath
config
.
project_pods_root
.
mkpath
unless
(
config
.
project_pods_root
+
defined_in_file
.
basename
).
exist?
FileUtils
.
cp
(
defined_in_file
,
config
.
project_pods_root
)
FileUtils
.
cp
(
defined_in_file
,
config
.
project_pods_root
)
end
end
...
...
spec/integration_spec.rb
View file @
aef7ea0f
...
@@ -86,8 +86,32 @@ else
...
@@ -86,8 +86,32 @@ else
(
config
.
project_pods_root
+
'ASIHTTPRequest'
).
should
.
exist
(
config
.
project_pods_root
+
'ASIHTTPRequest'
).
should
.
exist
end
end
it
"installs a library with a podspec defined inline"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
dependency
do
|
s
|
s
.
name
=
'JSONKit'
s
.
version
=
'1.2'
s
.
source
=
{
:git
=>
'https://github.com/johnezang/JSONKit.git'
,
:tag
=>
'v1.2'
}
s
.
source_files
=
'JSONKit.*'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
podfile
)
installer
.
install!
# TODO do we need the write out the podspec?
#spec = Pod::Spec.from_file(config.project_pods_root + 'JSONKit.podspec')
#spec.version.to_s.should == '1.2'
change_log
=
(
config
.
project_pods_root
+
'JSONKit/CHANGELOG.md'
).
read
change_log
.
should
.
include
'1.2'
change_log
.
should
.
not
.
include
'1.3'
end
end
end
if
false
before
do
before
do
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
end
end
...
@@ -262,3 +286,4 @@ else
...
@@ -262,3 +286,4 @@ else
end
end
end
end
end
spec/unit/dependency_spec.rb
View file @
aef7ea0f
...
@@ -7,20 +7,6 @@ describe "Pod::Dependency" do
...
@@ -7,20 +7,6 @@ describe "Pod::Dependency" do
dep1
.
merge
(
dep2
).
should
==
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1.8'
,
'1.9'
)
dep1
.
merge
(
dep2
).
should
==
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1.8'
,
'1.9'
)
end
end
it
"returns wether or not the spec for this pod is in a spec repo"
do
dep
=
Pod
::
Dependency
.
new
(
'bananas'
)
dep
.
should
.
not
.
be
.
external_podspec
dep
.
external_spec_source
=
{
:git
=>
'GIT-URL'
}
dep
.
should
.
be
.
external_podspec
end
it
"returns wether or not the spec for this pod is defined inline"
do
dep
=
Pod
::
Dependency
.
new
{
|
s
|
s
.
name
=
'bananas'
}
dep
.
should
.
be
.
inline_podspec
dep
.
specification
.
should
.
be
.
instance_of
Pod
::
Specification
dep
.
specification
.
name
.
should
==
'bananas'
end
it
"is equal to another dependency if `part_of_other_pod' is the same"
do
it
"is equal to another dependency if `part_of_other_pod' is the same"
do
dep1
=
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1'
)
dep1
=
Pod
::
Dependency
.
new
(
'bananas'
,
'>= 1'
)
dep1
.
only_part_of_other_pod
=
true
dep1
.
only_part_of_other_pod
=
true
...
...
spec/unit/podfile_spec.rb
View file @
aef7ea0f
...
@@ -23,7 +23,6 @@ describe "Pod::Podfile" do
...
@@ -23,7 +23,6 @@ describe "Pod::Podfile" do
dependency
'SomeExternalPod'
,
:git
=>
'GIT-URL'
,
:commit
=>
'1234'
dependency
'SomeExternalPod'
,
:git
=>
'GIT-URL'
,
:commit
=>
'1234'
end
end
dep
=
podfile
.
dependency_by_name
(
'SomeExternalPod'
)
dep
=
podfile
.
dependency_by_name
(
'SomeExternalPod'
)
dep
.
should
.
be
.
external_podspec
dep
.
external_spec_source
.
should
==
{
:git
=>
'GIT-URL'
,
:commit
=>
'1234'
}
dep
.
external_spec_source
.
should
==
{
:git
=>
'GIT-URL'
,
:commit
=>
'1234'
}
end
end
...
@@ -32,7 +31,6 @@ describe "Pod::Podfile" do
...
@@ -32,7 +31,6 @@ describe "Pod::Podfile" do
dependency
'SomeExternalPod'
,
:podspec
=>
'http://gist/SomeExternalPod.podspec'
dependency
'SomeExternalPod'
,
:podspec
=>
'http://gist/SomeExternalPod.podspec'
end
end
dep
=
podfile
.
dependency_by_name
(
'SomeExternalPod'
)
dep
=
podfile
.
dependency_by_name
(
'SomeExternalPod'
)
dep
.
should
.
be
.
external_podspec
dep
.
external_spec_source
.
should
==
{
:podspec
=>
'http://gist/SomeExternalPod.podspec'
}
dep
.
external_spec_source
.
should
==
{
:podspec
=>
'http://gist/SomeExternalPod.podspec'
}
end
end
...
@@ -43,7 +41,6 @@ describe "Pod::Podfile" do
...
@@ -43,7 +41,6 @@ describe "Pod::Podfile" do
end
end
end
end
dep
=
podfile
.
dependency_by_name
(
'SomeExternalPod'
)
dep
=
podfile
.
dependency_by_name
(
'SomeExternalPod'
)
dep
.
should
.
be
.
inline_podspec
dep
.
specification
.
name
.
should
==
'SomeExternalPod'
dep
.
specification
.
name
.
should
==
'SomeExternalPod'
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