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
64bdde9f
Commit
64bdde9f
authored
Oct 31, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4372 from CocoaPods/seg-validate-external-source-specs
[AbstractExternalSource] Quickly validate specs
parents
76a401c0
f4c0016b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
15 deletions
+73
-15
CHANGELOG.md
CHANGELOG.md
+4
-1
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+27
-11
validator.rb
lib/cocoapods/validator.rb
+7
-2
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
abstract_external_source_spec.rb
spec/unit/external_sources/abstract_external_source_spec.rb
+34
-0
No files found.
CHANGELOG.md
View file @
64bdde9f
...
...
@@ -44,10 +44,13 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
#2134
](
https://github.com/CocoaPods/CocoaPods/issues/2134
)
*
The
`Info.plist`
file's
`CFBundleIdentifier`
is now set via the
`PRODUCT_BUNDLE_IDENTIFIER`
build setting, consisten with Xcode 7.
`PRODUCT_BUNDLE_IDENTIFIER`
build setting, consisten
t
with Xcode 7.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#4426
](
https://github.com/CocoaPods/CocoaPods/issues/4426
)
*
Externally-sourced pods will now have their specifications quickly linted.
[
Samuel Giddins
](
https://github.com/segiddins
)
##### Bug Fixes
*
Improve repo lint error message when no repo found with given name.
...
...
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
64bdde9f
...
...
@@ -141,17 +141,33 @@ module Pod
# @return [void]
#
def
store_podspec
(
sandbox
,
spec
,
json
=
false
)
if
spec
.
is_a?
Pathname
spec
=
Specification
.
from_file
(
spec
).
to_pretty_json
json
=
true
elsif
spec
.
is_a?
(
String
)
&&
!
json
spec
=
Specification
.
from_string
(
spec
,
'spec.podspec'
).
to_pretty_json
json
=
true
elsif
spec
.
is_a?
(
Specification
)
spec
=
spec
.
to_pretty_json
json
=
true
end
sandbox
.
store_podspec
(
name
,
spec
,
true
,
json
)
case
spec
when
Pathname
spec
=
Specification
.
from_file
(
spec
)
when
String
path
=
"
#{
name
}
.podspec"
path
<<
'.json'
if
json
spec
=
Specification
.
from_string
(
spec
,
path
)
end
validate_podspec
(
spec
)
sandbox
.
store_podspec
(
name
,
spec
.
to_pretty_json
,
true
,
true
)
end
def
validate_podspec
(
podspec
)
validator
=
validator_for_podspec
(
podspec
)
validator
.
quick
=
true
validator
.
allow_warnings
=
true
validator
.
ignore_public_only_results
=
true
Config
.
instance
.
with_changes
(
:silent
=>
true
)
do
validator
.
validate
end
unless
validator
.
validated?
raise
Informative
,
"The `
#{
name
}
` pod failed to validate due to
#{
validator
.
failure_reason
}
:
\n
#{
validator
.
results_message
}
"
end
end
def
validator_for_podspec
(
podspec
)
Validator
.
new
(
podspec
,
[])
end
end
end
...
...
lib/cocoapods/validator.rb
View file @
64bdde9f
...
...
@@ -88,6 +88,11 @@ module Pod
# @return [void]
#
def
print_results
UI
.
puts
results_message
end
def
results_message
message
=
''
results
.
each
do
|
result
|
if
result
.
platforms
==
[
:ios
]
platform_message
=
'[iOS] '
...
...
@@ -114,9 +119,9 @@ module Pod
when
:warning
then
type
=
'WARN'
when
:note
then
type
=
'NOTE'
else
raise
"
#{
result
.
type
}
"
end
UI
.
puts
" -
#{
type
.
ljust
(
5
)
}
|
#{
platform_message
}#{
subspecs_message
}#{
result
.
attribute_name
}
:
#{
result
.
message
}
"
message
<<
" -
#{
type
.
ljust
(
5
)
}
|
#{
platform_message
}#{
subspecs_message
}#{
result
.
attribute_name
}
:
#{
result
.
message
}
\n
"
end
UI
.
puts
message
<<
"
\n
"
end
def
failure_reason
...
...
cocoapods-integration-specs
@
5eab6c43
Subproject commit
a4589c40aa717e3410441e88763cad64f8c73e05
Subproject commit
5eab6c43953c286f591380508e51fe9571901a98
spec/unit/external_sources/abstract_external_source_spec.rb
View file @
64bdde9f
...
...
@@ -32,6 +32,7 @@ module Pod
describe
'Subclasses helpers'
do
it
'pre-downloads the Pod and stores the relevant information in the sandbox'
do
@subject
.
expects
(
:validate_podspec
).
with
{
|
spec
|
spec
.
name
.
should
==
'Reachability'
}
@subject
.
send
(
:pre_download
,
config
.
sandbox
)
path
=
config
.
sandbox
.
specifications_root
+
'Reachability.podspec.json'
path
.
should
.
exist?
...
...
@@ -43,6 +44,39 @@ module Pod
},
}
end
describe
'podspec validation'
do
before
do
@podspec
=
Pod
::
Specification
.
from_file
(
fixture
(
'spec-repos'
)
+
'master/Specs/JSONKit/1.4/JSONKit.podspec.json'
)
end
it
'returns a validator for the given podspec'
do
validator
=
@subject
.
send
(
:validator_for_podspec
,
@podspec
)
validator
.
spec
.
should
==
@podspec
end
before
do
@validator
=
mock
(
'Validator'
)
@validator
.
expects
(
:quick
=
).
with
(
true
)
@validator
.
expects
(
:allow_warnings
=
).
with
(
true
)
@validator
.
expects
(
:ignore_public_only_results
=
).
with
(
true
)
@validator
.
expects
(
:validate
)
@subject
.
stubs
(
:validator_for_podspec
).
returns
(
@validator
)
end
it
'validates with the correct settings'
do
@validator
.
expects
(
:validated?
).
returns
(
true
)
@subject
.
send
(
:validate_podspec
,
@podspec
)
end
it
'raises when validation fails'
do
@validator
.
expects
(
:validated?
).
returns
(
false
)
@validator
.
stubs
(
:results_message
).
returns
(
'results_message'
)
@validator
.
stubs
(
:failure_reason
).
returns
(
'failure_reason'
)
should
.
raise
(
Informative
)
{
@subject
.
send
(
:validate_podspec
,
@podspec
)
}.
message
.
should
.
include
"The `Reachability` pod failed to validate due to failure_reason:
\n
results_message"
end
end
end
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