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
7e391972
Commit
7e391972
authored
Apr 04, 2015
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Rakefile] Improve inch:spec task
parent
a5fb5466
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
3 deletions
+49
-3
Rakefile
Rakefile
+49
-3
No files found.
Rakefile
View file @
7e391972
...
...
@@ -303,9 +303,51 @@ begin
namespace
:inch
do
desc
'Lint the completeness of the documentation with Inch'
task
:spec
do
sh
"inch --all --no-undocumented list | tee tmp/inch.txt"
sh
"grep -q 'Nothing to suggest.' tmp/inch.txt"
do
|
ok
,
_
|
fail
red
(
'✗ Improve above suggestions.'
)
unless
ok
require
'inch'
require
'inch/cli'
puts
'Parse docs …'
YARD
::
Parser
::
SourceParser
.
before_parse_file
do
|
_
|
print
green
(
'.'
)
# Visualize progress
end
class
ProgressEnumerable
include
Enumerable
def
initialize
(
array
)
@array
=
array
end
def
each
@array
.
each
do
|
e
|
print
'.'
yield
e
end
end
end
Inch
::
Codebase
::
Objects
.
class_eval
do
alias_method
:old_init
,
:initialize
def
initialize
(
language
,
objects
)
puts
"
\n\n
Evaluating …"
old_init
(
language
,
ProgressEnumerable
.
new
(
objects
))
end
end
codebase
=
Inch
::
Codebase
.
parse
(
Dir
.
pwd
,
Inch
::
Config
.
codebase
)
context
=
Inch
::
API
::
List
.
new
(
codebase
,
{})
options
=
Inch
::
CLI
::
Command
::
Options
::
List
.
new
options
.
show_all
=
true
options
.
ui
=
Inch
::
Utils
::
UI
.
new
failing_grade_symbols
=
[
:B
,
:C
]
# add :U for undocumented
failing_grade_list
=
context
.
grade_lists
.
select
{
|
g
|
failing_grade_symbols
.
include?
(
g
.
to_sym
)
}
Inch
::
CLI
::
Command
::
Output
::
List
.
new
(
options
,
context
.
objects
,
failing_grade_list
)
puts
if
context
.
objects
.
any?
{
|
o
|
failing_grade_symbols
.
include?
(
o
.
grade
.
to_sym
)
}
puts
red
(
'✗ Lint of Documentation failed: Please improve above suggestions.'
)
exit
1
else
puts
green
(
'✓ Nothing to improve detected.'
)
end
end
end
...
...
@@ -348,6 +390,10 @@ def title(title)
puts
end
def
green
(
string
)
"
\033
[0;32m
#{
string
}
\e
[0m"
end
def
red
(
string
)
"
\033
[0;31m
#{
string
}
\e
[0m"
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