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
2cd8016b
Commit
2cd8016b
authored
Dec 29, 2015
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TargetInspector] List all native targets when user target isn't found
parent
0bb4eeac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
target_inspector.rb
lib/cocoapods/installer/analyzer/target_inspector.rb
+7
-3
target_inspector_spec.rb
spec/unit/installer/analyzer/target_inspector_spec.rb
+12
-0
No files found.
lib/cocoapods/installer/analyzer/target_inspector.rb
View file @
2cd8016b
require
'active_support/core_ext/array/conversions'
module
Pod
class
Installer
class
Analyzer
...
...
@@ -103,9 +105,11 @@ module Pod
def
compute_targets
(
user_project
)
native_targets
=
user_project
.
native_targets
target
=
native_targets
.
find
{
|
t
|
t
.
name
==
target_definition
.
name
.
to_s
}
targets
=
[
target
].
compact
raise
Informative
,
"Unable to find a target named `
#{
target_definition
.
name
}
`"
if
targets
.
empty?
targets
unless
target
found
=
native_targets
.
map
{
|
t
|
"`
#{
t
.
name
}
`"
}.
to_sentence
raise
Informative
,
"Unable to find a target named `
#{
target_definition
.
name
}
`, did find
#{
found
}
."
end
[
target
]
end
# @param [Array<PBXNativeTarget] the user's targets of the project of
...
...
spec/unit/installer/analyzer/target_inspector_spec.rb
View file @
2cd8016b
...
...
@@ -77,6 +77,18 @@ module Pod
e
.
message
.
should
.
match
/Unable to find a target named `UserTarget`/
end
it
'suggests project native target names if the target cannot be found'
do
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'UserTarget'
,
nil
)
user_project
=
Xcodeproj
::
Project
.
new
(
'path'
)
user_project
.
new_target
(
:application
,
'FirstTarget'
,
:ios
)
user_project
.
new_target
(
:application
,
'SecondTarget'
,
:ios
)
user_project
.
new_target
(
:application
,
'ThirdTarget'
,
:ios
)
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
e
=
lambda
{
target_inspector
.
send
(
:compute_targets
,
user_project
)
}.
should
.
raise
Informative
e
.
message
.
should
.
include
'did find `FirstTarget`, `SecondTarget`, and `ThirdTarget`.'
end
it
'returns the target with the same name of the target definition'
do
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'UserTarget'
,
nil
)
user_project
=
Xcodeproj
::
Project
.
new
(
'path'
)
...
...
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