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
c1704945
Commit
c1704945
authored
Oct 01, 2014
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Validator] take URLs instead of actual sources
parent
897dfd7b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
28 deletions
+25
-28
lib.rb
lib/cocoapods/command/lib.rb
+2
-6
push.rb
lib/cocoapods/command/repo/push.rb
+1
-1
spec.rb
lib/cocoapods/command/spec.rb
+1
-5
validator.rb
lib/cocoapods/validator.rb
+8
-3
validator_spec.rb
spec/unit/validator_spec.rb
+13
-13
No files found.
lib/cocoapods/command/lib.rb
View file @
c1704945
...
@@ -123,7 +123,7 @@ module Pod
...
@@ -123,7 +123,7 @@ module Pod
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@source
s
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@source
_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@podspecs_paths
=
argv
.
arguments!
@podspecs_paths
=
argv
.
arguments!
super
super
end
end
...
@@ -136,7 +136,7 @@ module Pod
...
@@ -136,7 +136,7 @@ module Pod
UI
.
puts
UI
.
puts
podspecs_to_lint
.
each
do
|
podspec
|
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
,
source
s
)
validator
=
Validator
.
new
(
podspec
,
@source_url
s
)
validator
.
local
=
true
validator
.
local
=
true
validator
.
quick
=
@quick
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
no_clean
=
!
@clean
...
@@ -169,10 +169,6 @@ module Pod
...
@@ -169,10 +169,6 @@ module Pod
#----------------------------------------#
#----------------------------------------#
def
sources
@sources
||=
@source_urls
.
map
{
|
url
|
SourcesManager
.
find_or_create_source_with_url
(
url
)
}
end
# !@group Private helpers
# !@group Private helpers
# @return [Pathname] The path of the podspec found in the current
# @return [Pathname] The path of the podspec found in the current
...
...
lib/cocoapods/command/repo/push.rb
View file @
c1704945
...
@@ -82,7 +82,7 @@ module Pod
...
@@ -82,7 +82,7 @@ module Pod
def
validate_podspec_files
def
validate_podspec_files
UI
.
puts
"
\n
Validating
#{
'spec'
.
pluralize
(
count
)
}
"
.
yellow
UI
.
puts
"
\n
Validating
#{
'spec'
.
pluralize
(
count
)
}
"
.
yellow
podspec_files
.
each
do
|
podspec
|
podspec_files
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
,
SourcesManager
.
all
)
validator
=
Validator
.
new
(
podspec
,
SourcesManager
.
all
.
map
(
&
:url
)
)
validator
.
only_errors
=
@allow_warnings
validator
.
only_errors
=
@allow_warnings
begin
begin
validator
.
validate
validator
.
validate
...
...
lib/cocoapods/command/spec.rb
View file @
c1704945
...
@@ -87,7 +87,7 @@ module Pod
...
@@ -87,7 +87,7 @@ module Pod
UI
.
puts
UI
.
puts
invalid_count
=
0
invalid_count
=
0
podspecs_to_lint
.
each
do
|
podspec
|
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
,
source
s
)
validator
=
Validator
.
new
(
podspec
,
@source_url
s
)
validator
.
quick
=
@quick
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
no_clean
=
!
@clean
validator
.
only_errors
=
@only_errors
validator
.
only_errors
=
@only_errors
...
@@ -115,10 +115,6 @@ module Pod
...
@@ -115,10 +115,6 @@ module Pod
private
private
def
sources
@sources
||=
@source_urls
.
map
{
|
url
|
SourcesManager
.
find_or_create_source_with_url
(
url
)
}
end
def
podspecs_to_lint
def
podspecs_to_lint
@podspecs_to_lint
||=
begin
@podspecs_to_lint
||=
begin
files
=
[]
files
=
[]
...
...
lib/cocoapods/validator.rb
View file @
c1704945
...
@@ -19,8 +19,11 @@ module Pod
...
@@ -19,8 +19,11 @@ module Pod
# @param [Specification, Pathname, String] spec_or_path
# @param [Specification, Pathname, String] spec_or_path
# the Specification or the path of the `podspec` file to lint.
# the Specification or the path of the `podspec` file to lint.
#
#
def
initialize
(
spec_or_path
,
sources
)
# @param [Array<String>] source_urls
@sources
=
sources
# the Source URLs to use in creating a {Podfile}.
#
def
initialize
(
spec_or_path
,
source_urls
)
@source_urls
=
source_urls
@linter
=
Specification
::
Linter
.
new
(
spec_or_path
)
@linter
=
Specification
::
Linter
.
new
(
spec_or_path
)
end
end
...
@@ -412,7 +415,9 @@ module Pod
...
@@ -412,7 +415,9 @@ module Pod
# @return [Array<Source>] an array of sources used to create the
# @return [Array<Source>] an array of sources used to create the
# {Podfile} used in the linting process
# {Podfile} used in the linting process
#
#
attr_reader
:sources
def
sources
@sources
||=
@source_urls
.
map
{
|
url
|
SourcesManager
.
find_or_create_source_with_url
(
url
)
}
end
# @return [Podfile] a podfile that requires the specification on the
# @return [Podfile] a podfile that requires the specification on the
# current platform.
# current platform.
...
...
spec/unit/validator_spec.rb
View file @
c1704945
...
@@ -47,7 +47,7 @@ module Pod
...
@@ -47,7 +47,7 @@ module Pod
describe
'Quick mode'
do
describe
'Quick mode'
do
it
'validates a correct podspec'
do
it
'validates a correct podspec'
do
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
quick
=
true
sut
.
quick
=
true
sut
.
validate
sut
.
validate
sut
.
results
.
should
==
[]
sut
.
results
.
should
==
[]
...
@@ -57,7 +57,7 @@ module Pod
...
@@ -57,7 +57,7 @@ module Pod
it
'lints the podspec during validation'
do
it
'lints the podspec during validation'
do
podspec
=
stub_podspec
(
/.*name.*/
,
'"name": "TEST",'
)
podspec
=
stub_podspec
(
/.*name.*/
,
'"name": "TEST",'
)
file
=
write_podspec
(
podspec
)
file
=
write_podspec
(
podspec
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
quick
=
true
sut
.
quick
=
true
sut
.
validate
sut
.
validate
sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/should match the name/
sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/should match the name/
...
@@ -66,7 +66,7 @@ module Pod
...
@@ -66,7 +66,7 @@ module Pod
it
'respects quick mode'
do
it
'respects quick mode'
do
file
=
write_podspec
(
stub_podspec
)
file
=
write_podspec
(
stub_podspec
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
quick
=
true
sut
.
quick
=
true
sut
.
expects
(
:perform_extensive_analysis
).
never
sut
.
expects
(
:perform_extensive_analysis
).
never
sut
.
validate
sut
.
validate
...
@@ -75,7 +75,7 @@ module Pod
...
@@ -75,7 +75,7 @@ module Pod
it
'respects the only errors option'
do
it
'respects the only errors option'
do
podspec
=
stub_podspec
(
/.*summary.*/
,
'"summary": "A short description of",'
)
podspec
=
stub_podspec
(
/.*summary.*/
,
'"summary": "A short description of",'
)
file
=
write_podspec
(
podspec
)
file
=
write_podspec
(
podspec
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
quick
=
true
sut
.
quick
=
true
sut
.
only_errors
=
true
sut
.
only_errors
=
true
sut
.
validate
sut
.
validate
...
@@ -85,7 +85,7 @@ module Pod
...
@@ -85,7 +85,7 @@ module Pod
it
'handles symlinks'
do
it
'handles symlinks'
do
file
=
write_podspec
(
stub_podspec
)
file
=
write_podspec
(
stub_podspec
)
validator
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
validator
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
validator
.
quick
=
true
validator
.
quick
=
true
validator
.
stubs
(
:validate_url
)
validator
.
stubs
(
:validate_url
)
validator
.
validate
validator
.
validate
...
@@ -99,7 +99,7 @@ module Pod
...
@@ -99,7 +99,7 @@ module Pod
describe
'URL validation'
do
describe
'URL validation'
do
before
do
before
do
@sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
)
@sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
)
)
@sut
.
stubs
(
:install_pod
)
@sut
.
stubs
(
:install_pod
)
@sut
.
stubs
(
:build_pod
)
@sut
.
stubs
(
:build_pod
)
@sut
.
stubs
(
:check_file_patterns
)
@sut
.
stubs
(
:check_file_patterns
)
...
@@ -257,7 +257,7 @@ module Pod
...
@@ -257,7 +257,7 @@ module Pod
it
'respects the no clean option'
do
it
'respects the no clean option'
do
file
=
write_podspec
(
stub_podspec
)
file
=
write_podspec
(
stub_podspec
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
sut
.
no_clean
=
true
sut
.
no_clean
=
true
sut
.
validate
sut
.
validate
...
@@ -266,7 +266,7 @@ module Pod
...
@@ -266,7 +266,7 @@ module Pod
it
'builds the pod per platform'
do
it
'builds the pod per platform'
do
file
=
write_podspec
(
stub_podspec
)
file
=
write_podspec
(
stub_podspec
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
sut
.
expects
(
:install_pod
).
twice
sut
.
expects
(
:install_pod
).
twice
sut
.
expects
(
:build_pod
).
twice
sut
.
expects
(
:build_pod
).
twice
...
@@ -275,7 +275,7 @@ module Pod
...
@@ -275,7 +275,7 @@ module Pod
end
end
it
'uses the deployment target of the specification'
do
it
'uses the deployment target of the specification'
do
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_screenshots
)
sut
.
stubs
(
:validate_screenshots
)
podfile
=
sut
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
podfile
=
sut
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
...
@@ -284,7 +284,7 @@ module Pod
...
@@ -284,7 +284,7 @@ module Pod
end
end
it
'respects the local option'
do
it
'respects the local option'
do
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
podfile
=
sut
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
podfile
=
sut
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
deployment_target
=
podfile
.
target_definitions
[
'Pods'
].
platform
.
deployment_target
deployment_target
=
podfile
.
target_definitions
[
'Pods'
].
platform
.
deployment_target
...
@@ -292,7 +292,7 @@ module Pod
...
@@ -292,7 +292,7 @@ module Pod
end
end
it
'uses xcodebuild to generate notes and warnings'
do
it
'uses xcodebuild to generate notes and warnings'
do
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:check_file_patterns
)
sut
.
stubs
(
:check_file_patterns
)
sut
.
stubs
(
:xcodebuild
).
returns
(
"file.m:1:1: warning: direct access to objective-c's isa is deprecated"
)
sut
.
stubs
(
:xcodebuild
).
returns
(
"file.m:1:1: warning: direct access to objective-c's isa is deprecated"
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
...
@@ -304,7 +304,7 @@ module Pod
...
@@ -304,7 +304,7 @@ module Pod
it
'checks for file patterns'
do
it
'checks for file patterns'
do
file
=
write_podspec
(
stub_podspec
(
/.*source_files.*/
,
'"source_files": "wrong_paht.*",'
))
file
=
write_podspec
(
stub_podspec
(
/.*source_files.*/
,
'"source_files": "wrong_paht.*",'
))
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:build_pod
)
sut
.
stubs
(
:build_pod
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
sut
.
validate
sut
.
validate
...
@@ -319,7 +319,7 @@ module Pod
...
@@ -319,7 +319,7 @@ module Pod
file
=
write_podspec
(
podspec
,
'ZKit.podspec.json'
)
file
=
write_podspec
(
podspec
,
'ZKit.podspec.json'
)
spec
=
Specification
.
from_file
(
file
)
spec
=
Specification
.
from_file
(
file
)
sut
=
Validator
.
new
(
spec
,
SourcesManager
.
master
)
sut
=
Validator
.
new
(
spec
,
SourcesManager
.
master
.
map
(
&
:url
)
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:validate_url
)
sut
.
stubs
(
:build_pod
)
sut
.
stubs
(
:build_pod
)
sut
.
validate
sut
.
validate
...
...
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