2010-05-04 15:48:59 +00:00
|
|
|
require 'apache/quoteize'
|
|
|
|
|
|
|
|
module Apache
|
|
|
|
class Modules
|
|
|
|
class << self
|
|
|
|
include Apache::Quoteize
|
|
|
|
|
2010-05-04 21:04:44 +00:00
|
|
|
attr_accessor :modules
|
|
|
|
|
|
|
|
def reset!
|
2010-05-04 15:48:59 +00:00
|
|
|
@modules = []
|
2010-05-04 21:04:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def build(*modules, &block)
|
|
|
|
reset!
|
2010-05-04 15:48:59 +00:00
|
|
|
|
|
|
|
modules.each { |m| self.send(m) }
|
|
|
|
self.instance_eval(&block) if block
|
|
|
|
|
2010-05-05 14:44:20 +00:00
|
|
|
[ '' ] + @modules + [ '' ]
|
2010-05-04 15:48:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(method, *args)
|
|
|
|
module_name = "#{method}_module"
|
|
|
|
module_path = args[0] || "modules/mod_#{method}.so"
|
|
|
|
@modules << [ 'LoadModule', *quoteize(module_name, module_path) ] * " "
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|