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
9ab707ef
Commit
9ab707ef
authored
Apr 27, 2014
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[linter] Check docset_url is valid HTTP URL
parent
2f444617
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
CHANGELOG.md
CHANGELOG.md
+2
-2
validator.rb
lib/cocoapods/validator.rb
+7
-0
validator_spec.rb
spec/unit/validator_spec.rb
+19
-0
No files found.
CHANGELOG.md
View file @
9ab707ef
...
...
@@ -6,8 +6,8 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
##### Enhancements
*
Validate the reachability of social_media_url, documentation_url
in
podspecs
while linting a specification.
*
Validate the reachability of social_media_url, documentation_url
and
docset_url in podspecs we
while linting a specification.
[
Kyle Fuller
](
https://github.com/kylef
)
[
#2025
](
https://github.com/CocoaPods/CocoaPods/issues/2025
)
...
...
lib/cocoapods/validator.rb
View file @
9ab707ef
...
...
@@ -200,6 +200,7 @@ module Pod
validate_screenshots
(
spec
)
validate_social_media_url
(
spec
)
validate_documentation_url
(
spec
)
validate_docset_url
(
spec
)
spec
.
available_platforms
.
each
do
|
platform
|
UI
.
message
"
\n\n
#{
spec
}
- Analyzing on
#{
platform
}
platform."
.
green
.
reversed
...
...
@@ -270,6 +271,12 @@ module Pod
validate_url
(
spec
.
documentation_url
)
if
spec
.
documentation_url
end
# Performs validations related to the `docset_url` attribute.
#
def
validate_docset_url
(
spec
)
validate_url
(
spec
.
docset_url
)
if
spec
.
docset_url
end
def
setup_validation_environment
validation_dir
.
rmtree
if
validation_dir
.
exist?
validation_dir
.
mkpath
...
...
spec/unit/validator_spec.rb
View file @
9ab707ef
...
...
@@ -228,6 +228,25 @@ module Pod
@sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/The URL (.*) is not reachable/
end
end
describe
"docset URL validation"
do
before
do
@sut
.
stubs
(
:validate_homepage
)
end
it
"checks if the docset URL is valid"
do
Specification
.
any_instance
.
stubs
(
:docset_url
).
returns
(
'http://banana-corp.local/'
)
WebMock
::
API
.
stub_request
(
:head
,
/banana-corp.local/
).
to_return
(
:status
=>
200
)
@sut
.
validate
@sut
.
results
.
should
.
be
.
empty?
end
it
"should fail validation if it wasn't able to validate the URL"
do
Specification
.
any_instance
.
stubs
(
:docset_url
).
returns
(
'http://banana-corp.local/not-found'
)
@sut
.
validate
@sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/The URL (.*) is not reachable/
end
end
end
it
"respects the no clean option"
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