detroit-dnote 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc ADDED
@@ -0,0 +1,34 @@
1
+ = Detroit DNote Tool
2
+
3
+
4
+ == DESCRIPTION
5
+
6
+ The Developer's Notes tool goes through you source files
7
+ and compiles a list of any labeled comments. Labels are
8
+ single word prefixes to a comment ending in a colon.
9
+
10
+ By default label supported are TODO, FIXME, OPTIMIZE
11
+ and DEPRECATE.
12
+
13
+ A variety of output formats are supported including HTML,
14
+ XML, Markdown and RDoc's simple markup format.
15
+
16
+ See http://rubyworks.github.com/dnote for more information.
17
+
18
+
19
+ == INSTALL
20
+
21
+ Per the usual gem install process:
22
+
23
+ $ gem install detroit-dnote
24
+
25
+
26
+ == COPYRIGHT
27
+
28
+ Copyright (c) 2011 Thomas Sawyer, Rubyworks
29
+
30
+ Detroit Dnote is distributable in accordance with the *GPL v3*
31
+ open source license.
32
+
33
+ See COPYING.rdoc and GPL3.txt file for details.
34
+
@@ -0,0 +1,201 @@
1
+ require 'detroit/tool'
2
+
3
+ module Detroit
4
+
5
+ # Convenience constructor method.
6
+ def DNote(options={})
7
+ DNote.new(options)
8
+ end
9
+
10
+ # The Developmer's Notes tool goes through source files
11
+ # and compiles a list of any labeled comments. Labels are
12
+ # all-caps single word prefixes to a comment ending in a
13
+ # colon and space.
14
+ #
15
+ # Common labels are `TODO`, `FIXME` and `OPTIMIZE`.
16
+ #
17
+ class DNote < Tool
18
+
19
+ # not that this is necessary, but ...
20
+ # def self.available(project)
21
+ # begin
22
+ # require 'dnote'
23
+ # require 'dnote/format'
24
+ # true
25
+ # rescue LoadError
26
+ # false
27
+ # end
28
+ #end
29
+
30
+ #
31
+ DEFAULT_FILES = "**/*.rb"
32
+
33
+ # Default note labels to looked for in source code.
34
+ DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
35
+
36
+ # Specific labels to document.
37
+ attr_accessor :labels
38
+
39
+ # File paths to search.
40
+ attr_accessor :files
41
+
42
+ # Exclude paths.
43
+ attr_accessor :exclude
44
+
45
+ # Ignore paths based on any part of pathname.
46
+ attr_accessor :ignore
47
+
48
+ # Title to use if template can use it.
49
+ attr_accessor :title
50
+
51
+ # Number of context lines to display.
52
+ attr_accessor :lines
53
+
54
+ # Output is either a file name with a clear extension to infer type
55
+ # or a list of such file names, or a hash mapping file name to type.
56
+ #
57
+ # output: NOTES.rdoc
58
+ #
59
+ # output:
60
+ # - NOTES.rdoc
61
+ # - site/notes.html
62
+ #
63
+ # output:
64
+ # NOTES: markdown
65
+ # site/notes.html: html
66
+ #
67
+ # Recognized formats include `xml`, `html` and `rdoc` among others.
68
+ attr_accessor :output
69
+
70
+ # S E R V I C E M E T H O D S
71
+
72
+ # Check the output file and see if they are older than
73
+ # the input files.
74
+ #
75
+ # @return [Boolean] whether output is up-to-date
76
+ def current?
77
+ output_mapping.each do |file, format|
78
+ return false if outofdate?(file, *dnote_session.files)
79
+ end
80
+ "DNotes are current (#{output})"
81
+ end
82
+
83
+ # Generate notes documents.
84
+ def document
85
+ session = dnote_session
86
+
87
+ output_mapping.each do |file, format|
88
+ #next unless verify_format(format)
89
+
90
+ mkdir_p(File.dirname(file))
91
+
92
+ session.output = file
93
+ session.format = format
94
+ session.run
95
+
96
+ report "Updated #{file.sub(Dir.pwd+'/','')}"
97
+ end
98
+ end
99
+
100
+ # Reset output files, marking them as out-of-date.
101
+ def reset
102
+ output.each do |file, format|
103
+ if File.exist?(file)
104
+ utime(0,0,file)
105
+ report "Marked #{file} as out-of-date."
106
+ end
107
+ end
108
+ end
109
+
110
+ # Remove output files.
111
+ def purge
112
+ output.each do |file, format|
113
+ if File.exist?(file)
114
+ rm(file)
115
+ report "Removed #{file}"
116
+ end
117
+ end
118
+ end
119
+
120
+ # A S S E M B L Y S T A T I O N S
121
+
122
+ # Attach document method to assembly station.
123
+ def station_document
124
+ document
125
+ end
126
+
127
+ # Attach reset method to assembly station.
128
+ def station_reset
129
+ reset
130
+ end
131
+
132
+ # Attach purge method to assembly station.
133
+ def station_purge
134
+ purge
135
+ end
136
+
137
+ private
138
+
139
+ # Convert output into a hash of `file => format`.
140
+ #++
141
+ # TODO: apply_naming_policy ?
142
+ #--
143
+ def output_mapping
144
+ @output_mapping ||= (
145
+ hash = {}
146
+ case output
147
+ when Array
148
+ output.each do |path|
149
+ hash[path] = format(path)
150
+ end
151
+ when String
152
+ hash[output] = format(output)
153
+ when Hash
154
+ hash = output
155
+ end
156
+ hash
157
+ )
158
+ end
159
+
160
+ #
161
+ def format(file)
162
+ type = File.extname(file).sub('.','')
163
+ type = DEFAULT_FORMAT if type.empty?
164
+ type
165
+ end
166
+
167
+ #
168
+ def dnote_session
169
+ ::DNote::Session.new do |s|
170
+ s.paths = files
171
+ s.exclude = exclude
172
+ s.ignore = ignore
173
+ s.labels = labels
174
+ s.title = title
175
+ s.context = lines
176
+ s.dryrun = trial?
177
+ end
178
+ end
179
+
180
+ #
181
+ def initialize_requires
182
+ require 'dnote'
183
+ require 'dnote/format'
184
+ end
185
+
186
+ #
187
+ def initialize_defaults
188
+ @files = DEFAULT_FILES
189
+ @output = project.log + 'dnotes.html'
190
+ @labels = nil #DEFAULT_LABELS
191
+ end
192
+
193
+ public
194
+
195
+ def self.man_page
196
+ File.dirname(__FILE__)+'/../man/detroit-dnote.5'
197
+ end
198
+
199
+ end
200
+
201
+ end
@@ -0,0 +1,122 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "DETROIT\-DNOTE" "5" "October 2011" "" ""
5
+ .
6
+ .SH "NAME"
7
+ \fBdetroit\-dnote\fR \- extract developers notes from ruby source code
8
+ .
9
+ .SH "DESCRIPTION"
10
+ The DNote plug\-in for Detroit utilize the DNote command line tool to extract notes from source code and construct nicely formated documentation out of it\.
11
+ .
12
+ .SH "OPTIONS"
13
+ The following options can be used in the Detroit assembly file for defining a dnote service\.
14
+ .
15
+ .IP "\(bu" 4
16
+ \fBlabels\fR \- List of labels to document\. The default list includes \fBTODO\fR, \fBFIXME\fR, \fBOPTIMIZE\fR, and \fBDEPRECATE\fR\.
17
+ .
18
+ .IP "\(bu" 4
19
+ \fBfiles\fR \- File paths to search\.
20
+ .
21
+ .IP "\(bu" 4
22
+ \fBexclude\fR \- Exclude paths\.
23
+ .
24
+ .IP "\(bu" 4
25
+ \fBignore\fR \- Ignore paths based on any part of pathname\.
26
+ .
27
+ .IP "\(bu" 4
28
+ \fBtitle\fR \- Title to use if template can use it\.
29
+ .
30
+ .IP "\(bu" 4
31
+ \fBlines\fR \- Number of context lines to display\.
32
+ .
33
+ .IP "\(bu" 4
34
+ \fBoutput\fR \- Output is either a file name with a recognized extension, a list of such file names, or a hash mapping file name to file type\. Recognized extensions include \fBxml\fR, \fBhtml\fR and \fBrdoc\fR among others\.
35
+ .
36
+ .IP "" 0
37
+ .
38
+ .SH "EXAMPLES"
39
+ The simplist entry is
40
+ .
41
+ .IP "" 4
42
+ .
43
+ .nf
44
+
45
+ dnote:
46
+ output: NOTES\.rdoc
47
+ .
48
+ .fi
49
+ .
50
+ .IP "" 0
51
+ .
52
+ .P
53
+ To produce multiple formats use a list\.
54
+ .
55
+ .IP "" 4
56
+ .
57
+ .nf
58
+
59
+ dnote:
60
+ output:
61
+ \- NOTES\.rdoc
62
+ \- site/notes\.html
63
+ .
64
+ .fi
65
+ .
66
+ .IP "" 0
67
+ .
68
+ .P
69
+ If the extension is atypical use a mapping\.
70
+ .
71
+ .IP "" 4
72
+ .
73
+ .nf
74
+
75
+ dnote:
76
+ output:
77
+ NOTES: markdown
78
+ site/notes\.html: html
79
+ .
80
+ .fi
81
+ .
82
+ .IP "" 0
83
+ .
84
+ .P
85
+ A fuller example might look something like this\.
86
+ .
87
+ .IP "" 4
88
+ .
89
+ .nf
90
+
91
+ dnote:
92
+ labels: [TODO, THINK, FIX]
93
+ files: [lib, test]
94
+ exclude:
95
+ \- lib/foo/templates
96
+ ignore: [\.yml]
97
+ output: log/NOTES\.rdoc
98
+ lines: 5
99
+ .
100
+ .fi
101
+ .
102
+ .IP "" 0
103
+ .
104
+ .SH "RESOURCES"
105
+ For more information:
106
+ .
107
+ .IP "\(bu" 4
108
+ API Documentation \fIhttp://rubydoc\.info/gems/detroit\-dnote\fR
109
+ .
110
+ .IP "\(bu" 4
111
+ Development Site \fIhttp://github\.com/detroit/detroit\-dnote\fR
112
+ .
113
+ .IP "" 0
114
+ .
115
+ .SH "COPYRIGHT"
116
+ Copyright (c) 2010 Thomas Sawyer, Rubyworks
117
+ .
118
+ .P
119
+ Detroit DNote is distributable in accordance with the GPLv3 license\.
120
+ .
121
+ .SH "SEE ALSO"
122
+ dnote(1)
@@ -0,0 +1,166 @@
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-dnote(5) - extract developers notes from ruby source code</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-dnote(5)</li>
67
+ <li class='tc'></li>
68
+ <li class='tr'>detroit-dnote(5)</li>
69
+ </ol>
70
+
71
+ <h2 id="NAME">NAME</h2>
72
+ <p class="man-name">
73
+ <code>detroit-dnote</code> - <span class="man-whatis">extract developers notes from ruby source code</span>
74
+ </p>
75
+
76
+ <h2 id="DESCRIPTION">DESCRIPTION</h2>
77
+
78
+ <p>The DNote plug-in for Detroit utilize the DNote command line tool
79
+ to extract notes from source code and construct nicely formated
80
+ documentation out of it.</p>
81
+
82
+ <h2 id="OPTIONS">OPTIONS</h2>
83
+
84
+ <p>The following options can be used in the Detroit assembly file
85
+ for defining a dnote service.</p>
86
+
87
+ <ul>
88
+ <li><p><code>labels</code> - List of labels to document. The default list includes
89
+ <code>TODO</code>, <code>FIXME</code>, <code>OPTIMIZE</code>, and <code>DEPRECATE</code>.</p></li>
90
+ <li><p><code>files</code> - File paths to search.</p></li>
91
+ <li><p><code>exclude</code> - Exclude paths.</p></li>
92
+ <li><p><code>ignore</code> - Ignore paths based on any part of pathname.</p></li>
93
+ <li><p><code>title</code> - Title to use if template can use it.</p></li>
94
+ <li><p><code>lines</code> - Number of context lines to display.</p></li>
95
+ <li><p><code>output</code> - Output is either a file name with a recognized extension,
96
+ a list of such file names, or a hash mapping file name to file type.
97
+ Recognized extensions include <code>xml</code>, <code>html</code> and <code>rdoc</code> among others.</p></li>
98
+ </ul>
99
+
100
+
101
+ <h2 id="EXAMPLES">EXAMPLES</h2>
102
+
103
+ <p>The simplist entry is</p>
104
+
105
+ <pre><code>dnote:
106
+ output: NOTES.rdoc
107
+ </code></pre>
108
+
109
+ <p>To produce multiple formats use a list.</p>
110
+
111
+ <pre><code>dnote:
112
+ output:
113
+ - NOTES.rdoc
114
+ - site/notes.html
115
+ </code></pre>
116
+
117
+ <p>If the extension is atypical use a mapping.</p>
118
+
119
+ <pre><code> dnote:
120
+ output:
121
+ NOTES: markdown
122
+ site/notes.html: html
123
+ </code></pre>
124
+
125
+ <p>A fuller example might look something like this.</p>
126
+
127
+ <pre><code> dnote:
128
+ labels: [TODO, THINK, FIX]
129
+ files: [lib, test]
130
+ exclude:
131
+ - lib/foo/templates
132
+ ignore: [.yml]
133
+ output: log/NOTES.rdoc
134
+ lines: 5
135
+ </code></pre>
136
+
137
+ <h2 id="RESOURCES">RESOURCES</h2>
138
+
139
+ <p>For more information:</p>
140
+
141
+ <ul>
142
+ <li><p><a href="http://rubydoc.info/gems/detroit-dnote">API Documentation</a></p></li>
143
+ <li><p><a href="http://github.com/detroit/detroit-dnote">Development Site</a></p></li>
144
+ </ul>
145
+
146
+
147
+ <h2 id="COPYRIGHT">COPYRIGHT</h2>
148
+
149
+ <p>Copyright (c) 2010 Thomas Sawyer, Rubyworks</p>
150
+
151
+ <p>Detroit DNote is distributable in accordance with the GPLv3 license.</p>
152
+
153
+ <h2 id="SEE-ALSO">SEE ALSO</h2>
154
+
155
+ <p><span class="man-ref">dnote<span class="s">(1)</span></span></p>
156
+
157
+
158
+ <ol class='man-decor man-foot man foot'>
159
+ <li class='tl'></li>
160
+ <li class='tc'>October 2011</li>
161
+ <li class='tr'>detroit-dnote(5)</li>
162
+ </ol>
163
+
164
+ </div>
165
+ </body>
166
+ </html>
@@ -0,0 +1,85 @@
1
+ detroit-dnote(5) - extract developers notes from ruby source code
2
+ =================================================================
3
+
4
+ ## DESCRIPTION
5
+
6
+ The DNote plug-in for Detroit utilize the DNote command line tool
7
+ to extract notes from source code and construct nicely formatted
8
+ documentation out of it.
9
+
10
+
11
+ ## OPTIONS
12
+
13
+ The following options can be used in the Detroit assembly file
14
+ for defining a DNote service.
15
+
16
+ * `labels` - List of labels to document. The default list includes
17
+ `TODO`, `FIXME`, `OPTIMIZE`, and `DEPRECATE`.
18
+
19
+ * `files` - File paths to search.
20
+
21
+ * `exclude` - Exclude paths.
22
+
23
+ * `ignore` - Ignore paths based on any part of pathname.
24
+
25
+ * `title` - Title to use if template can use it.
26
+
27
+ * `lines` - Number of context lines to display.
28
+
29
+ * `output` - Output is either a file name with a recognized extension,
30
+ a list of such file names, or a hash mapping file name to file type.
31
+ Recognized extensions include `xml`, `html` and `rdoc` among others.
32
+
33
+
34
+ ## EXAMPLES
35
+
36
+ The simplest entry is
37
+
38
+ dnote:
39
+ output: NOTES.rdoc
40
+
41
+ To produce multiple formats use a list.
42
+
43
+ dnote:
44
+ output:
45
+ - NOTES.rdoc
46
+ - site/notes.html
47
+
48
+ If the extension is atypical use a mapping.
49
+
50
+ dnote:
51
+ output:
52
+ NOTES: markdown
53
+ site/notes.html: html
54
+
55
+ A fuller example might look something like this.
56
+
57
+ dnote:
58
+ labels: [TODO, THINK, FIX]
59
+ files: [lib, test]
60
+ exclude:
61
+ - lib/foo/templates
62
+ ignore: [.yml]
63
+ output: log/NOTES.rdoc
64
+ lines: 5
65
+
66
+
67
+ ## RESOURCES
68
+
69
+ For more information:
70
+
71
+ * [API Documentation](http://rubydoc.info/gems/detroit-dnote)
72
+
73
+ * [Development Site](http://github.com/detroit/detroit-dnote)
74
+
75
+
76
+ ## COPYRIGHT
77
+
78
+ Copyright (c) 2010 Thomas Sawyer, Rubyworks
79
+
80
+ Detroit DNote is distributable in accordance with the GPLv3 license.
81
+
82
+
83
+ ## SEE ALSO
84
+
85
+ detroit(1), dnote(1)
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: detroit-dnote
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - T.Sawyer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: dnote
16
+ requirement: &19118820 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *19118820
25
+ - !ruby/object:Gem::Dependency
26
+ name: detroit
27
+ requirement: &19117640 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *19117640
36
+ description: DNote plugin for Detroit build system. Extract devleoper's notes from
37
+ source in documentation phase.
38
+ email:
39
+ - transfire@gmail.com
40
+ executables: []
41
+ extensions: []
42
+ extra_rdoc_files:
43
+ - GPL3.txt
44
+ - README.rdoc
45
+ - COPYING.rdoc
46
+ files:
47
+ - .ruby
48
+ - lib/detroit-dnote.rb
49
+ - man/detroit-dnote.5
50
+ - man/detroit-dnote.5.html
51
+ - man/detroit-dnote.5.ronn
52
+ - README.rdoc
53
+ - GPL3.txt
54
+ - COPYING.rdoc
55
+ homepage: http://detroit.github.com
56
+ licenses: []
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 1.8.5
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: DNote plugin for Detroit
79
+ test_files: []