dnote 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +50 -42
- data/.yardopts +5 -0
- data/COPYING.rdoc +31 -0
- data/HISTORY.rdoc +14 -2
- data/README.rdoc +5 -14
- data/lib/dnote.rb +1 -1
- data/lib/dnote/core_ext.rb +80 -0
- data/lib/dnote/format.rb +2 -1
- data/lib/dnote/rake/dnotetask.rb +116 -0
- data/lib/dnote/session.rb +2 -2
- data/lib/dnote/templates/md.erb +2 -1
- data/lib/dnote/templates/md/file.erb +1 -0
- data/lib/dnote/templates/md/label.erb +1 -0
- data/lib/dnote/templates/md/list.erb +1 -0
- data/lib/dnote/templates/rdoc.erb +1 -0
- data/lib/dnote/templates/rdoc/file.erb +1 -0
- data/lib/dnote/templates/rdoc/label.erb +1 -0
- data/lib/dnote/templates/rdoc/list.erb +1 -0
- data/lib/dnote/templates/text.erb +1 -0
- data/lib/dnote/templates/text/file.erb +2 -1
- data/lib/dnote/templates/text/list.erb +1 -0
- data/lib/dnote/templates/xml.erb +13 -5
- data/lib/dnote/templates/xml/file.erb +13 -5
- data/lib/dnote/templates/xml/label.erb +11 -3
- data/lib/dnote/templates/xml/list.erb +9 -1
- data/lib/dnote/version.rb +14 -1
- data/test/notes_case.rb +45 -25
- metadata +69 -85
- data/APACHE2.txt +0 -202
- data/lib/dnote/string.rb +0 -68
- data/lib/plugins/rake/task.rb +0 -113
- data/lib/plugins/redline/dnote.rb +0 -158
data/APACHE2.txt
DELETED
@@ -1,202 +0,0 @@
|
|
1
|
-
Apache License
|
2
|
-
Version 2.0, January 2004
|
3
|
-
http://www.apache.org/licenses/
|
4
|
-
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
-
|
7
|
-
1. Definitions.
|
8
|
-
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
-
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
-
the copyright owner that is granting the License.
|
14
|
-
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
202
|
-
|
data/lib/dnote/string.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
class Xacto
|
2
|
-
|
3
|
-
# Extensions for String class.
|
4
|
-
# These methods are taken directly from Ruby Facets.
|
5
|
-
#
|
6
|
-
module String
|
7
|
-
|
8
|
-
# Provides a margin controlled string.
|
9
|
-
#
|
10
|
-
# x = %Q{
|
11
|
-
# | This
|
12
|
-
# | is
|
13
|
-
# | margin controlled!
|
14
|
-
# }.margin
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# NOTE: This may still need a bit of tweaking.
|
18
|
-
#
|
19
|
-
# CREDIT: Trans
|
20
|
-
|
21
|
-
def margin(n=0)
|
22
|
-
#d = /\A.*\n\s*(.)/.match( self )[1]
|
23
|
-
#d = /\A\s*(.)/.match( self)[1] unless d
|
24
|
-
d = ((/\A.*\n\s*(.)/.match(self)) ||
|
25
|
-
(/\A\s*(.)/.match(self)))[1]
|
26
|
-
return '' unless d
|
27
|
-
if n == 0
|
28
|
-
gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, '')
|
29
|
-
else
|
30
|
-
gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, ' ' * n)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# Preserves relative tabbing.
|
35
|
-
# The first non-empty line ends up with n spaces before nonspace.
|
36
|
-
#
|
37
|
-
# CREDIT: Gavin Sinclair
|
38
|
-
|
39
|
-
def tabto(n)
|
40
|
-
if self =~ /^( *)\S/
|
41
|
-
indent(n - $1.length)
|
42
|
-
else
|
43
|
-
self
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# Indent left or right by n spaces.
|
48
|
-
# (This used to be called #tab and aliased as #indent.)
|
49
|
-
#
|
50
|
-
# CREDIT: Gavin Sinclair
|
51
|
-
# CREDIT: Trans
|
52
|
-
|
53
|
-
def indent(n)
|
54
|
-
if n >= 0
|
55
|
-
gsub(/^/, ' ' * n)
|
56
|
-
else
|
57
|
-
gsub(/^ {0,#{-n}}/, "")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
class ::String #:nodoc:
|
64
|
-
include Xacto::String
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
data/lib/plugins/rake/task.rb
DELETED
@@ -1,113 +0,0 @@
|
|
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
|
-
|
@@ -1,158 +0,0 @@
|
|
1
|
-
module Redline::Plugins
|
2
|
-
|
3
|
-
# = Developmer's Notes Plugin
|
4
|
-
#
|
5
|
-
# This plugin goes through you source files and compiles
|
6
|
-
# a list of any labeled comments. Labels are single word
|
7
|
-
# prefixes to a comment ending in a colon. For example,
|
8
|
-
# you might note somewhere in your code:
|
9
|
-
#
|
10
|
-
# By default this label supports the TODO, FIXME, OPTIMIZE
|
11
|
-
# and DEPRECATE.
|
12
|
-
#
|
13
|
-
# Output is a set of files in HTML, XML and RDoc's simple
|
14
|
-
# markup format. This plugin can run automatically if there
|
15
|
-
# is a +notes/+ directory in the project's log directory.
|
16
|
-
#
|
17
|
-
#--
|
18
|
-
# TODO: Should this service be part of the +site+ track?
|
19
|
-
#++
|
20
|
-
class DNote < Service
|
21
|
-
|
22
|
-
stop :main, :document
|
23
|
-
stop :main, :reset
|
24
|
-
stop :main, :clean
|
25
|
-
|
26
|
-
# not that this is necessary, but ...
|
27
|
-
#available do |project|
|
28
|
-
# begin
|
29
|
-
# require 'dnote'
|
30
|
-
# require 'dnote/format'
|
31
|
-
# true
|
32
|
-
# rescue LoadError
|
33
|
-
# false
|
34
|
-
# end
|
35
|
-
#end
|
36
|
-
|
37
|
-
## autorun if log/notes exists
|
38
|
-
#autorun do |project|
|
39
|
-
# (project.log + 'dnote').exist?
|
40
|
-
#end
|
41
|
-
|
42
|
-
# Default note labels to looked for in source code.
|
43
|
-
DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
|
44
|
-
|
45
|
-
# File paths to search.
|
46
|
-
attr_accessor :files
|
47
|
-
|
48
|
-
# Labels to document. Defaults are: TODO, FIXME, OPTIMIZE and DEPRECATE.
|
49
|
-
attr_accessor :labels
|
50
|
-
|
51
|
-
# Exclude paths.
|
52
|
-
attr_accessor :exclude
|
53
|
-
|
54
|
-
# Ignore paths based on any part of pathname.
|
55
|
-
attr_accessor :ignore
|
56
|
-
|
57
|
-
# Output directory to save notes file. Defaults to <tt>dnote/</tt> under
|
58
|
-
# the project log directory (eg. <tt>log/dnote/</tt>).
|
59
|
-
attr_reader :output
|
60
|
-
|
61
|
-
# Formats (xml, html, rdoc).
|
62
|
-
attr_accessor :formats
|
63
|
-
|
64
|
-
# Title to use if temaplte can use it.
|
65
|
-
attr_accessor :title
|
66
|
-
|
67
|
-
# Number of context lines to display.
|
68
|
-
attr_accessor :lines
|
69
|
-
|
70
|
-
#
|
71
|
-
def output=(path)
|
72
|
-
@output = Pathname.new(path)
|
73
|
-
end
|
74
|
-
|
75
|
-
#
|
76
|
-
#def dnote
|
77
|
-
# @dnote ||= ::DNote::Site.new(files, :labels=>labels, :formats=>formats, :output=>output)
|
78
|
-
#end
|
79
|
-
|
80
|
-
# Generate notes documents.
|
81
|
-
#--
|
82
|
-
# TODO: Is #trial? correct?
|
83
|
-
#++
|
84
|
-
def document
|
85
|
-
session = ::DNote::Session.new do |s|
|
86
|
-
s.paths = files
|
87
|
-
s.exclude = exclude
|
88
|
-
s.ignore = ignore
|
89
|
-
s.labels = labels #|| DEFAULT_LABELS
|
90
|
-
s.title = title
|
91
|
-
s.context = lines
|
92
|
-
s.output = output
|
93
|
-
s.dryrun = trial?
|
94
|
-
end
|
95
|
-
formats.each do |format|
|
96
|
-
if format == 'index'
|
97
|
-
session.format = 'html'
|
98
|
-
session.output = File.join(self.output, 'index.html')
|
99
|
-
else
|
100
|
-
session.format = format
|
101
|
-
end
|
102
|
-
session.run
|
103
|
-
report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
|
104
|
-
end
|
105
|
-
|
106
|
-
#files = files.map{ |f| Dir[f] }.flatten
|
107
|
-
#notes = ::DNote::Notes.new(files, :labels=>labels)
|
108
|
-
#[formats].flatten.each do |format|
|
109
|
-
# if format == 'index'
|
110
|
-
# format = 'html'
|
111
|
-
# output = File.join(self.output, 'index.html')
|
112
|
-
# end
|
113
|
-
# format = ::DNote::Format.new(notes, :format=>format, :output=>output.to_s, :title=>title, :dryrun=>trial?)
|
114
|
-
# format.render
|
115
|
-
# report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
|
116
|
-
#end
|
117
|
-
end
|
118
|
-
|
119
|
-
# Reset output directory, marking it as out-of-date.
|
120
|
-
def reset
|
121
|
-
if File.directory?(output)
|
122
|
-
File.utime(0,0,output) unless $NOOP
|
123
|
-
puts "Marked #{output}"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
# Remove output files.
|
128
|
-
def clean
|
129
|
-
if File.directory?(output)
|
130
|
-
formats.each do |format|
|
131
|
-
ext = ::DNote::Format::EXTENSIONS[format] || format
|
132
|
-
file = (output + "notes.#{ext}").to_s
|
133
|
-
rm(file)
|
134
|
-
report "Removed #{output}"
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
private
|
140
|
-
|
141
|
-
#
|
142
|
-
def initialize_requires
|
143
|
-
require 'dnote'
|
144
|
-
require 'dnote/format'
|
145
|
-
end
|
146
|
-
|
147
|
-
#
|
148
|
-
def initialize_defaults
|
149
|
-
@files = "**/*.rb"
|
150
|
-
@output = project.log + 'dnote'
|
151
|
-
@formats = ['index']
|
152
|
-
@labels = nil #DEFAULT_LABELS
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
end
|
158
|
-
|