class DNote::RakeTask
Developmerās Notes
Rake Task¶ ↑
Constants
- DEFAULT_LABELS
Default note labels to looked for in source code.
Attributes
exclude[RW]
Exclude paths.
files[RW]
File paths to search.
formats[RW]
Formats (xml, html, rdoc, rdoc/list and so on).
ignore[RW]
Ignore paths based on any part of pathname.
labels[RW]
Labels to document. Defaults are: TODO, FIXME, OPTIMIZE and DEPRECATE.
output[R]
Output directory to save notes file. Defaults to dnote/
under the project log directory (eg. log/dnote/
).
title[RW]
Title to use if temaplte can use it.
Public Instance Methods
clean()
click to toggle source
Remove output files.
# File lib/dnote/rake/dnotetask.rb, line 72 def clean formats.each do |format| clean_format format end end
define()
click to toggle source
# File lib/dnote/rake/dnotetask.rb, line 49 def define desc "Collect Developer's Notes" task "dnote" do document end task "dnote:clobber" do clean end task clobber: ["dnote:clobber"] end
document()
click to toggle source
Generate notes document(s).
# File lib/dnote/rake/dnotetask.rb, line 61 def document abort "dnote: #{output} is not a directory" unless output.directory? session = new_session formats.each do |format| generate_document_for_format(session, format) end end
init()
click to toggle source
# File lib/dnote/rake/dnotetask.rb, line 40 def init require "dnote" require "dnote/format" @files = "**/*.rb" @output = "log/dnote" @formats = ["index"] @labels = nil end
output=(path)
click to toggle source
# File lib/dnote/rake/dnotetask.rb, line 36 def output=(path) @output = Pathname.new(path) end
Private Instance Methods
clean_format(format)
click to toggle source
# File lib/dnote/rake/dnotetask.rb, line 103 def clean_format(format) if format == "index" file = "#{output}index.html".to_s else ext = ::DNote::Format::EXTENSIONS[format] || format file = (output + "notes.#{ext}").to_s end rm(file) report "Removed #{output}" end
generate_document_for_format(session, format)
click to toggle source
# File lib/dnote/rake/dnotetask.rb, line 92 def generate_document_for_format(session, format) if format == "index" session.format = "html" session.output = File.join(output, "index.html") else session.format = format end session.run report "Updated #{output.to_s.sub("#{Dir.pwd}/", "")}" unless trial? end
new_session()
click to toggle source
# File lib/dnote/rake/dnotetask.rb, line 80 def new_session ::DNote::Session.new do |s| s.paths = files s.exclude = exclude s.ignore = ignore s.labels = labels s.title = title s.output = output s.dryrun = application.options.dryrun # trial? end end