detroit-yardstick 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.index +52 -0
- data/.yardopts +7 -2
- data/COPYING.md +701 -0
- data/HISTORY.md +5 -0
- data/README.md +42 -0
- data/lib/detroit-yardstick.rb +69 -59
- data/man/detroit-yardstick.5 +83 -0
- data/man/detroit-yardstick.5.html +148 -0
- data/man/detroit-yardstick.5.ronn +32 -57
- metadata +49 -29
- data/.ruby +0 -41
- data/COPYING.rdoc +0 -21
- data/LICENSE.txt +0 -674
- data/README.rdoc +0 -22
data/HISTORY.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Detroit Yardstick Tool
|
2
|
+
|
3
|
+
[Website](http://rubyworks.github.com/detroit-yardstick) /
|
4
|
+
[Report Issue](http://github.com/rubyworks/detroit-yardstick/issues) /
|
5
|
+
[Development](http://github.com/rubyworks/detroit-yardstick)
|
6
|
+
|
7
|
+
[![Build Status](https://secure.travis-ci.org/rubyworks/detroit-yardstick.png)](http://travis-ci.org/rubyworks/detroit-yardstick)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/detroit-yardstick.png)](http://badge.fury.io/rb/detroit-yardstick)
|
9
|
+
[![Flattr Me](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund)
|
10
|
+
|
11
|
+
|
12
|
+
## About
|
13
|
+
|
14
|
+
The Yardstick tool generates documenation coverage report's using the
|
15
|
+
Yardstick gem. This occurs `post-document` on the standard assembly.
|
16
|
+
|
17
|
+
|
18
|
+
## Install
|
19
|
+
|
20
|
+
### Using RubyGems
|
21
|
+
|
22
|
+
$ gem install detroit-yardstick
|
23
|
+
|
24
|
+
|
25
|
+
## Legal
|
26
|
+
|
27
|
+
Detroit Yardstick
|
28
|
+
|
29
|
+
Copyright (c) 2011 Rubyworks
|
30
|
+
|
31
|
+
This program is free software: you can redistribute it and/or modify
|
32
|
+
it under the terms of the GNU General Public License as published by
|
33
|
+
the Free Software Foundation, either version 3 of the License, or
|
34
|
+
(at your option) any later version.
|
35
|
+
|
36
|
+
This program is distributed in the hope that it will be useful,
|
37
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
38
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
39
|
+
GNU General Public License for more details.
|
40
|
+
|
41
|
+
See COPYING.md for details.
|
42
|
+
|
data/lib/detroit-yardstick.rb
CHANGED
@@ -1,47 +1,66 @@
|
|
1
|
-
require 'detroit
|
1
|
+
require 'detroit'
|
2
2
|
|
3
3
|
module Detroit
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
|
12
|
-
# Yardstick service.
|
5
|
+
##
|
6
|
+
# Yardstick is a documentation coverage metric tool.
|
7
|
+
#
|
8
|
+
# @assembly Standard
|
9
|
+
#
|
10
|
+
# @todo Switch to analyze station if detroit moves it after document.
|
13
11
|
#
|
14
12
|
class Yardstick < Tool
|
15
13
|
|
16
|
-
#
|
14
|
+
# Designed to work with the Standard assembly attaching to the
|
15
|
+
# `post-document` station.
|
17
16
|
#
|
18
|
-
#
|
19
|
-
#
|
17
|
+
# @!parse
|
18
|
+
# include Standard
|
19
|
+
#
|
20
|
+
assembly Standard
|
21
|
+
|
22
|
+
# Location of the manpage document for this tool.
|
23
|
+
MANPAGE = File.dirname(__FILE__) + '/../man/detroit-yardstick.5'
|
24
|
+
|
25
|
+
# Prerequisite setup.
|
20
26
|
#
|
21
27
|
# @return [undefined]
|
28
|
+
def prerequisite
|
29
|
+
require 'yardstick'
|
30
|
+
|
31
|
+
@path = 'lib/**/*.rb'
|
32
|
+
@output = project.log + 'yardstick.txt'
|
33
|
+
@verbose = true
|
34
|
+
@exact = true
|
35
|
+
end
|
36
|
+
|
37
|
+
# List of paths to measure.
|
38
|
+
#
|
39
|
+
# @param [Array<#to_s>, #to_s] path
|
40
|
+
# optional list of paths to measure
|
22
41
|
#
|
23
|
-
# @
|
42
|
+
# @return [String,Array<String>]
|
24
43
|
attr_accessor :path
|
25
44
|
|
26
|
-
# The path to the file where the measurements will be written
|
45
|
+
# The path to the file where the measurements will be written.
|
27
46
|
#
|
28
47
|
# @param [String, Pathname] output
|
29
48
|
# optional output path for measurements
|
30
49
|
#
|
31
|
-
# @return [
|
32
|
-
#
|
33
|
-
# @api public
|
50
|
+
# @return [String]
|
34
51
|
attr_accessor :output
|
35
52
|
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
#
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
53
|
+
# return [Integer]
|
54
|
+
attr_accessor :threshold
|
55
|
+
|
56
|
+
# return [Boolean]
|
57
|
+
attr_accessor :verbose
|
58
|
+
|
59
|
+
# return [Boolean]
|
60
|
+
attr_accessor :exact
|
61
|
+
|
62
|
+
# @return [Hash]
|
63
|
+
attr_accessor :rules
|
45
64
|
|
46
65
|
# Measure the documentation and write to output.
|
47
66
|
#
|
@@ -49,10 +68,8 @@ module Detroit
|
|
49
68
|
# tool.save # (save measurement report to output)
|
50
69
|
#
|
51
70
|
# @return [undefined]
|
52
|
-
#
|
53
|
-
# @api public
|
54
71
|
def save
|
55
|
-
write_report { |io| ::Yardstick.measure(
|
72
|
+
write_report { |io| ::Yardstick.measure(yard_config).puts(io) }
|
56
73
|
end
|
57
74
|
|
58
75
|
# Measure the documentation and write to stdout.
|
@@ -61,39 +78,40 @@ module Detroit
|
|
61
78
|
# tool.print # (print measurement report to stdout)
|
62
79
|
#
|
63
80
|
# @return [undefined]
|
64
|
-
#
|
65
|
-
# @api public
|
66
81
|
def print
|
67
82
|
::Yardstick.measure(path).puts($stdout)
|
68
83
|
end
|
69
84
|
|
70
|
-
#
|
71
|
-
|
72
|
-
# Detroit station for yardstick measure is post-document.
|
85
|
+
# This tool ties into the `post_document` station of the standard assembly.
|
73
86
|
#
|
74
|
-
# @
|
87
|
+
# @return [Boolean,Symbol]
|
75
88
|
def assemble?(station, options={})
|
76
|
-
|
77
|
-
|
78
|
-
end
|
89
|
+
return :save if station == :post_document
|
90
|
+
return false
|
79
91
|
end
|
80
92
|
|
81
|
-
|
93
|
+
private
|
94
|
+
|
82
95
|
#
|
83
|
-
|
84
|
-
|
85
|
-
case station
|
86
|
-
when :post_document
|
87
|
-
save
|
88
|
-
end
|
96
|
+
def yard_config
|
97
|
+
Yardstick::Config.coerce(yard_options)
|
89
98
|
end
|
90
99
|
|
91
|
-
#
|
92
|
-
def
|
93
|
-
|
94
|
-
end
|
100
|
+
#
|
101
|
+
def yardstick_options
|
102
|
+
opts = {}
|
95
103
|
|
96
|
-
|
104
|
+
opts[:path] = path
|
105
|
+
opts[:output] = output
|
106
|
+
opts[:verbose] = verbose
|
107
|
+
|
108
|
+
opts[:require_exact_threshold] = exact
|
109
|
+
|
110
|
+
opts[:threshold] = threshold if threashold
|
111
|
+
opts[:rules] = rules if rules
|
112
|
+
|
113
|
+
return opts
|
114
|
+
end
|
97
115
|
|
98
116
|
# Open up a report for writing
|
99
117
|
#
|
@@ -103,21 +121,13 @@ module Detroit
|
|
103
121
|
# @yieldparam [#puts] io
|
104
122
|
# the object that responds to #puts
|
105
123
|
#
|
106
|
-
# @return [
|
107
|
-
#
|
108
|
-
# @api private
|
124
|
+
# @return [void]
|
109
125
|
def write_report(&block)
|
110
126
|
file = Pathname(output)
|
111
127
|
file.dirname.mkpath
|
112
128
|
file.open('w', &block)
|
113
129
|
end
|
114
130
|
|
115
|
-
#
|
116
|
-
def initialize_require
|
117
|
-
#require 'pathname'
|
118
|
-
require 'yardstick'
|
119
|
-
end
|
120
|
-
|
121
131
|
end
|
122
132
|
|
123
133
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "DETROIT\-YARDSTICK" "5" "January 2014" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBdetroit\-yardstick\fR \- documentation coverage plugin for detroit
|
8
|
+
.
|
9
|
+
.SH "DESCRIPTION"
|
10
|
+
This is a Yardstick plugin for Detroit\. Yardstick is a tool that verifies documentation coverage of Ruby code\. It will measure the source and provide feedback on what is missing from the documentation and what can be improved\.
|
11
|
+
.
|
12
|
+
.P
|
13
|
+
This plugin links into the post\-document stage of the standard assembly\.
|
14
|
+
.
|
15
|
+
.SH "OPTIONS"
|
16
|
+
The following options can be used in the Detroit toolchain file for defining a yardstick tool instance\.
|
17
|
+
.
|
18
|
+
.IP "\(bu" 4
|
19
|
+
\fBoutput\fR \- The path to the file where the measurements will be written\. Default is the typical \fBlib/**/*\.rb\fR\.
|
20
|
+
.
|
21
|
+
.IP "\(bu" 4
|
22
|
+
\fBpath\fR \- Path or list of paths to measure\. Defaults to the project\'s log directory, e\.g\. \fBlog/\fR, in a \fByardstick\.txt\fR file\.
|
23
|
+
.
|
24
|
+
.IP "\(bu" 4
|
25
|
+
\fBthreshold\fR \- Defaults to the maximum 100\.
|
26
|
+
.
|
27
|
+
.IP "\(bu" 4
|
28
|
+
\fBexact\fR \- Whether the threshold must be exact\.
|
29
|
+
.
|
30
|
+
.IP "\(bu" 4
|
31
|
+
\fBrules\fR \- Yardstick\'s measure rules can be customized individually\. with this option\. See https://github\.com/dkubb/yardstick for detials\.
|
32
|
+
.
|
33
|
+
.IP "" 0
|
34
|
+
.
|
35
|
+
.SH "Examples:"
|
36
|
+
The simplest entry is
|
37
|
+
.
|
38
|
+
.IP "" 4
|
39
|
+
.
|
40
|
+
.nf
|
41
|
+
|
42
|
+
yardstick:
|
43
|
+
active: true
|
44
|
+
.
|
45
|
+
.fi
|
46
|
+
.
|
47
|
+
.IP "" 0
|
48
|
+
.
|
49
|
+
.P
|
50
|
+
A fuller example might look something like this
|
51
|
+
.
|
52
|
+
.IP "" 4
|
53
|
+
.
|
54
|
+
.nf
|
55
|
+
|
56
|
+
yardstick:
|
57
|
+
output: log/measurement\.txt
|
58
|
+
path:
|
59
|
+
\- lib/**/*\.rb
|
60
|
+
.
|
61
|
+
.fi
|
62
|
+
.
|
63
|
+
.IP "" 0
|
64
|
+
.
|
65
|
+
.SH "RESOURCES"
|
66
|
+
For more information:
|
67
|
+
.
|
68
|
+
.IP "\(bu" 4
|
69
|
+
API Documentation \fIhttp://rubydoc\.info/gems/detroit\-yardstick\fR
|
70
|
+
.
|
71
|
+
.IP "\(bu" 4
|
72
|
+
Development Site \fIhttp://github\.com/detroit/detroit\-yardstick\fR
|
73
|
+
.
|
74
|
+
.IP "" 0
|
75
|
+
.
|
76
|
+
.SH "COPYRIGHT"
|
77
|
+
Copyright (c) 2010 Rubyworks
|
78
|
+
.
|
79
|
+
.P
|
80
|
+
Detroit Yardstick is distributable in accordance with the GPL v3 license\.
|
81
|
+
.
|
82
|
+
.SH "SEE ALSO"
|
83
|
+
detroit(1), yardstick(1)
|
@@ -0,0 +1,148 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>detroit-yardstick(5) - documentation coverage plugin for detroit</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
</head>
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
58
|
+
<a href="#OPTIONS">OPTIONS</a>
|
59
|
+
<a href="#Examples-">Examples:</a>
|
60
|
+
<a href="#RESOURCES">RESOURCES</a>
|
61
|
+
<a href="#COPYRIGHT">COPYRIGHT</a>
|
62
|
+
<a href="#SEE-ALSO">SEE ALSO</a>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<ol class='man-decor man-head man head'>
|
66
|
+
<li class='tl'>detroit-yardstick(5)</li>
|
67
|
+
<li class='tc'></li>
|
68
|
+
<li class='tr'>detroit-yardstick(5)</li>
|
69
|
+
</ol>
|
70
|
+
|
71
|
+
<h2 id="NAME">NAME</h2>
|
72
|
+
<p class="man-name">
|
73
|
+
<code>detroit-yardstick</code> - <span class="man-whatis">documentation coverage plugin for detroit</span>
|
74
|
+
</p>
|
75
|
+
|
76
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
77
|
+
|
78
|
+
<p>This is a Yardstick plugin for Detroit. Yardstick is a tool
|
79
|
+
that verifies documentation coverage of Ruby code. It will
|
80
|
+
measure the source and provide feedback on what is missing
|
81
|
+
from the documentation and what can be improved.</p>
|
82
|
+
|
83
|
+
<p>This plugin links into the post-document stage of the standard
|
84
|
+
assembly.</p>
|
85
|
+
|
86
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
87
|
+
|
88
|
+
<p>The following options can be used in the Detroit toolchain file
|
89
|
+
for defining a yardstick tool instance.</p>
|
90
|
+
|
91
|
+
<ul>
|
92
|
+
<li><p><code>output</code> - The path to the file where the measurements will be
|
93
|
+
written. Default is the typical <code>lib/**/*.rb</code>.</p></li>
|
94
|
+
<li><p><code>path</code> - Path or list of paths to measure. Defaults to the
|
95
|
+
project's log directory, e.g. <code>log/</code>, in a <code>yardstick.txt</code> file.</p></li>
|
96
|
+
<li><p><code>threshold</code> - Defaults to the maximum 100.</p></li>
|
97
|
+
<li><p><code>exact</code> - Whether the threshold must be exact.</p></li>
|
98
|
+
<li><p><code>rules</code> - Yardstick's measure rules can be customized individually.
|
99
|
+
with this option. See https://github.com/dkubb/yardstick for detials.</p></li>
|
100
|
+
</ul>
|
101
|
+
|
102
|
+
|
103
|
+
<h2 id="Examples-">Examples:</h2>
|
104
|
+
|
105
|
+
<p>The simplest entry is</p>
|
106
|
+
|
107
|
+
<pre><code>yardstick:
|
108
|
+
active: true
|
109
|
+
</code></pre>
|
110
|
+
|
111
|
+
<p>A fuller example might look something like this</p>
|
112
|
+
|
113
|
+
<pre><code> yardstick:
|
114
|
+
output: log/measurement.txt
|
115
|
+
path:
|
116
|
+
- lib/**/*.rb
|
117
|
+
</code></pre>
|
118
|
+
|
119
|
+
<h2 id="RESOURCES">RESOURCES</h2>
|
120
|
+
|
121
|
+
<p>For more information:</p>
|
122
|
+
|
123
|
+
<ul>
|
124
|
+
<li><p><a href="http://rubydoc.info/gems/detroit-yardstick">API Documentation</a></p></li>
|
125
|
+
<li><p><a href="http://github.com/detroit/detroit-yardstick">Development Site</a></p></li>
|
126
|
+
</ul>
|
127
|
+
|
128
|
+
|
129
|
+
<h2 id="COPYRIGHT">COPYRIGHT</h2>
|
130
|
+
|
131
|
+
<p>Copyright (c) 2010 Rubyworks</p>
|
132
|
+
|
133
|
+
<p>Detroit Yardstick is distributable in accordance with the GPL v3 license.</p>
|
134
|
+
|
135
|
+
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
136
|
+
|
137
|
+
<p><span class="man-ref">detroit<span class="s">(1)</span></span>, <span class="man-ref">yardstick<span class="s">(1)</span></span></p>
|
138
|
+
|
139
|
+
|
140
|
+
<ol class='man-decor man-foot man foot'>
|
141
|
+
<li class='tl'></li>
|
142
|
+
<li class='tc'>January 2014</li>
|
143
|
+
<li class='tr'>detroit-yardstick(5)</li>
|
144
|
+
</ol>
|
145
|
+
|
146
|
+
</div>
|
147
|
+
</body>
|
148
|
+
</html>
|