Class: DNote::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/dnote/rake/dnotetask.rb

Overview

Developmerā€™s Notes Rake Task

Constant Summary collapse

DEFAULT_LABELS =

Default note labels to looked for in source code.

%w[TODO FIXME OPTIMIZE DEPRECATE].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#excludeObject

Exclude paths.



24
25
26
# File 'lib/dnote/rake/dnotetask.rb', line 24

def exclude
  @exclude
end

#filesObject

File paths to search.



15
16
17
# File 'lib/dnote/rake/dnotetask.rb', line 15

def files
  @files
end

#formatsObject

Formats (xml, html, rdoc, rdoc/list and so on).



21
22
23
# File 'lib/dnote/rake/dnotetask.rb', line 21

def formats
  @formats
end

#ignoreObject

Ignore paths based on any part of pathname.



27
28
29
# File 'lib/dnote/rake/dnotetask.rb', line 27

def ignore
  @ignore
end

#labelsObject

Labels to document. Defaults are: TODO, FIXME, OPTIMIZE and DEPRECATE.



18
19
20
# File 'lib/dnote/rake/dnotetask.rb', line 18

def labels
  @labels
end

#outputObject

Output directory to save notes file. Defaults to dnote/ under the project log directory (eg. log/dnote/).



31
32
33
# File 'lib/dnote/rake/dnotetask.rb', line 31

def output
  @output
end

#titleObject

Title to use if temaplte can use it.



34
35
36
# File 'lib/dnote/rake/dnotetask.rb', line 34

def title
  @title
end

Instance Method Details

#cleanObject

Remove output files.



72
73
74
75
76
# File 'lib/dnote/rake/dnotetask.rb', line 72

def clean
  formats.each do |format|
    clean_format format
  end
end

#defineObject



49
50
51
52
53
54
55
56
57
58
# 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

#documentObject

Generate notes document(s).



61
62
63
64
65
66
67
68
69
# 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

#initObject



40
41
42
43
44
45
46
47
# 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