dnote 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +29 -0
- data/bin/dnote +2 -2
- data/lib/dnote.rb +2 -3
- data/lib/dnote/format.rb +26 -69
- data/lib/dnote/note.rb +57 -0
- data/lib/dnote/notes.rb +158 -97
- data/lib/dnote/session.rb +277 -0
- data/lib/dnote/templates/html.erb +4 -4
- data/lib/dnote/templates/html/file.erb +40 -0
- data/lib/dnote/templates/html/label.erb +41 -0
- data/lib/dnote/templates/html/list.erb +33 -0
- data/lib/dnote/templates/json.erb +8 -0
- data/lib/dnote/templates/json/file.erb +8 -0
- data/lib/dnote/templates/json/label.erb +8 -0
- data/lib/dnote/templates/json/list.erb +8 -0
- data/lib/dnote/templates/md.erb +18 -0
- data/lib/dnote/templates/md/file.erb +13 -0
- data/lib/dnote/templates/md/label.erb +18 -0
- data/lib/dnote/templates/md/list.erb +9 -0
- data/lib/dnote/templates/rdoc.erb +3 -3
- data/lib/dnote/templates/rdoc/file.erb +9 -0
- data/lib/dnote/templates/rdoc/label.erb +11 -0
- data/lib/dnote/templates/rdoc/list.erb +6 -0
- data/lib/dnote/templates/soap.erb +4 -0
- data/lib/dnote/templates/soap/file.erb +4 -0
- data/lib/dnote/templates/soap/label.erb +4 -0
- data/lib/dnote/templates/soap/list.erb +4 -0
- data/lib/dnote/templates/text.erb +11 -0
- data/lib/dnote/templates/text/file.erb +10 -0
- data/lib/dnote/templates/text/label.erb +11 -0
- data/lib/dnote/templates/text/list.erb +7 -0
- data/lib/dnote/templates/xml.erb +6 -6
- data/lib/dnote/templates/xml/file.erb +15 -0
- data/lib/dnote/templates/xml/label.erb +15 -0
- data/lib/dnote/templates/xml/list.erb +6 -0
- data/lib/dnote/templates/xoxo.erb +4 -0
- data/lib/dnote/templates/xoxo/file.erb +4 -0
- data/lib/dnote/templates/xoxo/label.erb +4 -0
- data/lib/dnote/templates/xoxo/list.erb +6 -0
- data/lib/dnote/templates/yaml.erb +1 -0
- data/lib/dnote/templates/yaml/file.erb +1 -0
- data/lib/dnote/templates/yaml/label.erb +1 -0
- data/lib/dnote/templates/yaml/list.erb +1 -0
- data/lib/plugins/syckle/dnote.rb +35 -8
- data/meta/version +1 -1
- data/test/cases/notes_case.rb +20 -31
- metadata +44 -14
- data/MANIFEST +0 -33
- data/lib/dnote/command.rb +0 -134
- data/lib/dnote/site.rb +0 -140
- data/lib/dnote/templates/gnu.erb +0 -8
- data/lib/dnote/templates/markdown.erb +0 -17
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= title %>
|
2
|
+
|
3
|
+
<%= '=' * title.size %>
|
4
|
+
|
5
|
+
<% notes.by_label_file.each do |label, per_file| %>
|
6
|
+
|
7
|
+
<%= label %>
|
8
|
+
|
9
|
+
<%= '-' * (label.size) %>
|
10
|
+
|
11
|
+
<% per_file.each do |file, line_notes| %>
|
12
|
+
|
13
|
+
### file://<%= file %>
|
14
|
+
|
15
|
+
<% line_notes.each do |note| %>
|
16
|
+
* <%= note %> (<%= note.line %>)
|
17
|
+
<% end; end; end %>
|
18
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= title %>
|
2
|
+
|
3
|
+
<%= '=' * title.size %>
|
4
|
+
|
5
|
+
<% notes.by_label_file.each do |label, per_file| %>
|
6
|
+
|
7
|
+
<%= label %>
|
8
|
+
|
9
|
+
<%= '-' * (label.size) %>
|
10
|
+
|
11
|
+
<% per_file.each do |file, line_notes| %>
|
12
|
+
|
13
|
+
### file://<%= file %>
|
14
|
+
|
15
|
+
<% line_notes.each do |note| %>
|
16
|
+
* <%= note %> (<%= note.line %>)
|
17
|
+
<% end; end; end %>
|
18
|
+
|
@@ -1,11 +1,11 @@
|
|
1
|
-
= <%= title %><% notes.each do |label, per_file| %>
|
1
|
+
= <%= title %><% notes.by_label_file.each do |label, per_file| %>
|
2
2
|
|
3
3
|
== <%= label %>
|
4
4
|
<% per_file.each do |file, line_notes| %>
|
5
5
|
|
6
6
|
=== file://<%= file %>
|
7
7
|
|
8
|
-
<% line_notes.
|
9
|
-
* <%= note %> (<%= line %>)
|
8
|
+
<% line_notes.each do |note| %>
|
9
|
+
* <%= note %> (<%= note.line %>)
|
10
10
|
<% end; end; end %>
|
11
11
|
|
data/lib/dnote/templates/xml.erb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
<?xml version="1.0" ?>
|
2
2
|
<notes>
|
3
|
-
<% notes.each do |label, per_file| %>
|
4
|
-
<
|
3
|
+
<% notes.by_label_file.each do |label, per_file| %>
|
4
|
+
<label name="<%= label %>">
|
5
5
|
<% per_file.each do |file, line_notes| %>
|
6
6
|
<file src="<%= file %>">
|
7
|
-
<% line_notes.sort!{ |a,b| a
|
8
|
-
<% line_notes.each do |
|
9
|
-
<note line="<%= line %>" type="<%= label %>"><%= h note %></note>
|
7
|
+
<% line_notes.sort!{ |a,b| a.line <=> b.line } %>
|
8
|
+
<% line_notes.each do |note| %>
|
9
|
+
<note line="<%= note.line %>" type="<%= label %>"><%= h note.textline %></note>
|
10
10
|
<% end %>
|
11
11
|
</file>
|
12
12
|
<% end %>
|
13
|
-
</
|
13
|
+
</label>
|
14
14
|
<% end %>
|
15
15
|
</notes>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<notes>
|
3
|
+
<% notes.by_file_label.each do |file, per_label| %>
|
4
|
+
<file src="<%= file %>">
|
5
|
+
<% per_label.each do |label, lnotes| %>
|
6
|
+
<label name="<%= label %>">
|
7
|
+
<% line_notes.sort!{ |a,b| a.line <=> b.line } %>
|
8
|
+
<% line_notes.each do |note| %>
|
9
|
+
<note line="<%= note.line %>" type="<%= label %>"><%= h note.textline %></note>
|
10
|
+
<% end %>
|
11
|
+
</label>
|
12
|
+
<% end %>
|
13
|
+
</file>
|
14
|
+
<% end %>
|
15
|
+
</notes>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<notes>
|
3
|
+
<% notes.by_label_file.each do |label, per_file| %>
|
4
|
+
<label name="<%= label %>">
|
5
|
+
<% per_file.each do |file, line_notes| %>
|
6
|
+
<file src="<%= file %>">
|
7
|
+
<% line_notes.sort!{ |a,b| a.line <=> b.line } %>
|
8
|
+
<% line_notes.each do |note| %>
|
9
|
+
<note line="<%= note.line %>" type="<%= label %>"><%= h note.textline %></note>
|
10
|
+
<% end %>
|
11
|
+
</file>
|
12
|
+
<% end %>
|
13
|
+
</label>
|
14
|
+
<% end %>
|
15
|
+
</notes>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= require 'yaml'; notes.map{ |n| n.to_h_raw }.to_yaml %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= require 'yaml'; notes.by_file.to_yaml %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= require 'yaml'; notes.by_label.to_yaml %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= require 'yaml'; notes.map{ |n| n.to_h_raw }.to_yaml %>
|
data/lib/plugins/syckle/dnote.rb
CHANGED
@@ -40,14 +40,20 @@ module Syckle::Plugins
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# Default note labels to looked for in source code.
|
43
|
-
|
43
|
+
DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
|
44
44
|
|
45
|
-
#
|
45
|
+
# File paths to search.
|
46
46
|
attr_accessor :files
|
47
47
|
|
48
48
|
# Labels to document. Defaults are: TODO, FIXME, OPTIMIZE and DEPRECATE.
|
49
49
|
attr_accessor :labels
|
50
50
|
|
51
|
+
# Exclude paths.
|
52
|
+
attr_accessor :exclude
|
53
|
+
|
54
|
+
# Ignore paths based on any part of pathname.
|
55
|
+
attr_accessor :ignore
|
56
|
+
|
51
57
|
# Output directory to save notes file. Defaults to <tt>dnote/</tt> under
|
52
58
|
# the project log directory (eg. <tt>log/dnote/</tt>).
|
53
59
|
attr_accessor :output
|
@@ -73,16 +79,37 @@ module Syckle::Plugins
|
|
73
79
|
# TODO: Is #trial? correct?
|
74
80
|
#++
|
75
81
|
def document
|
76
|
-
|
77
|
-
|
82
|
+
session = ::DNote::Session.new do |s|
|
83
|
+
s.paths = files
|
84
|
+
s.exclude = exclude
|
85
|
+
s.ignore = ignore
|
86
|
+
s.labels = labels #|| DEFAULT_LABELS
|
87
|
+
s.title = title
|
88
|
+
s.output = output
|
89
|
+
s.dryrun = trial?
|
90
|
+
end
|
91
|
+
formats.each do |format|
|
78
92
|
if format == 'index'
|
79
|
-
format = 'html'
|
80
|
-
output = File.join(self.output, 'index.html')
|
93
|
+
session.format = 'html'
|
94
|
+
session.output = File.join(self.output, 'index.html')
|
95
|
+
else
|
96
|
+
session.format = format
|
81
97
|
end
|
82
|
-
|
83
|
-
format.render
|
98
|
+
session.run
|
84
99
|
report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
|
85
100
|
end
|
101
|
+
|
102
|
+
#files = files.map{ |f| Dir[f] }.flatten
|
103
|
+
#notes = ::DNote::Notes.new(files, :labels=>labels)
|
104
|
+
#[formats].flatten.each do |format|
|
105
|
+
# if format == 'index'
|
106
|
+
# format = 'html'
|
107
|
+
# output = File.join(self.output, 'index.html')
|
108
|
+
# end
|
109
|
+
# format = ::DNote::Format.new(notes, :format=>format, :output=>output.to_s, :title=>title, :dryrun=>trial?)
|
110
|
+
# format.render
|
111
|
+
# report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
|
112
|
+
#end
|
86
113
|
end
|
87
114
|
|
88
115
|
# Reset output directory, marking it as out-of-date.
|
data/meta/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/test/cases/notes_case.rb
CHANGED
@@ -2,54 +2,43 @@ require 'dnote/notes'
|
|
2
2
|
|
3
3
|
Case DNote::Notes do
|
4
4
|
|
5
|
-
Concern "
|
6
|
-
|
7
|
-
Unit :paths
|
5
|
+
Concern "Basic coverage of DNote::Notes class."
|
8
6
|
|
9
7
|
Unit :labels => 'returns the list of labels' do
|
10
|
-
notes = DNote::Notes.new([])
|
11
|
-
notes.labels.assert == DNote::Notes::DEFAULT_LABELS
|
12
|
-
end
|
13
|
-
|
14
|
-
Unit :labels= => 'changes the list of labels' do
|
15
|
-
notes = DNote::Notes.new([])
|
16
|
-
notes.labels = [:CHOICE]
|
17
|
-
notes.labels.assert == ['CHOICE']
|
8
|
+
notes = DNote::Notes.new([], :labels=>['TODO'])
|
9
|
+
notes.labels.assert == ['TODO'] #DNote::Notes::DEFAULT_LABELS
|
18
10
|
end
|
19
11
|
|
20
|
-
Unit :
|
12
|
+
Unit :files => 'returns the files attribute' do
|
21
13
|
notes = DNote::Notes.new(["example1.rb"])
|
22
|
-
notes.assert.
|
14
|
+
notes.assert.files == ["example1.rb"]
|
23
15
|
notes = DNote::Notes.new([], :paths => ["example2.rb"])
|
24
|
-
notes.assert.
|
16
|
+
notes.assert.files == ["example2.rb"]
|
25
17
|
end
|
26
18
|
|
27
|
-
Unit :
|
19
|
+
Unit :files= => 'changes the paths attribute' do
|
28
20
|
notes = DNote::Notes.new([])
|
29
|
-
notes.
|
30
|
-
notes.assert.
|
21
|
+
notes.files = ["example1.rb"]
|
22
|
+
notes.assert.files == ["example1.rb"]
|
31
23
|
end
|
32
24
|
|
33
|
-
Unit :
|
34
|
-
|
35
|
-
Unit :match_arbitrary => '' do
|
25
|
+
Unit :match_general => '' do
|
36
26
|
notes = DNote::Notes.new([])
|
37
27
|
line, lineno, file = "# TODO: Do something or another!", 1, "foo.rb"
|
38
|
-
rec = notes.
|
39
|
-
rec.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'
|
28
|
+
rec = notes.match_general(line, lineno, file)
|
29
|
+
rec.to_h.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'text'=>"Do something or another!"}
|
40
30
|
end
|
41
31
|
|
42
|
-
Unit :
|
43
|
-
|
32
|
+
Unit :match_specail => '' do
|
33
|
+
notes = DNote::Notes.new([], :labels=>['TODO'])
|
34
|
+
line, lineno, file = "# TODO: Do something or another!", 1, "foo.rb"
|
35
|
+
rec = notes.match_special(line, lineno, file)
|
36
|
+
rec.to_h.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'text'=>"Do something or another!"}
|
37
|
+
end
|
38
|
+
|
39
|
+
Unit :counts
|
44
40
|
Unit :notes
|
45
|
-
Unit :to
|
46
|
-
Unit :initialize_defaults
|
47
41
|
Unit :parse
|
48
|
-
Unit :to_yaml
|
49
|
-
Unit :to_json
|
50
|
-
Unit :counts
|
51
|
-
Unit :organize
|
52
|
-
Unit :display
|
53
42
|
|
54
43
|
end
|
55
44
|
|
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
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Thomas Sawyer
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-02-
|
17
|
+
date: 2010-02-18 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -27,22 +27,49 @@ extensions: []
|
|
27
27
|
extra_rdoc_files: []
|
28
28
|
|
29
29
|
files:
|
30
|
-
- HISTORY
|
31
|
-
- LICENSE
|
32
|
-
- MANIFEST
|
33
|
-
- README.rdoc
|
34
30
|
- bin/dnote
|
35
|
-
- lib/dnote.rb
|
36
|
-
- lib/dnote/command.rb
|
37
31
|
- lib/dnote/format.rb
|
32
|
+
- lib/dnote/note.rb
|
38
33
|
- lib/dnote/notes.rb
|
39
|
-
- lib/dnote/
|
34
|
+
- lib/dnote/session.rb
|
40
35
|
- lib/dnote/string.rb
|
41
|
-
- lib/dnote/templates/
|
36
|
+
- lib/dnote/templates/html/file.erb
|
37
|
+
- lib/dnote/templates/html/label.erb
|
38
|
+
- lib/dnote/templates/html/list.erb
|
42
39
|
- lib/dnote/templates/html.erb
|
43
|
-
- lib/dnote/templates/
|
40
|
+
- lib/dnote/templates/json/file.erb
|
41
|
+
- lib/dnote/templates/json/label.erb
|
42
|
+
- lib/dnote/templates/json/list.erb
|
43
|
+
- lib/dnote/templates/json.erb
|
44
|
+
- lib/dnote/templates/md/file.erb
|
45
|
+
- lib/dnote/templates/md/label.erb
|
46
|
+
- lib/dnote/templates/md/list.erb
|
47
|
+
- lib/dnote/templates/md.erb
|
48
|
+
- lib/dnote/templates/rdoc/file.erb
|
49
|
+
- lib/dnote/templates/rdoc/label.erb
|
50
|
+
- lib/dnote/templates/rdoc/list.erb
|
44
51
|
- lib/dnote/templates/rdoc.erb
|
52
|
+
- lib/dnote/templates/soap/file.erb
|
53
|
+
- lib/dnote/templates/soap/label.erb
|
54
|
+
- lib/dnote/templates/soap/list.erb
|
55
|
+
- lib/dnote/templates/soap.erb
|
56
|
+
- lib/dnote/templates/text/file.erb
|
57
|
+
- lib/dnote/templates/text/label.erb
|
58
|
+
- lib/dnote/templates/text/list.erb
|
59
|
+
- lib/dnote/templates/text.erb
|
60
|
+
- lib/dnote/templates/xml/file.erb
|
61
|
+
- lib/dnote/templates/xml/label.erb
|
62
|
+
- lib/dnote/templates/xml/list.erb
|
45
63
|
- lib/dnote/templates/xml.erb
|
64
|
+
- lib/dnote/templates/xoxo/file.erb
|
65
|
+
- lib/dnote/templates/xoxo/label.erb
|
66
|
+
- lib/dnote/templates/xoxo/list.erb
|
67
|
+
- lib/dnote/templates/xoxo.erb
|
68
|
+
- lib/dnote/templates/yaml/file.erb
|
69
|
+
- lib/dnote/templates/yaml/label.erb
|
70
|
+
- lib/dnote/templates/yaml/list.erb
|
71
|
+
- lib/dnote/templates/yaml.erb
|
72
|
+
- lib/dnote.rb
|
46
73
|
- lib/plugins/syckle/dnote.rb
|
47
74
|
- meta/account
|
48
75
|
- meta/authors
|
@@ -55,6 +82,9 @@ files:
|
|
55
82
|
- meta/title
|
56
83
|
- meta/version
|
57
84
|
- test/cases/notes_case.rb
|
85
|
+
- LICENSE
|
86
|
+
- README.rdoc
|
87
|
+
- HISTORY
|
58
88
|
has_rdoc: true
|
59
89
|
homepage:
|
60
90
|
licenses: []
|
@@ -82,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
112
|
requirements: []
|
83
113
|
|
84
114
|
rubyforge_project: dnote
|
85
|
-
rubygems_version: 1.3.6.pre.
|
115
|
+
rubygems_version: 1.3.6.pre.3
|
86
116
|
signing_key:
|
87
117
|
specification_version: 3
|
88
118
|
summary: Extract developer notes from source code.
|