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
d6b531c6
Commit
d6b531c6
authored
Dec 01, 2013
by
Kra Larivain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added support for lint-ing a folder with multiple specs
parent
0e1d101d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
lib.rb
lib/cocoapods/command/lib.rb
+11
-5
lib_spec.rb
spec/functional/command/lib_spec.rb
+18
-0
No files found.
lib/cocoapods/command/lib.rb
View file @
d6b531c6
...
@@ -97,6 +97,7 @@ module Pod
...
@@ -97,6 +97,7 @@ module Pod
@quick
=
argv
.
flag?
(
'quick'
)
@quick
=
argv
.
flag?
(
'quick'
)
@only_errors
=
argv
.
flag?
(
'only-errors'
)
@only_errors
=
argv
.
flag?
(
'only-errors'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@podspecs_paths
=
argv
.
arguments!
super
super
end
end
...
@@ -106,7 +107,9 @@ module Pod
...
@@ -106,7 +107,9 @@ module Pod
def
run
def
run
UI
.
puts
UI
.
puts
validator
=
Validator
.
new
(
podspec_to_lint
)
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
)
validator
.
local
=
true
validator
.
local
=
true
validator
.
quick
=
@quick
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
no_clean
=
!
@clean
...
@@ -117,7 +120,6 @@ module Pod
...
@@ -117,7 +120,6 @@ module Pod
UI
.
puts
"Pods project available at `
#{
validator
.
validation_dir
}
/Pods/Pods.xcodeproj` for inspection."
UI
.
puts
"Pods project available at `
#{
validator
.
validation_dir
}
/Pods/Pods.xcodeproj` for inspection."
UI
.
puts
UI
.
puts
end
end
if
validator
.
validated?
if
validator
.
validated?
UI
.
puts
"
#{
validator
.
spec
.
name
}
passed validation."
.
green
UI
.
puts
"
#{
validator
.
spec
.
name
}
passed validation."
.
green
else
else
...
@@ -129,6 +131,7 @@ module Pod
...
@@ -129,6 +131,7 @@ module Pod
raise
Informative
,
message
raise
Informative
,
message
end
end
end
end
end
private
private
...
@@ -142,11 +145,14 @@ module Pod
...
@@ -142,11 +145,14 @@ module Pod
# @raise If no podspec is found.
# @raise If no podspec is found.
# @raise If multiple podspecs are found.
# @raise If multiple podspecs are found.
#
#
def
podspec_to_lint
def
podspecs_to_lint
if
!
@podspecs_paths
.
empty?
then
Array
(
@podspecs_paths
)
else
podspecs
=
Pathname
.
glob
(
Pathname
.
pwd
+
'*.podspec{.yaml,}'
)
podspecs
=
Pathname
.
glob
(
Pathname
.
pwd
+
'*.podspec{.yaml,}'
)
raise
Informative
,
"Unable to find a podspec in the working directory"
if
podspecs
.
count
.
zero?
raise
Informative
,
"Unable to find a podspec in the working directory"
if
podspecs
.
count
.
zero?
raise
Informative
,
"Multiple podspecs detected in the working directory"
if
podspecs
.
count
>
1
podspecs
podspecs
.
first
end
end
end
end
end
...
...
spec/functional/command/lib_spec.rb
View file @
d6b531c6
...
@@ -12,5 +12,23 @@ module Pod
...
@@ -12,5 +12,23 @@ module Pod
lambda
{
run_command
(
'lib'
,
'create'
,
'Pod Name With Spaces'
)
}.
should
.
raise
CLAide
::
Help
lambda
{
run_command
(
'lib'
,
'create'
,
'Pod Name With Spaces'
)
}.
should
.
raise
CLAide
::
Help
end
end
end
end
describe
Command
::
Lib
::
Lint
do
it
"lints the current working directory"
do
Dir
.
chdir
(
fixture
(
'integration/Reachability'
))
do
cmd
=
command
(
'lib'
,
'lint'
,
'--only-errors'
)
cmd
.
run
UI
.
output
.
should
.
include
"passed validation"
end
end
it
"lints a single spec in the current working directory"
do
Dir
.
chdir
(
fixture
(
'integration/Reachability'
))
do
cmd
=
command
(
'lib'
,
'lint'
,
'Reachability.podspec'
,
'--quick'
,
'--only-errors'
)
cmd
.
run
UI
.
output
.
should
.
include
"passed validation"
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