dnote 1.2.1 → 1.3.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/PROFILE +23 -0
- data/REQUIRE +6 -0
- data/VERSION +5 -0
- data/lib/dnote/notes.rb +18 -8
- data/lib/dnote/session.rb +8 -36
- data/lib/plugins/rake/task.rb +113 -0
- data/lib/plugins/syckle/dnote.rb +4 -4
- data/test/{cases/notes_case.rb → notes_case.rb} +1 -1
- metadata +18 -22
- data/meta/account +0 -1
- data/meta/authors +0 -1
- data/meta/contact +0 -1
- data/meta/name +0 -1
- data/meta/released +0 -1
- data/meta/repository +0 -1
- data/meta/suite +0 -1
- data/meta/summary +0 -1
- data/meta/title +0 -1
- data/meta/version +0 -1
data/PROFILE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
title : DNote
|
3
|
+
suite : proutils
|
4
|
+
summary: Extract developer's notes from source code
|
5
|
+
contact: trans <transfire@gmail.com>
|
6
|
+
created: 2009-10-09
|
7
|
+
authors: Thomas Sawyer
|
8
|
+
|
9
|
+
description:
|
10
|
+
Dnote makes it easy to extract developer's
|
11
|
+
notes from source code, and supports almost
|
12
|
+
any language.
|
13
|
+
|
14
|
+
resources:
|
15
|
+
home: http://proutils.github.com/dnote
|
16
|
+
code: http://github.com/proutils/dnote
|
17
|
+
wiki: http://wiki.github.com/proutils/dnote
|
18
|
+
api : http://proutils.github.com/dnote/rdoc
|
19
|
+
mail: http://groups.google.com/group/proutils
|
20
|
+
repo: git://github.com/proutils/dnote.git
|
21
|
+
|
22
|
+
copyright: Copyright (c) 2009 Thomas Sawyer
|
23
|
+
|
data/REQUIRE
ADDED
data/VERSION
ADDED
data/lib/dnote/notes.rb
CHANGED
@@ -34,11 +34,15 @@ module DNote
|
|
34
34
|
# Require label colon? Default is +true+.
|
35
35
|
attr_accessor :colon
|
36
36
|
|
37
|
+
# Alternate remark marker. Default is '#'.
|
38
|
+
attr_accessor :marker
|
39
|
+
|
37
40
|
# New set of notes for give +files+ and optional special labels.
|
38
41
|
def initialize(files, options={})
|
39
42
|
@files = [files].flatten
|
40
|
-
@labels = [options[:labels]].flatten.compact
|
43
|
+
@labels = [options[:labels] || DEFAULT_LABELS].flatten.compact
|
41
44
|
@colon = options[:colon].nil? ? true : options[:colon]
|
45
|
+
@marker = options[:marker] || '#'
|
42
46
|
parse
|
43
47
|
end
|
44
48
|
|
@@ -89,14 +93,15 @@ module DNote
|
|
89
93
|
records << save
|
90
94
|
else
|
91
95
|
if text
|
92
|
-
|
96
|
+
case line
|
97
|
+
when /^\s*#{remark}+\s*$/, /(?!^\s*#{remark})/, /^\s*#{remark}[+][+]/
|
93
98
|
text.strip!
|
94
99
|
text = nil
|
95
100
|
else
|
96
101
|
if text[-1,1] == "\n"
|
97
|
-
text << line.gsub(/^\s
|
102
|
+
text << line.gsub(/^\s*#{remark}\s*/,'')
|
98
103
|
else
|
99
|
-
text << "\n" << line.gsub(/^\s
|
104
|
+
text << "\n" << line.gsub(/^\s*#{remark}\s*/,'')
|
100
105
|
end
|
101
106
|
end
|
102
107
|
end
|
@@ -135,9 +140,9 @@ module DNote
|
|
135
140
|
#++
|
136
141
|
def match_special_regex(label)
|
137
142
|
if colon
|
138
|
-
|
143
|
+
/#{remark}\s*#{Regexp.escape(label)}[:]\s*(.*?)$/
|
139
144
|
else
|
140
|
-
|
145
|
+
/#{remark}\s*#{Regexp.escape(label)}[:]?\s*(.*?)$/
|
141
146
|
end
|
142
147
|
end
|
143
148
|
|
@@ -155,9 +160,9 @@ module DNote
|
|
155
160
|
#
|
156
161
|
def match_general_regex
|
157
162
|
if colon
|
158
|
-
|
163
|
+
/#{remark}\s*([A-Z]+)[:]\s+(.*?)$/
|
159
164
|
else
|
160
|
-
|
165
|
+
/#{remark}\s*([A-Z]+)[:]?\s+(.*?)$/
|
161
166
|
end
|
162
167
|
end
|
163
168
|
|
@@ -227,6 +232,11 @@ module DNote
|
|
227
232
|
by_label
|
228
233
|
end
|
229
234
|
|
235
|
+
#
|
236
|
+
def remark
|
237
|
+
@remark ||= Regexp.escape(marker)
|
238
|
+
end
|
239
|
+
|
230
240
|
# Convert to array of hashes then to YAML.
|
231
241
|
#def to_yaml
|
232
242
|
# require 'yaml'
|
data/lib/dnote/session.rb
CHANGED
@@ -37,6 +37,9 @@ module DNote
|
|
37
37
|
# Selected labels can optionally do without the colon.
|
38
38
|
attr_accessor :colon
|
39
39
|
|
40
|
+
# Alternate remark marker. Useful to other languages besides Ruby.
|
41
|
+
attr_accessor :marker
|
42
|
+
|
40
43
|
# Output format.
|
41
44
|
attr_accessor :format
|
42
45
|
|
@@ -72,6 +75,7 @@ module DNote
|
|
72
75
|
@format = DEFAULT_FORMAT
|
73
76
|
@title = DEFAULT_TITLE
|
74
77
|
@dryrun = false
|
78
|
+
@marker = '#'
|
75
79
|
end
|
76
80
|
|
77
81
|
public
|
@@ -88,7 +92,7 @@ module DNote
|
|
88
92
|
|
89
93
|
# Run session.
|
90
94
|
def run
|
91
|
-
notes = Notes.new(files, :labels=>labels, :colon=>colon)
|
95
|
+
notes = Notes.new(files, :labels=>labels, :colon=>colon, :marker=>marker)
|
92
96
|
formatter = Format.new(notes) do |f|
|
93
97
|
f.format = format
|
94
98
|
f.template = template
|
@@ -151,41 +155,9 @@ module DNote
|
|
151
155
|
opt.separator(" ")
|
152
156
|
opt.separator("OUTPUT FORMAT: (choose one)")
|
153
157
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
#opt.on("--yaml", "YAML serialization format") do
|
159
|
-
# session.format = 'yaml'
|
160
|
-
#end
|
161
|
-
|
162
|
-
#opt.on("--json", "JSON serialization format") do
|
163
|
-
# session.format = 'json'
|
164
|
-
#end
|
165
|
-
|
166
|
-
#opt.on("--soap", "SOAP XML envelope format") do
|
167
|
-
# session.format = 'soap'
|
168
|
-
#end
|
169
|
-
|
170
|
-
#opt.on("--xoxo", "XOXO microformat format") do
|
171
|
-
# session.format = 'xoxo'
|
172
|
-
#end
|
173
|
-
|
174
|
-
#opt.on("--xml", "XML markup format") do
|
175
|
-
# session.format = 'xml'
|
176
|
-
#end
|
177
|
-
|
178
|
-
#opt.on("--html", "HTML markup format") do
|
179
|
-
# session.format = 'html'
|
180
|
-
#end
|
181
|
-
|
182
|
-
#opt.on("--rdoc", "rdoc comment format") do
|
183
|
-
# session.format = 'rdoc'
|
184
|
-
#end
|
185
|
-
|
186
|
-
#opt.on("--markdown", "markdown wiki format") do
|
187
|
-
# session.format = 'md'
|
188
|
-
#end
|
158
|
+
opt.on("--marker", '-m MARK', "Alternative remark marker") do |mark|
|
159
|
+
session.marker = mark
|
160
|
+
end
|
189
161
|
|
190
162
|
opt.on("--format", "-f NAME", "select a format [text]") do |format|
|
191
163
|
session.format = format
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# = Developmer's Notes Rake Task
|
2
|
+
#
|
3
|
+
class DNoteTask < Rake::TaskLib
|
4
|
+
|
5
|
+
require 'rake/clean'
|
6
|
+
|
7
|
+
# Default note labels to looked for in source code.
|
8
|
+
DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
|
9
|
+
|
10
|
+
# File paths to search.
|
11
|
+
attr_accessor :files
|
12
|
+
|
13
|
+
# Labels to document. Defaults are: TODO, FIXME, OPTIMIZE and DEPRECATE.
|
14
|
+
attr_accessor :labels
|
15
|
+
|
16
|
+
# Formats (xml, html, rdoc, rdoc/list and so on).
|
17
|
+
attr_accessor :formats
|
18
|
+
|
19
|
+
# Exclude paths.
|
20
|
+
attr_accessor :exclude
|
21
|
+
|
22
|
+
# Ignore paths based on any part of pathname.
|
23
|
+
attr_accessor :ignore
|
24
|
+
|
25
|
+
# Output directory to save notes file. Defaults to <tt>dnote/</tt> under
|
26
|
+
# the project log directory (eg. <tt>log/dnote/</tt>).
|
27
|
+
attr_accessor :output
|
28
|
+
|
29
|
+
# Title to use if temaplte can use it.
|
30
|
+
attr_accessor :title
|
31
|
+
|
32
|
+
#
|
33
|
+
def output=(path)
|
34
|
+
@output = Pathname.new(path)
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
def init
|
39
|
+
require 'dnote'
|
40
|
+
require 'dnote/format'
|
41
|
+
@files = "**/*.rb"
|
42
|
+
@output = 'log/dnote'
|
43
|
+
@formats = ['index']
|
44
|
+
@labels = nil #DEFAULT_LABELS
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
def define
|
49
|
+
desc "Collect Developer's Notes"
|
50
|
+
task 'dnote' do
|
51
|
+
document
|
52
|
+
end
|
53
|
+
task 'dnote:clobber' do
|
54
|
+
clean
|
55
|
+
end
|
56
|
+
task :clobber => ['dnote:clobber']
|
57
|
+
end
|
58
|
+
|
59
|
+
# Generate notes document(s).
|
60
|
+
def document
|
61
|
+
abort "dnote: #{output} is not a directory" unless output.directory?
|
62
|
+
|
63
|
+
session = ::DNote::Session.new do |s|
|
64
|
+
s.paths = files
|
65
|
+
s.exclude = exclude
|
66
|
+
s.ignore = ignore
|
67
|
+
s.labels = labels #|| DEFAULT_LABELS
|
68
|
+
s.title = title
|
69
|
+
s.output = output
|
70
|
+
s.dryrun = application.options.dryrun #trial?
|
71
|
+
end
|
72
|
+
|
73
|
+
formats.each do |format|
|
74
|
+
if format == 'index'
|
75
|
+
session.format = 'html'
|
76
|
+
session.output = File.join(self.output, 'index.html')
|
77
|
+
else
|
78
|
+
session.format = format
|
79
|
+
end
|
80
|
+
session.run
|
81
|
+
report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Reset output directory, marking it as out-of-date.
|
86
|
+
def reset
|
87
|
+
#if File.directory?(output)
|
88
|
+
File.utime(0,0,output) unless $NOOP
|
89
|
+
puts "Marked #{output} as out-of-date"
|
90
|
+
#end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Remove output files.
|
94
|
+
def clean
|
95
|
+
#if File.directory?(output)
|
96
|
+
formats.each do |format|
|
97
|
+
if format == 'index'
|
98
|
+
file = (output + "index.html").to_s
|
99
|
+
else
|
100
|
+
ext = ::DNote::Format::EXTENSIONS[format] || format
|
101
|
+
file = (output + "notes.#{ext}").to_s
|
102
|
+
end
|
103
|
+
rm(file)
|
104
|
+
report "Removed #{output}"
|
105
|
+
end
|
106
|
+
#else
|
107
|
+
# rm(output)
|
108
|
+
# report "Removed #{output}"
|
109
|
+
#end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
data/lib/plugins/syckle/dnote.rb
CHANGED
@@ -34,10 +34,10 @@ module Syckle::Plugins
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
autorun do |project|
|
39
|
-
|
40
|
-
end
|
37
|
+
## autorun if log/notes exists
|
38
|
+
#autorun do |project|
|
39
|
+
# (project.log + 'dnote').exist?
|
40
|
+
#end
|
41
41
|
|
42
42
|
# Default note labels to looked for in source code.
|
43
43
|
DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 1.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Thomas Sawyer
|
@@ -14,18 +14,18 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-04 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
22
|
-
email:
|
21
|
+
description: Dnote makes it easy to extract developer's notes from source code, and supports almost any language.
|
22
|
+
email: transfire@gmail.com
|
23
23
|
executables:
|
24
24
|
- dnote
|
25
25
|
extensions: []
|
26
26
|
|
27
|
-
extra_rdoc_files:
|
28
|
-
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.rdoc
|
29
29
|
files:
|
30
30
|
- bin/dnote
|
31
31
|
- lib/dnote/format.rb
|
@@ -70,21 +70,15 @@ files:
|
|
70
70
|
- lib/dnote/templates/yaml/list.erb
|
71
71
|
- lib/dnote/templates/yaml.erb
|
72
72
|
- lib/dnote.rb
|
73
|
+
- lib/plugins/rake/task.rb
|
73
74
|
- lib/plugins/syckle/dnote.rb
|
74
|
-
-
|
75
|
-
-
|
76
|
-
- meta/contact
|
77
|
-
- meta/name
|
78
|
-
- meta/released
|
79
|
-
- meta/repository
|
80
|
-
- meta/suite
|
81
|
-
- meta/summary
|
82
|
-
- meta/title
|
83
|
-
- meta/version
|
84
|
-
- test/cases/notes_case.rb
|
75
|
+
- test/notes_case.rb
|
76
|
+
- PROFILE
|
85
77
|
- LICENSE
|
86
78
|
- README.rdoc
|
87
79
|
- HISTORY
|
80
|
+
- REQUIRE
|
81
|
+
- VERSION
|
88
82
|
has_rdoc: true
|
89
83
|
homepage:
|
90
84
|
licenses: []
|
@@ -92,7 +86,9 @@ licenses: []
|
|
92
86
|
post_install_message:
|
93
87
|
rdoc_options:
|
94
88
|
- --title
|
95
|
-
-
|
89
|
+
- DNote API
|
90
|
+
- --main
|
91
|
+
- README.rdoc
|
96
92
|
require_paths:
|
97
93
|
- lib
|
98
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -112,9 +108,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
108
|
requirements: []
|
113
109
|
|
114
110
|
rubyforge_project: dnote
|
115
|
-
rubygems_version: 1.3.6
|
111
|
+
rubygems_version: 1.3.6
|
116
112
|
signing_key:
|
117
113
|
specification_version: 3
|
118
|
-
summary: Extract developer notes from source code
|
114
|
+
summary: Extract developer's notes from source code
|
119
115
|
test_files: []
|
120
116
|
|
data/meta/account
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
proutils
|
data/meta/authors
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Thomas Sawyer
|
data/meta/contact
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
http://googlegroups.com/group/proutils
|
data/meta/name
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
dnote
|
data/meta/released
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2010-02-06
|
data/meta/repository
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
git://github.com/proutils/dnote.git
|
data/meta/suite
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
proutils
|
data/meta/summary
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Extract developer notes from source code.
|
data/meta/title
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
D'Note
|
data/meta/version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.2.1
|