def self.installer(type, installer_opts = {}, &locator)
locator ||= lambda{|to| to}
loc_method = "install_location_for_#{type}".to_sym
define_method("simple_#{loc_method}", locator)
define_method(loc_method) do |to, options|
if options[:like] && options[:like] != type
send("install_location_for_#{options[:like]}", to, options)
else
send("simple_#{loc_method}", to)
end
end
define_method "install_#{type}" do |from, to, options|
from = templatize(from)
to = targetize(send(loc_method, to, options))
copy from, to, nil, (installer_opts[:binary] || options[:binary])
end
end