Rake task library that provides a set of tasks to transform documentation using Rote. To use, create a new instance of this class in your Rakefile, performing appropriate configuration in a block supplied to new. This will automatically register a set of tasks with names based on the name you supply. The tasks defined are:
#{name} - Transform all documentation, copy resources.
#{name}_pages - Transform all pages
#{name}_res - Copy resources
#{name}_monitor - Start watching for changes
#clobber_{name} - Remove output
| DEFAULT_SRC_EXCLUDES | = | [ /\.rb$/, /\.rf$/ ] |
| Default exclusion patterns for the page sources. These are applied along with the defaults from FileList. | ||
| [RW] | default_output_dir | Base directories used by the task. |
| [R] | ext_mappings |
Ordered ExtHash that supplies mappings
between input and output file extensions. Keys are regexps that are matched
in order against the search key.
The values are [extension, ({ |page| …}), out_dir] . If a mapping has a block, it is executed when pages with a matching extension are, instantiated (before common and page code). It can be used to apply filters, for example, on a per-extension basis. |
| [RW] | layout_dir | Base directories used by the task. |
| [RW] | monitor_interval | The approximate number of seconds between update checks when running monitor mode (Default: 1) |
| [R] | name | The base-name for tasks created by this instance, supplied at instantiation. |
| [R] | pages | Globs for the FileList that supplies the pages to transform. You should configure the pages_dir and include at least one entry here. (you may add exclude strings or regexps, too). Patterns added are made relative to the pages_dir and added to a FileList once init is complete. |
| [R] | res |
Globs for the FileList that supplies the resources to copy. You
should configure the layout_dir and include at least one
entry here (you may add exclude strings or regexps, too).
This is not a FileList - the patterns supplied to this are used with the base-directory specified to construct an appropriate FileList. |
| [RW] | show_file_tasks | If show_page_tasks is true, then the file tasks created for each output file will be shown in the Rake task listing from the command line. |
Create a new DocTask, using the supplied block for configuration, and define tasks with the specified base-name within Rake.
[ show source ]
# File lib/rote/rotetasks.rb, line 188
188: def initialize(name = :doc) # :yield: self if block_given?
189: @name = name
190: @output_dir = '.'
191: @pages = FilePatterns.new('.')
192: @res = FilePatterns.new('.')
193: @monitor_interval = 1
194: @ext_mappings = ExtHash.new
195: @show_page_tasks = false
196:
197: DEFAULT_SRC_EXCLUDES.each { |excl| @pages.exclude(excl) }
198:
199: yield self if block_given?
200:
201: define
202: end
Define an extension mapping for the specified regex, which will be replaced with the specified extension. If a block is supplied it will be called with each matching Page as it‘s created.
Extension mappings also allow the output directory to be specified on a per-extension basis. If no output directory is specified, the default output directory is used.
[ show source ]
# File lib/rote/rotetasks.rb, line 168
168: def ext_mapping(match, extension, output_dir = self.default_output_dir, &block)
169: @ext_mappings[match] = [extension,block,output_dir]
170: end