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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
25 deletions
+49
-25
lib.rb
lib/cocoapods/command/lib.rb
+31
-25
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,27 +107,29 @@ module Pod
...
@@ -106,27 +107,29 @@ module Pod
def
run
def
run
UI
.
puts
UI
.
puts
validator
=
Validator
.
new
(
podspec_to_lint
)
podspecs_to_lint
.
each
do
|
podspec
|
validator
.
local
=
true
validator
.
quick
=
@quick
validator
=
Validator
.
new
(
podspec
)
validator
.
no_clean
=
!
@clean
validator
.
local
=
true
validator
.
only_errors
=
@only_errors
validator
.
quick
=
@quick
validator
.
validate
validator
.
no_clean
=
!
@clean
validator
.
only_errors
=
@only_errors
unless
@clean
validator
.
validate
UI
.
puts
"Pods project available at `
#{
validator
.
validation_dir
}
/Pods/Pods.xcodeproj` for inspection."
UI
.
puts
unless
@clean
end
UI
.
puts
"Pods project available at `
#{
validator
.
validation_dir
}
/Pods/Pods.xcodeproj` for inspection."
UI
.
puts
if
validator
.
validated?
end
UI
.
puts
"
#{
validator
.
spec
.
name
}
passed validation."
.
green
if
validator
.
validated?
else
UI
.
puts
"
#{
validator
.
spec
.
name
}
passed validation."
.
green
message
=
"
#{
validator
.
spec
.
name
}
did not pass validation."
else
if
@clean
message
=
"
#{
validator
.
spec
.
name
}
did not pass validation."
message
<<
"
\n
You can use the `--no-clean` option to inspect "
\
if
@clean
"any issue."
message
<<
"
\n
You can use the `--no-clean` option to inspect "
\
"any issue."
end
raise
Informative
,
message
end
end
raise
Informative
,
message
end
end
end
end
...
@@ -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
podspecs
=
Pathname
.
glob
(
Pathname
.
pwd
+
'*.podspec{.yaml,}'
)
if
!
@podspecs_paths
.
empty?
then
raise
Informative
,
"Unable to find a podspec in the working directory"
if
podspecs
.
count
.
zero?
Array
(
@podspecs_paths
)
raise
Informative
,
"Multiple podspecs detected in the working directory"
if
podspecs
.
count
>
1
else
podspecs
.
first
podspecs
=
Pathname
.
glob
(
Pathname
.
pwd
+
'*.podspec{.yaml,}'
)
raise
Informative
,
"Unable to find a podspec in the working directory"
if
podspecs
.
count
.
zero?
podspecs
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