module Mattock
Constants
- Tasklib
{Mattock::TaskLib} provides a base class to build tasklibs on so that you can get to what you care about, and get option validation as well. The convention that's added in Mattock is that Tasklibs are passed to each other as arguments, so that behavior can be composed out of modular components. To define a new task lib: subclass {TaskLib}, add some ::setting calls, and override #define to add some tasks. To use your tasklib, instantiate with a block, optionally passing other task libs to copy configuration from. @example class CoolTask < Mattock::TaskLib settings :option_one, :option_two default_namespace :be def define task :cool do puts "I am so #{option_one} #{option_two}" end end end CoolTask.new(:args) do |t| t.option_one = "cool" t.option_two = "very" end @example > rake be:cool I am so very cool @example Composition transport = HTTPTasks.new do |t| t.server = http://mycoolserver.com end UploadTasks.new(transport) do |t| t.dir = "./source_dir" end
The configuration handling is provided by {CascadingDefinition}, and configuration options are built using {Configurable}