dnote 1.7.0 → 1.8.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.
- checksums.yaml +7 -0
- data/HISTORY.rdoc +39 -0
- data/README.rdoc +81 -25
- data/lib/dnote/core_ext.rb +54 -75
- data/lib/dnote/format.rb +15 -7
- data/lib/dnote/notes.rb +60 -14
- data/lib/dnote/rake/dnotetask.rb +69 -50
- data/lib/dnote/session.rb +11 -2
- data/lib/dnote/templates/html/file.erb +1 -1
- data/lib/dnote/templates/html/label.erb +1 -1
- data/lib/dnote/templates/html/list.erb +2 -2
- data/lib/dnote/templates/html.erb +1 -1
- data/lib/dnote/templates/xml/file.erb +1 -1
- data/lib/dnote/templates/xoxo/file.erb +3 -1
- data/lib/dnote/templates/xoxo/label.erb +3 -1
- data/lib/dnote/templates/xoxo.erb +3 -1
- data/lib/dnote/version.rb +2 -14
- metadata +68 -67
- data/.ruby +0 -55
- data/.yardopts +0 -5
- data/test/notes_case.rb +0 -64
- data/try/sample.bas +0 -7
- data/try/sample.js +0 -11
- data/try/sample.rb +0 -11
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f879bf8a990918d87b1f64fc3cc10fba7a227b7a23bfdfb9eb5138fc99c72daf
|
|
4
|
+
data.tar.gz: a9376ea576ed8fcc8686666dbc46782738b547eb7c21a8f592f36c69ad435db0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 00f02b797117805b33615aedcb54645a6358786d029dcad65122273cd9309351e69dfe71565ff06835661bd1f43829cd32445b4a1a533deca75b99ebfe2214a9
|
|
7
|
+
data.tar.gz: cd0c6287d0cf741455aa9c3e1a2c6ad8af4b60da4e350878cf3809e7cd492a0a95a75fd26d13cf81336a0c53af01e376f91228ffa231805921177b40b0931be7
|
data/HISTORY.rdoc
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
= RELEASE HISTORY
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
== 1.8.0 / 2026-11-30
|
|
5
|
+
|
|
6
|
+
DNote runs on current Ruby again; it needs Ruby 3.1 or newer. Notes can
|
|
7
|
+
now be written as tags, in the manner of YARD, e.g. `@TODO Fix this.`
|
|
8
|
+
A tag in capitals is always a note. The usual labels (TODO, FIXME,
|
|
9
|
+
OPTIMIZE, THINK and DEPRECATE) are notes in lower case too, so YARD's
|
|
10
|
+
own `@todo` is collected. Use `--no-tags` to turn tags off.
|
|
11
|
+
|
|
12
|
+
Changes:
|
|
13
|
+
|
|
14
|
+
* Support Ruby 3.1 and newer (ERB is called with keywords).
|
|
15
|
+
* Add tag notes, such as `@TODO`, and the `--[no-]tags` option.
|
|
16
|
+
* A tag, such as YARD's `@return`, ends the note before it.
|
|
17
|
+
* Fix the first line of code after a note being left out of its context.
|
|
18
|
+
* Fix `html/list` and `xml/file` formats, which failed with any notes.
|
|
19
|
+
* Fix `xoxo` formats, which never finished.
|
|
20
|
+
* Fix label-and-file groupings when the plain grouping was used first.
|
|
21
|
+
* Fix the Rake task, which was written for another tool's task library.
|
|
22
|
+
* Fix `--dryrun`, which wrote the file all the same.
|
|
23
|
+
* Escape code context in HTML formats.
|
|
24
|
+
* Read files that aren't valid UTF-8, rather than fail on them.
|
|
25
|
+
* The string methods the templates use are refinements, no longer
|
|
26
|
+
added to String itself.
|
|
27
|
+
* A format whose library isn't installed (soap, xoxo) says so.
|
|
28
|
+
* Recognize the comment markers of more languages.
|
|
29
|
+
* Drop the dependency on REXML.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
== 1.7.1 / 2012-01-10
|
|
33
|
+
|
|
34
|
+
The `dnote.yml` file which provides project metadata, particularly the DNote::VERSION setting,
|
|
35
|
+
was left out of the package manifest. This release fixes this issue and gets things working
|
|
36
|
+
again.
|
|
37
|
+
|
|
38
|
+
Changes:
|
|
39
|
+
|
|
40
|
+
* Add lib/dnote.yml to MANIFEST.
|
|
41
|
+
|
|
42
|
+
|
|
4
43
|
== 1.7.0 / 2011-10-25
|
|
5
44
|
|
|
6
45
|
This release finishes adding code context support to all formats. Use the `-c`
|
data/README.rdoc
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
= DNote
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{Source Code}[https://github.com/rubyworks/dnote] /
|
|
4
|
+
{Report Issue}[https://github.com/rubyworks/dnote/issues] /
|
|
5
|
+
{API}[https://rubydoc.info/gems/dnote]
|
|
6
|
+
{<img src="https://github.com/rubyworks/dnote/actions/workflows/ci.yml/badge.svg" alt="CI" />}[https://github.com/rubyworks/dnote/actions/workflows/ci.yml]
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
== DESCRIPTION
|
|
@@ -30,7 +31,7 @@ the note for a <code>pre</code> block if it is indented.
|
|
|
30
31
|
# LABEL: description ...
|
|
31
32
|
# continue ...
|
|
32
33
|
|
|
33
|
-
3) An alternative to the previous limitation is to indent the whole note, making it
|
|
34
|
+
3) An alternative to the previous limitation is to indent the whole note, making it
|
|
34
35
|
a <tt><pre></tt> block when rendered by RDoc. Then the text layout is free-form.
|
|
35
36
|
|
|
36
37
|
# This is a description of something...
|
|
@@ -38,13 +39,33 @@ a <tt><pre></tt> block when rendered by RDoc. Then the text layout is free
|
|
|
38
39
|
# LABEL: description ...
|
|
39
40
|
# continue ...
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
we may eventually be able to relax the flush rule too, which would be very nice.
|
|
42
|
+
A note ends at a blank comment line or at a line of code.
|
|
43
43
|
|
|
44
44
|
There is also a command-line option, <code>--no-colon</code>, which deactives the need for
|
|
45
45
|
a colon after the note label. However this often produces false positives, so it's use is
|
|
46
46
|
discouraged.
|
|
47
47
|
|
|
48
|
+
=== Tags
|
|
49
|
+
|
|
50
|
+
A note can also be written as a tag, in the manner of YARD. A tag needs no colon.
|
|
51
|
+
|
|
52
|
+
# @LABEL description ...
|
|
53
|
+
# continue ...
|
|
54
|
+
|
|
55
|
+
A tag in capitals is always taken as a note. The usual labels, +TODO+, +FIXME+,
|
|
56
|
+
+OPTIMIZE+, +THINK+ and +DEPRECATE+, are taken as notes in lower case too, so YARD's
|
|
57
|
+
own <tt>@todo</tt> tag is collected along with the rest. Other lower case tags, such
|
|
58
|
+
as <tt>@param</tt> and <tt>@return</tt>, are documentation and are left alone,
|
|
59
|
+
unless asked for by name, e.g. <code>--label NOTE</code> collects <tt>@note</tt>.
|
|
60
|
+
|
|
61
|
+
A tag note ends at the next tag, as well as at a blank comment line or a line of code.
|
|
62
|
+
|
|
63
|
+
YARD itself warns of a tag it doesn't know, such as <tt>@FIXME</tt>, and leaves it out
|
|
64
|
+
of the documentation. To have YARD accept such a tag, name it in +.yardopts+,
|
|
65
|
+
e.g. <code>--tag FIXME:"Fix Me"</code>, and add <code>--hide-tag FIXME</code>
|
|
66
|
+
to keep it out of the documentation.
|
|
67
|
+
|
|
68
|
+
To turn tags off use <code>--no-tags</code>.
|
|
48
69
|
|
|
49
70
|
=== Generating Notes
|
|
50
71
|
|
|
@@ -53,55 +74,90 @@ As you can see the commandline interface is pretty straight-forward.
|
|
|
53
74
|
USAGE:
|
|
54
75
|
|
|
55
76
|
dnote [OPTIONS] path1 [path2 ...]
|
|
56
|
-
|
|
77
|
+
|
|
57
78
|
OUTPUT FORMAT: (choose one)
|
|
58
79
|
-f, --format NAME select a format [text]
|
|
59
|
-
-
|
|
80
|
+
-C, --custom FILE use a custom ERB template
|
|
60
81
|
--file shortcut for text/file format
|
|
61
82
|
--list shortcut for text/list format
|
|
62
|
-
|
|
83
|
+
|
|
63
84
|
OTHER OPTIONS:
|
|
64
85
|
-l, --label LABEL labels to collect
|
|
65
86
|
--[no-]colon match labels with/without colon suffix
|
|
87
|
+
--[no-]tags match labels written as tags, e.g. @TODO [yes]
|
|
66
88
|
-m, --marker MARK alternative remark marker
|
|
67
|
-
-u
|
|
89
|
+
-u, --url TEMPLATE url template for line entries (for HTML)
|
|
90
|
+
-c, --context INTEGER number of lines of context to display
|
|
68
91
|
-x, --exclude PATH exclude file or directory
|
|
69
|
-
-i, --ignore NAME ignore based on any part of
|
|
92
|
+
-i, --ignore NAME ignore file based on any part of pathname
|
|
70
93
|
-t, --title TITLE title to use in header
|
|
71
|
-
-o, --output PATH
|
|
94
|
+
-o, --output PATH save to file or directory
|
|
72
95
|
-n, --dryrun do not actually write to disk
|
|
73
96
|
--debug debug mode
|
|
74
|
-
|
|
97
|
+
|
|
75
98
|
COMMAND OPTIONS:
|
|
76
99
|
-T, --templates list available format templates
|
|
77
100
|
-h, --help show this help information
|
|
78
101
|
|
|
79
|
-
The default path is <tt>**/*.rb</tt> and the default format is <tt>-f
|
|
80
|
-
|
|
102
|
+
The default path is <tt>**/*.rb</tt> and the default format is <tt>-f text</tt>.
|
|
103
|
+
A path that is a directory takes in everything below it. The comment marker is
|
|
104
|
+
chosen by a file's extension (<tt>#</tt> where it isn't known); use <code>--marker</code>
|
|
105
|
+
for any other.
|
|
106
|
+
|
|
107
|
+
Here is an example of DNote's notes in RDoc format, from
|
|
108
|
+
<code>dnote -f rdoc -l TODO lib/dnote/format.rb</code>:
|
|
81
109
|
|
|
82
|
-
=
|
|
110
|
+
= Developer's Notes
|
|
83
111
|
|
|
84
112
|
== TODO
|
|
85
113
|
|
|
86
|
-
=== file://lib/dnote/
|
|
114
|
+
=== file://lib/dnote/format.rb
|
|
87
115
|
|
|
88
|
-
* TODO:
|
|
89
|
-
|
|
90
|
-
* TODO: Need good CSS file. (22)
|
|
91
|
-
* TODO: Need XSL? (24)
|
|
116
|
+
* TODO: Need good CSS file. (12)
|
|
117
|
+
* TODO: Need XSL? (14)
|
|
92
118
|
|
|
93
|
-
|
|
119
|
+
(2 TODOs)
|
|
94
120
|
|
|
95
|
-
|
|
121
|
+
=== Formats
|
|
96
122
|
|
|
97
|
-
|
|
123
|
+
The formats are +text+, +md+, +rdoc+, +html+, +xml+, +json+, +yaml+, +soap+
|
|
124
|
+
and +xoxo+. Each arranges the notes by label and then file. Add <tt>/file</tt>,
|
|
125
|
+
<tt>/label</tt> or <tt>/list</tt> for another arrangement, e.g. <code>-f md/list</code>.
|
|
126
|
+
|
|
127
|
+
The +soap+ format needs the +soap4r-ng+ gem and the +xoxo+ format needs the +xoxo+ gem.
|
|
128
|
+
Neither is installed with DNote.
|
|
129
|
+
|
|
130
|
+
A custom template is an ERB file. It has +notes+ and +title+ to work with, and
|
|
131
|
+
+h+ to escape text for HTML or XML.
|
|
132
|
+
|
|
133
|
+
=== Rake Task
|
|
134
|
+
|
|
135
|
+
require 'dnote/rake/dnotetask'
|
|
136
|
+
|
|
137
|
+
DNote::RakeTask.new do |t|
|
|
138
|
+
t.files = 'lib/**/*.rb'
|
|
139
|
+
t.formats = ['html', 'md']
|
|
140
|
+
t.output = 'doc/notes'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
This defines a +dnote+ task, which writes <tt>doc/notes/notes.html</tt> and
|
|
144
|
+
<tt>doc/notes/notes.md</tt>, and a <tt>dnote:clobber</tt> task that removes them.
|
|
145
|
+
|
|
146
|
+
=== With YARD
|
|
147
|
+
|
|
148
|
+
To add the notes to YARD documentation, write them to a file and list it in
|
|
149
|
+
+.yardopts+ with the other extra files.
|
|
150
|
+
|
|
151
|
+
$ dnote -f md -o NOTES.md
|
|
98
152
|
|
|
99
153
|
|
|
100
154
|
== INSTALLATION
|
|
101
155
|
|
|
102
156
|
The usual RubyGem's command will do the trick.
|
|
103
157
|
|
|
104
|
-
$
|
|
158
|
+
$ gem install dnote
|
|
159
|
+
|
|
160
|
+
DNote needs Ruby 3.1 or newer.
|
|
105
161
|
|
|
106
162
|
|
|
107
163
|
== COPYRIGHT
|
data/lib/dnote/core_ext.rb
CHANGED
|
@@ -1,92 +1,71 @@
|
|
|
1
|
-
module Enumerable
|
|
2
|
-
|
|
3
|
-
# Taken from Ruby Facets.
|
|
4
|
-
def group_by #:yield:
|
|
5
|
-
#h = k = e = nil
|
|
6
|
-
r = Hash.new
|
|
7
|
-
each{ |e| (r[yield(e)] ||= []) << e }
|
|
8
|
-
r
|
|
9
|
-
end unless method_defined?(:group_by)
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
|
|
13
1
|
module DNote
|
|
14
2
|
|
|
15
|
-
#
|
|
16
|
-
#
|
|
3
|
+
# String methods used by the templates. They are refinements, so they
|
|
4
|
+
# are not added to String for the rest of the program. A custom template
|
|
5
|
+
# has them, since it is rendered where they are in effect.
|
|
17
6
|
#
|
|
18
|
-
|
|
7
|
+
# These methods are taken from Ruby Facets.
|
|
8
|
+
module StringMethods
|
|
19
9
|
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
# x = %Q{
|
|
23
|
-
# | This
|
|
24
|
-
# | is
|
|
25
|
-
# | margin controlled!
|
|
26
|
-
# }.margin
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
# NOTE: This may still need a bit of tweaking.
|
|
30
|
-
#
|
|
31
|
-
# CREDIT: Trans
|
|
10
|
+
refine ::String do
|
|
32
11
|
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
12
|
+
# Provides a margin controlled string.
|
|
13
|
+
#
|
|
14
|
+
# x = %Q{
|
|
15
|
+
# | This
|
|
16
|
+
# | is
|
|
17
|
+
# | margin controlled!
|
|
18
|
+
# }.margin
|
|
19
|
+
#
|
|
20
|
+
# CREDIT: Trans
|
|
21
|
+
def margin(n=0)
|
|
22
|
+
d = ((/\A.*\n\s*(.)/.match(self)) ||
|
|
23
|
+
(/\A\s*(.)/.match(self)))[1]
|
|
24
|
+
return '' unless d
|
|
25
|
+
if n == 0
|
|
26
|
+
gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, '')
|
|
27
|
+
else
|
|
28
|
+
gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, ' ' * n)
|
|
29
|
+
end
|
|
43
30
|
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Preserves relative tabbing.
|
|
47
|
-
# The first non-empty line ends up with n spaces before nonspace.
|
|
48
|
-
#
|
|
49
|
-
# CREDIT: Gavin Sinclair
|
|
50
31
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
# Preserves relative tabbing.
|
|
33
|
+
# The first non-empty line ends up with n spaces before nonspace.
|
|
34
|
+
#
|
|
35
|
+
# CREDIT: Gavin Sinclair
|
|
36
|
+
def tabto(n)
|
|
37
|
+
if self =~ /^( *)\S/
|
|
38
|
+
indent(n - $1.length)
|
|
39
|
+
else
|
|
40
|
+
self
|
|
41
|
+
end
|
|
56
42
|
end
|
|
57
|
-
end
|
|
58
43
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
gsub(/^ {0,#{-n}}/, "")
|
|
44
|
+
# Indent left or right by n spaces.
|
|
45
|
+
#
|
|
46
|
+
# CREDIT: Gavin Sinclair
|
|
47
|
+
# CREDIT: Trans
|
|
48
|
+
def indent(n)
|
|
49
|
+
if n >= 0
|
|
50
|
+
gsub(/^/, ' ' * n)
|
|
51
|
+
else
|
|
52
|
+
gsub(/^ {0,#{-n}}/, "")
|
|
53
|
+
end
|
|
70
54
|
end
|
|
71
|
-
end
|
|
72
55
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
# Indent so that the least indented line starts at column n.
|
|
57
|
+
def tabset(n)
|
|
58
|
+
i = lines.map do |line|
|
|
59
|
+
line.strip.empty? ? nil : line.index(/\S/)
|
|
60
|
+
end
|
|
61
|
+
x = i.compact.min
|
|
62
|
+
t = n - x.to_i
|
|
63
|
+
t = 0 if t < 0
|
|
64
|
+
indent(t)
|
|
78
65
|
end
|
|
79
|
-
x = i.compact.min
|
|
80
|
-
t = n - x.to_i
|
|
81
|
-
t = 0 if t < 0
|
|
82
|
-
indent(t)
|
|
83
|
-
end
|
|
84
66
|
|
|
85
|
-
|
|
67
|
+
end
|
|
86
68
|
|
|
87
|
-
class ::String #:nodoc:
|
|
88
|
-
include DNote::String
|
|
89
69
|
end
|
|
90
70
|
|
|
91
71
|
end
|
|
92
|
-
|
data/lib/dnote/format.rb
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
require 'dnote/core_ext'
|
|
2
|
+
|
|
1
3
|
module DNote
|
|
2
4
|
|
|
5
|
+
# The string methods the templates use (+indent+, +tabset+ and so on)
|
|
6
|
+
# are refinements, in effect here and so in any template rendered.
|
|
7
|
+
using DNote::StringMethods
|
|
8
|
+
|
|
3
9
|
# = Notes Formatter
|
|
4
10
|
#
|
|
5
11
|
#--
|
|
@@ -11,8 +17,6 @@ module DNote
|
|
|
11
17
|
|
|
12
18
|
require 'fileutils'
|
|
13
19
|
require 'erb'
|
|
14
|
-
require 'rexml/text'
|
|
15
|
-
require 'dnote/core_ext'
|
|
16
20
|
|
|
17
21
|
#DEFAULT_OUTPUT_DIR = "log/dnote"
|
|
18
22
|
|
|
@@ -79,8 +83,12 @@ module DNote
|
|
|
79
83
|
def render_template
|
|
80
84
|
template = File.join(File.dirname(__FILE__), 'templates', "#{format}.erb")
|
|
81
85
|
raise "No such format - #{format}" unless File.exist?(template)
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
begin
|
|
87
|
+
result = erb(template)
|
|
88
|
+
rescue LoadError => err
|
|
89
|
+
raise "The #{format} format needs a library that is not installed (#{err.message})."
|
|
90
|
+
end
|
|
91
|
+
publish(result)
|
|
84
92
|
end
|
|
85
93
|
|
|
86
94
|
private
|
|
@@ -115,7 +123,7 @@ module DNote
|
|
|
115
123
|
puts "write: #{file}"
|
|
116
124
|
else
|
|
117
125
|
dir = File.dirname(file)
|
|
118
|
-
fu.
|
|
126
|
+
fu.mkdir_p(dir) unless File.exist?(dir)
|
|
119
127
|
File.open(file, 'w'){ |f| f << result }
|
|
120
128
|
end
|
|
121
129
|
return file
|
|
@@ -154,12 +162,12 @@ module DNote
|
|
|
154
162
|
end
|
|
155
163
|
#
|
|
156
164
|
def render(file)
|
|
157
|
-
erb = ERB.new(File.read(file),
|
|
165
|
+
erb = ERB.new(File.read(file), trim_mode: '<>')
|
|
158
166
|
erb.result(binding)
|
|
159
167
|
end
|
|
160
168
|
#
|
|
161
169
|
def h(string)
|
|
162
|
-
|
|
170
|
+
ERB::Util.html_escape(string)
|
|
163
171
|
end
|
|
164
172
|
#
|
|
165
173
|
def method_missing(s, *a)
|
data/lib/dnote/notes.rb
CHANGED
|
@@ -7,10 +7,14 @@ module DNote
|
|
|
7
7
|
#
|
|
8
8
|
# This class goes through you source files and compiles a list
|
|
9
9
|
# of any labeled comments. Labels are all-cap single word prefixes
|
|
10
|
-
# to a comment ending in a colon
|
|
10
|
+
# to a comment ending in a colon, as in <tt>TODO: Do something</tt>.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
12
|
+
# A label can also be written as a tag, in the manner of YARD, in which
|
|
13
|
+
# case the colon isn't needed, as in <tt>@TODO Do something</tt>.
|
|
14
|
+
#
|
|
15
|
+
# The usual labels, +TODO+, +FIXME+, +OPTIMIZE+, +THINK+ and +DEPRECATE+,
|
|
16
|
+
# are recognized as tags in lower case too, so YARD's own <tt>@todo</tt>
|
|
17
|
+
# tag is collected.
|
|
14
18
|
#
|
|
15
19
|
#--
|
|
16
20
|
# TODO: Add ability to read header notes. They often
|
|
@@ -22,7 +26,8 @@ module DNote
|
|
|
22
26
|
# Default paths (all ruby scripts).
|
|
23
27
|
DEFAULT_PATHS = ["**/*.rb"]
|
|
24
28
|
|
|
25
|
-
#
|
|
29
|
+
# The usual note labels. When no labels are asked for, all labels are
|
|
30
|
+
# collected, and these are also recognized as lower-case tags.
|
|
26
31
|
DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'THINK', 'DEPRECATE']
|
|
27
32
|
|
|
28
33
|
# Files to search for notes.
|
|
@@ -37,6 +42,9 @@ module DNote
|
|
|
37
42
|
# Specific remark marker (+nil+ for auto).
|
|
38
43
|
attr_accessor :marker
|
|
39
44
|
|
|
45
|
+
# Recognize tag notes, such as <tt>@TODO</tt>? Default is +true+.
|
|
46
|
+
attr_accessor :tags
|
|
47
|
+
|
|
40
48
|
# Link template.
|
|
41
49
|
attr_accessor :url
|
|
42
50
|
|
|
@@ -49,6 +57,7 @@ module DNote
|
|
|
49
57
|
@labels = [options[:labels] || DEFAULT_LABELS].flatten.compact
|
|
50
58
|
@colon = options[:colon].nil? ? true : options[:colon]
|
|
51
59
|
@marker = options[:marker] #|| '#'
|
|
60
|
+
@tags = options[:tags].nil? ? true : options[:tags]
|
|
52
61
|
@url = options[:url]
|
|
53
62
|
@context = options[:context] || 0
|
|
54
63
|
|
|
@@ -95,6 +104,7 @@ module DNote
|
|
|
95
104
|
mark = remark(fname)
|
|
96
105
|
lineno, note, text, capt = 0, nil, nil, nil
|
|
97
106
|
File.readlines(fname).each do |line|
|
|
107
|
+
line = line.scrub unless line.valid_encoding?
|
|
98
108
|
#while line = f.gets
|
|
99
109
|
lineno += 1
|
|
100
110
|
note = match(line, lineno, fname)
|
|
@@ -110,15 +120,21 @@ module DNote
|
|
|
110
120
|
when /^\s*#{mark}+\s*$/, /^\s*#{mark}\-\-/, /^\s*#{mark}\+\+/
|
|
111
121
|
text.strip!
|
|
112
122
|
text = nil
|
|
123
|
+
when /^\s*#{mark}\s*@\w/
|
|
124
|
+
# another tag, such as YARD's `@return`, ends the note
|
|
125
|
+
text.strip!
|
|
126
|
+
text = nil
|
|
113
127
|
when /^\s*#{mark}/
|
|
114
|
-
if text[-1,1] == "\n"
|
|
128
|
+
if text.empty? || text[-1,1] == "\n"
|
|
115
129
|
text << line.gsub(/^\s*#{mark}\s*/,'')
|
|
116
130
|
else
|
|
117
131
|
text << "\n" << line.gsub(/^\s*#{mark}\s*/,'')
|
|
118
132
|
end
|
|
119
133
|
else
|
|
134
|
+
# a line of code ends the note, and is its first line of context
|
|
120
135
|
text.strip!
|
|
121
136
|
text = nil
|
|
137
|
+
capt << line if capt && capt.size < context
|
|
122
138
|
end
|
|
123
139
|
else
|
|
124
140
|
if line !~ /^\s*#{mark}/
|
|
@@ -135,11 +151,43 @@ module DNote
|
|
|
135
151
|
|
|
136
152
|
# Is this line a note?
|
|
137
153
|
def match(line, lineno, file)
|
|
154
|
+
note = (
|
|
155
|
+
if labels.empty?
|
|
156
|
+
match_general(line, lineno, file)
|
|
157
|
+
else
|
|
158
|
+
match_special(line, lineno, file)
|
|
159
|
+
end
|
|
160
|
+
)
|
|
161
|
+
note || (tags ? match_tag(line, lineno, file) : nil)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Match notes written as tags, such as <tt>@TODO</tt>. A tag has no
|
|
165
|
+
# need of a colon, though it may have one.
|
|
166
|
+
#
|
|
167
|
+
# A tag in capitals is always a note. In lower case it is a note only
|
|
168
|
+
# if it is one of the labels asked for, or one of the usual labels
|
|
169
|
+
# when none were asked for. So YARD's <tt>@todo</tt> is collected, and
|
|
170
|
+
# its <tt>@param</tt> and <tt>@return</tt> are not.
|
|
171
|
+
def match_tag(line, lineno, file)
|
|
172
|
+
md = match_tag_regex(file).match(line)
|
|
173
|
+
return nil unless md
|
|
174
|
+
|
|
175
|
+
name, text = md[1], md[2].to_s
|
|
176
|
+
label = name.upcase
|
|
177
|
+
|
|
138
178
|
if labels.empty?
|
|
139
|
-
|
|
179
|
+
return nil unless name == label || DEFAULT_LABELS.include?(label)
|
|
140
180
|
else
|
|
141
|
-
|
|
181
|
+
return nil unless labels.include?(label)
|
|
142
182
|
end
|
|
183
|
+
|
|
184
|
+
Note.new(self, file, label, lineno, text, remark(file))
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
#
|
|
188
|
+
def match_tag_regex(file)
|
|
189
|
+
mark = remark(file)
|
|
190
|
+
/#{mark}\s*@([A-Za-z]+)[:]?(?:\s+(.*?))?$/
|
|
143
191
|
end
|
|
144
192
|
|
|
145
193
|
# Match special notes.
|
|
@@ -155,9 +203,7 @@ module DNote
|
|
|
155
203
|
rec
|
|
156
204
|
end
|
|
157
205
|
|
|
158
|
-
|
|
159
|
-
# TODO: ruby-1.9.1-p378 reports: `match': invalid byte sequence in UTF-8
|
|
160
|
-
#++
|
|
206
|
+
#
|
|
161
207
|
def match_special_regex(label, file)
|
|
162
208
|
mark = remark(file)
|
|
163
209
|
if colon
|
|
@@ -218,7 +264,7 @@ module DNote
|
|
|
218
264
|
# Organize notes into a hash with labels for keys, followed
|
|
219
265
|
# by a hash with filename for keys.
|
|
220
266
|
def by_label_file
|
|
221
|
-
@
|
|
267
|
+
@by_label_file ||= (
|
|
222
268
|
list = {}
|
|
223
269
|
notes.each do |note|
|
|
224
270
|
list[note.label] ||= {}
|
|
@@ -233,7 +279,7 @@ module DNote
|
|
|
233
279
|
# Organize notes into a hash with filenames for keys, followed
|
|
234
280
|
# by a hash with labels for keys.
|
|
235
281
|
def by_file_label
|
|
236
|
-
@
|
|
282
|
+
@by_file_label ||= (
|
|
237
283
|
list = {}
|
|
238
284
|
notes.each do |note|
|
|
239
285
|
list[note.file] ||= {}
|
|
@@ -270,11 +316,11 @@ module DNote
|
|
|
270
316
|
def guess_marker(file)
|
|
271
317
|
return @marker if @marker # forced marker
|
|
272
318
|
case File.extname(file)
|
|
273
|
-
when '.js', '.c', 'cpp', '.css'
|
|
319
|
+
when '.js', '.c', '.cpp', '.h', '.css', '.java', '.go', '.rs', '.ts'
|
|
274
320
|
'//'
|
|
275
321
|
when '.bas'
|
|
276
322
|
"'"
|
|
277
|
-
when '.sql', '.ada'
|
|
323
|
+
when '.sql', '.ada', '.lua', '.hs'
|
|
278
324
|
'--'
|
|
279
325
|
when '.asm'
|
|
280
326
|
';'
|
data/lib/dnote/rake/dnotetask.rb
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require 'rake/clean'
|
|
4
|
+
|
|
1
5
|
module DNote
|
|
2
6
|
|
|
3
|
-
# =
|
|
7
|
+
# = Developer's Notes Rake Task
|
|
8
|
+
#
|
|
9
|
+
# require 'dnote/rake/dnotetask'
|
|
10
|
+
#
|
|
11
|
+
# DNote::RakeTask.new do |t|
|
|
12
|
+
# t.files = 'lib/**/*.rb'
|
|
13
|
+
# t.formats = ['html', 'md']
|
|
14
|
+
# t.output = 'doc/notes'
|
|
15
|
+
# end
|
|
4
16
|
#
|
|
17
|
+
# This defines a +dnote+ task that writes the notes, and a
|
|
18
|
+
# +dnote:clobber+ task that removes them, which +clobber+ also runs.
|
|
5
19
|
class RakeTask < Rake::TaskLib
|
|
6
20
|
|
|
7
|
-
require 'rake/clean'
|
|
8
|
-
|
|
9
21
|
# Default note labels to looked for in source code.
|
|
10
22
|
DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
|
|
11
23
|
|
|
24
|
+
# Name of the task. Defaults to +dnote+.
|
|
25
|
+
attr_accessor :name
|
|
26
|
+
|
|
12
27
|
# File paths to search.
|
|
13
28
|
attr_accessor :files
|
|
14
29
|
|
|
15
|
-
# Labels to document.
|
|
30
|
+
# Labels to document. By default all labels are collected.
|
|
16
31
|
attr_accessor :labels
|
|
17
32
|
|
|
18
|
-
# Formats (xml, html, rdoc, rdoc/list and so on).
|
|
33
|
+
# Formats (xml, html, rdoc, rdoc/list and so on). The default is
|
|
34
|
+
# +index+, which is the +html+ format saved as <tt>index.html</tt>.
|
|
19
35
|
attr_accessor :formats
|
|
20
36
|
|
|
21
37
|
# Exclude paths.
|
|
@@ -24,11 +40,11 @@ module DNote
|
|
|
24
40
|
# Ignore paths based on any part of pathname.
|
|
25
41
|
attr_accessor :ignore
|
|
26
42
|
|
|
27
|
-
# Output directory to save notes file. Defaults to <tt>dnote/</tt
|
|
28
|
-
#
|
|
29
|
-
|
|
43
|
+
# Output directory to save notes file. Defaults to <tt>log/dnote/</tt>.
|
|
44
|
+
# It is made if it does not exist.
|
|
45
|
+
attr_reader :output
|
|
30
46
|
|
|
31
|
-
# Title to use if
|
|
47
|
+
# Title to use if template can use it.
|
|
32
48
|
attr_accessor :title
|
|
33
49
|
|
|
34
50
|
#
|
|
@@ -36,79 +52,82 @@ module DNote
|
|
|
36
52
|
@output = Pathname.new(path)
|
|
37
53
|
end
|
|
38
54
|
|
|
55
|
+
# Define the tasks. The task object is yielded for settings.
|
|
56
|
+
def initialize(name='dnote')
|
|
57
|
+
@name = name.to_s
|
|
58
|
+
init
|
|
59
|
+
yield(self) if block_given?
|
|
60
|
+
define
|
|
61
|
+
end
|
|
62
|
+
|
|
39
63
|
#
|
|
40
64
|
def init
|
|
65
|
+
require 'pathname'
|
|
41
66
|
require 'dnote'
|
|
42
67
|
require 'dnote/format'
|
|
43
68
|
@files = "**/*.rb"
|
|
44
|
-
@output = 'log/dnote'
|
|
69
|
+
@output = Pathname.new('log/dnote')
|
|
45
70
|
@formats = ['index']
|
|
46
|
-
@labels = nil
|
|
71
|
+
@labels = nil
|
|
47
72
|
end
|
|
48
73
|
|
|
49
74
|
#
|
|
50
75
|
def define
|
|
51
76
|
desc "Collect Developer's Notes"
|
|
52
|
-
task
|
|
77
|
+
task name do
|
|
53
78
|
document
|
|
54
79
|
end
|
|
55
|
-
task
|
|
80
|
+
task "#{name}:clobber" do
|
|
56
81
|
clean
|
|
57
82
|
end
|
|
58
|
-
task :clobber => [
|
|
83
|
+
task :clobber => ["#{name}:clobber"]
|
|
59
84
|
end
|
|
60
85
|
|
|
61
86
|
# Generate notes document(s).
|
|
62
87
|
def document
|
|
63
|
-
abort "dnote: #{output} is not a directory"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
s.paths = files
|
|
67
|
-
s.exclude = exclude
|
|
68
|
-
s.ignore = ignore
|
|
69
|
-
s.labels = labels #|| DEFAULT_LABELS
|
|
70
|
-
s.title = title
|
|
71
|
-
s.output = output
|
|
72
|
-
s.dryrun = application.options.dryrun #trial?
|
|
73
|
-
end
|
|
88
|
+
abort "dnote: #{output} is not a directory" if output.exist? && !output.directory?
|
|
89
|
+
|
|
90
|
+
dryrun = Rake.application.options.dryrun
|
|
74
91
|
|
|
75
92
|
formats.each do |format|
|
|
93
|
+
session = ::DNote::Session.new do |s|
|
|
94
|
+
s.paths = [files].flatten.compact
|
|
95
|
+
s.exclude = exclude
|
|
96
|
+
s.ignore = ignore
|
|
97
|
+
s.labels = [labels].flatten.compact
|
|
98
|
+
s.title = title if title
|
|
99
|
+
s.dryrun = dryrun
|
|
100
|
+
end
|
|
101
|
+
|
|
76
102
|
if format == 'index'
|
|
77
103
|
session.format = 'html'
|
|
78
|
-
session.output =
|
|
104
|
+
session.output = (output + 'index.html').to_s
|
|
79
105
|
else
|
|
80
106
|
session.format = format
|
|
107
|
+
session.output = output.to_s + '/'
|
|
81
108
|
end
|
|
109
|
+
|
|
110
|
+
output.mkpath unless dryrun
|
|
82
111
|
session.run
|
|
83
|
-
report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
|
|
84
112
|
end
|
|
85
113
|
end
|
|
86
114
|
|
|
87
|
-
# Reset output directory, marking it as out-of-date.
|
|
88
|
-
def reset
|
|
89
|
-
#if File.directory?(output)
|
|
90
|
-
File.utime(0,0,output) unless $NOOP
|
|
91
|
-
puts "Marked #{output} as out-of-date"
|
|
92
|
-
#end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
115
|
# Remove output files.
|
|
96
116
|
def clean
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#end
|
|
117
|
+
formats.each do |format|
|
|
118
|
+
rm_f output_file(format).to_s
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# The file a format is written to.
|
|
123
|
+
def output_file(format)
|
|
124
|
+
if format == 'index'
|
|
125
|
+
output + "index.html"
|
|
126
|
+
else
|
|
127
|
+
type = format.split('/').first
|
|
128
|
+
ext = ::DNote::Format::EXTENSIONS[type] || type
|
|
129
|
+
output + "notes.#{ext}"
|
|
130
|
+
end
|
|
112
131
|
end
|
|
113
132
|
|
|
114
133
|
end
|
data/lib/dnote/session.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module DNote
|
|
2
2
|
|
|
3
|
-
require 'dnote/core_ext'
|
|
4
3
|
require 'dnote/notes'
|
|
5
4
|
require 'dnote/format'
|
|
6
5
|
|
|
@@ -41,6 +40,10 @@ module DNote
|
|
|
41
40
|
# Alternate remark marker. Useful to other languages besides Ruby.
|
|
42
41
|
attr_accessor :marker
|
|
43
42
|
|
|
43
|
+
# Collect notes written as tags, such as <tt>@TODO</tt>. The default
|
|
44
|
+
# is true.
|
|
45
|
+
attr_accessor :tags
|
|
46
|
+
|
|
44
47
|
# Output format.
|
|
45
48
|
attr_accessor :format
|
|
46
49
|
|
|
@@ -87,6 +90,7 @@ module DNote
|
|
|
87
90
|
@title = DEFAULT_TITLE
|
|
88
91
|
@dryrun = false
|
|
89
92
|
@marker = nil
|
|
93
|
+
@tags = true
|
|
90
94
|
@url = nil
|
|
91
95
|
@context = 0
|
|
92
96
|
end
|
|
@@ -105,12 +109,13 @@ module DNote
|
|
|
105
109
|
|
|
106
110
|
# Run session.
|
|
107
111
|
def run
|
|
108
|
-
notes = Notes.new(files, :labels=>labels, :colon=>colon, :marker=>marker, :url=>url, :context=>context)
|
|
112
|
+
notes = Notes.new(files, :labels=>labels, :colon=>colon, :marker=>marker, :tags=>tags, :url=>url, :context=>context)
|
|
109
113
|
formatter = Format.new(notes) do |f|
|
|
110
114
|
f.format = format
|
|
111
115
|
f.template = template
|
|
112
116
|
f.title = title
|
|
113
117
|
f.output = output
|
|
118
|
+
f.dryrun = dryrun
|
|
114
119
|
end
|
|
115
120
|
formatter.render
|
|
116
121
|
end
|
|
@@ -195,6 +200,10 @@ module DNote
|
|
|
195
200
|
session.colon = val
|
|
196
201
|
end
|
|
197
202
|
|
|
203
|
+
opt.on("--[no-]tags", "match labels written as tags, e.g. @TODO [yes]") do |val|
|
|
204
|
+
session.tags = val
|
|
205
|
+
end
|
|
206
|
+
|
|
198
207
|
opt.on("--marker", "-m MARK", "alternative remark marker") do |mark|
|
|
199
208
|
session.marker = mark
|
|
200
209
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<notes>
|
|
3
3
|
<% notes.by_file_label.each do |file, per_label| %>
|
|
4
4
|
<file src="<%= file %>">
|
|
5
|
-
<% per_label.each do |label,
|
|
5
|
+
<% per_label.each do |label, line_notes| %>
|
|
6
6
|
<label name="<%= label %>">
|
|
7
7
|
<% line_notes.sort!{ |a,b| a.line <=> b.line } %>
|
|
8
8
|
<% line_notes.each do |note| %>
|
data/lib/dnote/version.rb
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
module DNote
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def self.metadata
|
|
5
|
-
@metadata ||= (
|
|
6
|
-
require 'yaml'
|
|
7
|
-
YAML.load_file(File.dirname(__FILE__) + '/../dnote.yml')
|
|
8
|
-
)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
def self.const_missing(name)
|
|
13
|
-
metadata[name.to_s.downcase] || super(name)
|
|
14
|
-
end
|
|
15
|
-
|
|
2
|
+
# The version of DNote.
|
|
3
|
+
VERSION = '1.8.0'
|
|
16
4
|
end
|
metadata
CHANGED
|
@@ -1,149 +1,150 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dnote
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.8.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
|
-
-
|
|
9
|
-
autorequire:
|
|
7
|
+
- Trans
|
|
10
8
|
bindir: bin
|
|
11
9
|
cert_chain: []
|
|
12
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
11
|
dependencies:
|
|
14
12
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
16
|
-
requirement:
|
|
17
|
-
none: false
|
|
13
|
+
name: rake
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
15
|
requirements:
|
|
19
|
-
- -
|
|
16
|
+
- - ">="
|
|
20
17
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
18
|
+
version: '13'
|
|
22
19
|
type: :development
|
|
23
20
|
prerelease: false
|
|
24
|
-
version_requirements:
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '13'
|
|
25
26
|
- !ruby/object:Gem::Dependency
|
|
26
|
-
name:
|
|
27
|
-
requirement:
|
|
28
|
-
none: false
|
|
27
|
+
name: rubytest
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- -
|
|
30
|
+
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 0.11.1
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements:
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 0.11.1
|
|
36
40
|
- !ruby/object:Gem::Dependency
|
|
37
|
-
name:
|
|
38
|
-
requirement:
|
|
39
|
-
none: false
|
|
41
|
+
name: lemon
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
40
43
|
requirements:
|
|
41
|
-
- -
|
|
44
|
+
- - ">="
|
|
42
45
|
- !ruby/object:Gem::Version
|
|
43
|
-
version:
|
|
46
|
+
version: 0.9.4
|
|
44
47
|
type: :development
|
|
45
48
|
prerelease: false
|
|
46
|
-
version_requirements:
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 0.9.4
|
|
47
54
|
- !ruby/object:Gem::Dependency
|
|
48
|
-
name:
|
|
49
|
-
requirement:
|
|
50
|
-
none: false
|
|
55
|
+
name: ae
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
51
57
|
requirements:
|
|
52
|
-
- -
|
|
58
|
+
- - ">="
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
60
|
+
version: '1.9'
|
|
55
61
|
type: :development
|
|
56
62
|
prerelease: false
|
|
57
|
-
version_requirements:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '1.9'
|
|
68
|
+
description: DNote makes it easy to extract developer's notes from source code, and
|
|
69
|
+
supports almost any language.
|
|
61
70
|
email:
|
|
62
71
|
- transfire@gmail.com
|
|
63
72
|
executables:
|
|
64
73
|
- dnote
|
|
65
74
|
extensions: []
|
|
66
|
-
extra_rdoc_files:
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- COPYING.rdoc
|
|
67
78
|
- HISTORY.rdoc
|
|
68
79
|
- README.rdoc
|
|
69
|
-
- COPYING.rdoc
|
|
70
|
-
files:
|
|
71
|
-
- .ruby
|
|
72
|
-
- .yardopts
|
|
73
80
|
- bin/dnote
|
|
81
|
+
- lib/dnote.rb
|
|
74
82
|
- lib/dnote/core_ext.rb
|
|
75
83
|
- lib/dnote/format.rb
|
|
76
84
|
- lib/dnote/note.rb
|
|
77
85
|
- lib/dnote/notes.rb
|
|
78
86
|
- lib/dnote/rake/dnotetask.rb
|
|
79
87
|
- lib/dnote/session.rb
|
|
88
|
+
- lib/dnote/templates/html.erb
|
|
80
89
|
- lib/dnote/templates/html/file.erb
|
|
81
90
|
- lib/dnote/templates/html/label.erb
|
|
82
91
|
- lib/dnote/templates/html/list.erb
|
|
83
|
-
- lib/dnote/templates/
|
|
92
|
+
- lib/dnote/templates/json.erb
|
|
84
93
|
- lib/dnote/templates/json/file.erb
|
|
85
94
|
- lib/dnote/templates/json/label.erb
|
|
86
95
|
- lib/dnote/templates/json/list.erb
|
|
87
|
-
- lib/dnote/templates/
|
|
96
|
+
- lib/dnote/templates/md.erb
|
|
88
97
|
- lib/dnote/templates/md/file.erb
|
|
89
98
|
- lib/dnote/templates/md/label.erb
|
|
90
99
|
- lib/dnote/templates/md/list.erb
|
|
91
|
-
- lib/dnote/templates/
|
|
100
|
+
- lib/dnote/templates/rdoc.erb
|
|
92
101
|
- lib/dnote/templates/rdoc/file.erb
|
|
93
102
|
- lib/dnote/templates/rdoc/label.erb
|
|
94
103
|
- lib/dnote/templates/rdoc/list.erb
|
|
95
|
-
- lib/dnote/templates/
|
|
104
|
+
- lib/dnote/templates/soap.erb
|
|
96
105
|
- lib/dnote/templates/soap/file.erb
|
|
97
106
|
- lib/dnote/templates/soap/label.erb
|
|
98
107
|
- lib/dnote/templates/soap/list.erb
|
|
99
|
-
- lib/dnote/templates/
|
|
108
|
+
- lib/dnote/templates/text.erb
|
|
100
109
|
- lib/dnote/templates/text/file.erb
|
|
101
110
|
- lib/dnote/templates/text/label.erb
|
|
102
111
|
- lib/dnote/templates/text/list.erb
|
|
103
|
-
- lib/dnote/templates/
|
|
112
|
+
- lib/dnote/templates/xml.erb
|
|
104
113
|
- lib/dnote/templates/xml/file.erb
|
|
105
114
|
- lib/dnote/templates/xml/label.erb
|
|
106
115
|
- lib/dnote/templates/xml/list.erb
|
|
107
|
-
- lib/dnote/templates/
|
|
116
|
+
- lib/dnote/templates/xoxo.erb
|
|
108
117
|
- lib/dnote/templates/xoxo/file.erb
|
|
109
118
|
- lib/dnote/templates/xoxo/label.erb
|
|
110
119
|
- lib/dnote/templates/xoxo/list.erb
|
|
111
|
-
- lib/dnote/templates/
|
|
120
|
+
- lib/dnote/templates/yaml.erb
|
|
112
121
|
- lib/dnote/templates/yaml/file.erb
|
|
113
122
|
- lib/dnote/templates/yaml/label.erb
|
|
114
123
|
- lib/dnote/templates/yaml/list.erb
|
|
115
|
-
- lib/dnote/templates/yaml.erb
|
|
116
124
|
- lib/dnote/version.rb
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
homepage: http://rubyworks.github.com/dnote
|
|
126
|
-
licenses: []
|
|
127
|
-
post_install_message:
|
|
125
|
+
homepage: https://github.com/rubyworks/dnote
|
|
126
|
+
licenses:
|
|
127
|
+
- BSD-2-Clause
|
|
128
|
+
metadata:
|
|
129
|
+
source_code_uri: https://github.com/rubyworks/dnote
|
|
130
|
+
bug_tracker_uri: https://github.com/rubyworks/dnote/issues
|
|
131
|
+
changelog_uri: https://github.com/rubyworks/dnote/blob/master/HISTORY.rdoc
|
|
132
|
+
documentation_uri: https://rubydoc.info/gems/dnote
|
|
128
133
|
rdoc_options: []
|
|
129
134
|
require_paths:
|
|
130
135
|
- lib
|
|
131
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
|
-
none: false
|
|
133
137
|
requirements:
|
|
134
|
-
- -
|
|
138
|
+
- - ">="
|
|
135
139
|
- !ruby/object:Gem::Version
|
|
136
|
-
version: '
|
|
140
|
+
version: '3.1'
|
|
137
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
|
-
none: false
|
|
139
142
|
requirements:
|
|
140
|
-
- -
|
|
143
|
+
- - ">="
|
|
141
144
|
- !ruby/object:Gem::Version
|
|
142
145
|
version: '0'
|
|
143
146
|
requirements: []
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
specification_version: 3
|
|
148
|
-
summary: Extract developer's notes from source code.
|
|
147
|
+
rubygems_version: 3.6.9
|
|
148
|
+
specification_version: 4
|
|
149
|
+
summary: Extract developer's notes from source code
|
|
149
150
|
test_files: []
|
data/.ruby
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
source:
|
|
3
|
-
- meta
|
|
4
|
-
authors:
|
|
5
|
-
- name: Thomas Sawyer
|
|
6
|
-
email: transfire@gmail.com
|
|
7
|
-
copyrights:
|
|
8
|
-
- holder: Thomas Sawyer, Rubyworks
|
|
9
|
-
year: '2009'
|
|
10
|
-
replacements: []
|
|
11
|
-
alternatives: []
|
|
12
|
-
requirements:
|
|
13
|
-
- name: lemon
|
|
14
|
-
groups:
|
|
15
|
-
- test
|
|
16
|
-
development: true
|
|
17
|
-
- name: ae
|
|
18
|
-
groups:
|
|
19
|
-
- test
|
|
20
|
-
development: true
|
|
21
|
-
- name: detroit
|
|
22
|
-
groups:
|
|
23
|
-
- build
|
|
24
|
-
development: true
|
|
25
|
-
- name: reap
|
|
26
|
-
groups:
|
|
27
|
-
- build
|
|
28
|
-
development: true
|
|
29
|
-
dependencies: []
|
|
30
|
-
conflicts: []
|
|
31
|
-
repositories:
|
|
32
|
-
- uri: git://github.com/rubyworks/dnote.git
|
|
33
|
-
scm: git
|
|
34
|
-
name: upstream
|
|
35
|
-
resources:
|
|
36
|
-
home: http://rubyworks.github.com/dnote
|
|
37
|
-
code: http://github.com/rubyworks/dnote
|
|
38
|
-
wiki: http://wiki.github.com/rubyworks/dnote
|
|
39
|
-
api: http://rubydoc.info/gems/dnote
|
|
40
|
-
bugs: http://github.com/rubyworks/dnote/issues
|
|
41
|
-
mail: http://groups.google.com/groups/rubyworks-mailinglist
|
|
42
|
-
extra: {}
|
|
43
|
-
load_path:
|
|
44
|
-
- lib
|
|
45
|
-
revision: 0
|
|
46
|
-
created: '2009-10-09'
|
|
47
|
-
summary: Extract developer's notes from source code.
|
|
48
|
-
title: DNote
|
|
49
|
-
version: 1.7.0
|
|
50
|
-
name: dnote
|
|
51
|
-
description: ! 'DNote makes it easy to extract developer''s notes from source code,
|
|
52
|
-
|
|
53
|
-
and supports almost any language.'
|
|
54
|
-
organization: RubyWorks
|
|
55
|
-
date: '2011-10-25'
|
data/.yardopts
DELETED
data/test/notes_case.rb
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
require 'lemon'
|
|
2
|
-
require 'ae'
|
|
3
|
-
require 'dnote/notes'
|
|
4
|
-
|
|
5
|
-
testcase DNote::Notes do
|
|
6
|
-
|
|
7
|
-
concern "Coverage of DNote::Notes class."
|
|
8
|
-
|
|
9
|
-
method :labels do
|
|
10
|
-
test 'returns the list of labels' do
|
|
11
|
-
notes = DNote::Notes.new([], :labels=>['TODO'])
|
|
12
|
-
notes.labels.assert == ['TODO'] #DNote::Notes::DEFAULT_LABELS
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
method :files do
|
|
17
|
-
test 'returns the files attribute' do
|
|
18
|
-
notes = DNote::Notes.new(["example1.rb"])
|
|
19
|
-
notes.assert.files == ["example1.rb"]
|
|
20
|
-
notes = DNote::Notes.new([], :paths => ["example2.rb"])
|
|
21
|
-
notes.assert.files == ["example2.rb"]
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
method :files do
|
|
26
|
-
test 'changes the paths attribute' do
|
|
27
|
-
notes = DNote::Notes.new([])
|
|
28
|
-
notes.files = ["example1.rb"]
|
|
29
|
-
notes.assert.files == ["example1.rb"]
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
method :match_general do
|
|
34
|
-
test 'works' do
|
|
35
|
-
notes = DNote::Notes.new([])
|
|
36
|
-
line, lineno, file = "# TODO: Do something or another!", 1, "foo.rb"
|
|
37
|
-
rec = notes.match_general(line, lineno, file)
|
|
38
|
-
rec.to_h.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'text'=>"Do something or another!"}
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
method :match_special do
|
|
43
|
-
test 'works' do
|
|
44
|
-
notes = DNote::Notes.new([], :labels=>['TODO'])
|
|
45
|
-
line, lineno, file = "# TODO: Do something or another!", 1, "foo.rb"
|
|
46
|
-
rec = notes.match_special(line, lineno, file)
|
|
47
|
-
rec.to_h.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'text'=>"Do something or another!"}
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
method :counts do
|
|
52
|
-
test{ raise NotImplementedError }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
method :notes do
|
|
56
|
-
test{ raise NotImplementedError }
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
method :parse do
|
|
60
|
-
test{ raise NotImplementedError }
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
data/try/sample.bas
DELETED
data/try/sample.js
DELETED