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
6b68f529
Commit
6b68f529
authored
Nov 18, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t create a target if its definition, in the Podfile, is empty (no dependencies). Closes #79.
parent
0318141b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
6 deletions
+47
-6
installer.rb
lib/cocoapods/installer.rb
+3
-3
podfile.rb
lib/cocoapods/podfile.rb
+11
-1
installer_spec.rb
spec/unit/installer_spec.rb
+15
-1
podfile_spec.rb
spec/unit/podfile_spec.rb
+18
-1
No files found.
lib/cocoapods/installer.rb
View file @
6b68f529
...
...
@@ -18,7 +18,7 @@ module Pod
include
Config
::
Mixin
include
Shared
attr_reader
:target
attr_reader
:
podfile
,
:project
,
:definition
,
:
target
def
initialize
(
podfile
,
project
,
definition
)
@podfile
,
@project
,
@definition
=
podfile
,
project
,
definition
...
...
@@ -163,8 +163,8 @@ module Pod
def
target_installers
@target_installers
||=
@podfile
.
target_definitions
.
values
.
map
do
|
definition
|
TargetInstaller
.
new
(
@podfile
,
project
,
definition
)
end
TargetInstaller
.
new
(
@podfile
,
project
,
definition
)
unless
definition
.
empty?
end
.
compact
end
def
install!
...
...
lib/cocoapods/podfile.rb
View file @
6b68f529
...
...
@@ -8,7 +8,13 @@ module Pod
end
def
lib_name
name
==
:default
?
"Pods"
:
"Pods-
#{
name
}
"
if
name
==
:default
"Pods"
elsif
@parent
"
#{
@parent
.
lib_name
}
-
#{
name
}
"
else
"Pods-
#{
name
}
"
end
end
# Returns *all* dependencies of this target, not only the target specific
...
...
@@ -16,6 +22,10 @@ module Pod
def
dependencies
@target_dependencies
+
(
@parent
?
@parent
.
dependencies
:
[])
end
def
empty?
target_dependencies
.
empty?
end
end
def
self
.
from_file
(
path
)
...
...
spec/unit/installer_spec.rb
View file @
6b68f529
...
...
@@ -3,7 +3,10 @@ require File.expand_path('../../spec_helper', __FILE__)
describe
"Pod::Installer"
do
describe
", by default,"
do
before
do
@xcconfig
=
Pod
::
Installer
.
new
(
Pod
::
Podfile
.
new
{
platform
:ios
}).
target_installers
.
first
.
xcconfig
.
to_hash
@xcconfig
=
Pod
::
Installer
.
new
(
Pod
::
Podfile
.
new
do
platform
:ios
dependency
'JSONKit'
end
).
target_installers
.
first
.
xcconfig
.
to_hash
end
it
"sets the header search paths where installed Pod headers can be found"
do
...
...
@@ -45,6 +48,17 @@ describe "Pod::Installer" do
installer
.
target_installers
.
first
.
bridge_support_generator
.
headers
.
should
==
expected
end
it
"omits empty target definitions"
do
podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
target
:not_empty
do
dependency
'JSONKit'
end
end
installer
=
Pod
::
Installer
.
new
(
podfile
)
installer
.
target_installers
.
map
(
&
:definition
).
map
(
&
:name
).
should
==
[
:not_empty
]
end
it
"moves the compile and link phases to the end of the build phases list, so Pod headers are copied first and sources can use the same header dir structure"
do
podfile
=
Pod
::
Podfile
.
new
do
platform
:osx
...
...
spec/unit/podfile_spec.rb
View file @
6b68f529
...
...
@@ -60,6 +60,14 @@ describe "Pod::Podfile" do
end
describe
"concerning targets (dependency groups)"
do
it
"returns wether or not a target has any dependencies"
do
Pod
::
Podfile
.
new
do
end
.
target_definitions
[
:default
].
should
.
be
.
empty
Pod
::
Podfile
.
new
do
dependency
'JSONKit'
end
.
target_definitions
[
:default
].
should
.
not
.
be
.
empty
end
before
do
@podfile
=
Pod
::
Podfile
.
new
do
target
:debug
do
...
...
@@ -68,6 +76,9 @@ describe "Pod::Podfile" do
target
:test
,
:exclusive
=>
true
do
dependency
'JSONKit'
target
:subtarget
do
dependency
'Reachability'
end
end
dependency
'ASIHTTPRequest'
...
...
@@ -75,7 +86,7 @@ describe "Pod::Podfile" do
end
it
"returns all dependencies of all targets combined, which is used during resolving to enusre compatible dependencies"
do
@podfile
.
dependencies
.
map
(
&
:name
).
sort
.
should
==
%w{ ASIHTTPRequest JSONKit SSZipArchive }
@podfile
.
dependencies
.
map
(
&
:name
).
sort
.
should
==
%w{ ASIHTTPRequest JSONKit
Reachability
SSZipArchive }
end
it
"adds dependencies outside of any explicit target block to the default target"
do
...
...
@@ -98,6 +109,12 @@ describe "Pod::Podfile" do
target
.
lib_name
.
should
==
'Pods-test'
target
.
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'JSONKit'
)]
end
it
"adds dependencies of the outer target to nested targets"
do
target
=
@podfile
.
target_definitions
[
:subtarget
]
target
.
lib_name
.
should
==
'Pods-test-subtarget'
target
.
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'Reachability'
),
Pod
::
Dependency
.
new
(
'JSONKit'
)]
end
end
describe
"concerning validations"
do
...
...
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