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
ed1b63ca
Commit
ed1b63ca
authored
Oct 12, 2015
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AbstractExternalSource] Quickly validate specs
parent
76a401c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+22
-10
validator.rb
lib/cocoapods/validator.rb
+7
-2
No files found.
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
ed1b63ca
...
...
@@ -141,17 +141,29 @@ 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
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
.
new
(
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
sandbox
.
store_podspec
(
name
,
spec
,
true
,
json
)
end
end
end
...
...
lib/cocoapods/validator.rb
View file @
ed1b63ca
...
...
@@ -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
...
...
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