one could not include the include module the old way

This commit is contained in:
John Bintz 2013-06-10 14:02:54 -04:00
parent 6d45bb1ed6
commit 9475629eb5
5 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
source :rubygems source 'https://rubygems.org'
gemspec gemspec

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
apache-config-generator (0.2.8) apache-config-generator (0.2.9)
rainbow rainbow
GEM GEM
@ -15,7 +15,7 @@ GEM
mocha (0.9.10) mocha (0.9.10)
rake rake
nokogiri (1.4.3.1) nokogiri (1.4.3.1)
rainbow (1.1) rainbow (1.1.4)
rake (0.8.7) rake (0.8.7)
reek (1.2.8) reek (1.2.8)
ruby2ruby (~> 1.2) ruby2ruby (~> 1.2)

View File

@ -12,7 +12,6 @@ Gem::Specification.new do |s|
s.summary = %q{A Ruby DSL for programmatically generating Apache configs} s.summary = %q{A Ruby DSL for programmatically generating Apache configs}
s.email = %q{john@coswellproductions.com} s.email = %q{john@coswellproductions.com}
s.date = Date.today.to_s
s.files = `git ls-files`.split("\n") s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
s.require_path = 'lib' s.require_path = 'lib'

View File

@ -23,18 +23,22 @@ module Apache
def build(*modules, &block) def build(*modules, &block)
reset! reset!
modules.each { |mod| self.send(mod) } modules.each { |mod| add_module(mod) }
self.instance_eval(&block) if block self.instance_eval(&block) if block
[ '' ] + @modules + [ '' ] [ '' ] + @modules + [ '' ]
end end
# The method name becomes the module core name def add_module(method, *args)
def method_missing(method, *args)
module_name = "#{method}_module" module_name = "#{method}_module"
module_path = args[0] || "modules/mod_#{method}.so" module_path = args[0] || "modules/mod_#{method}.so"
@modules << [ 'LoadModule', *[ module_name, module_path ].quoteize ] * " " @modules << [ 'LoadModule', *[ module_name, module_path ].quoteize ] * " "
end end
# The method name becomes the module core name
def method_missing(method, *args)
add_module(method, *args)
end
end end
end end
end end

View File

@ -1,3 +1,3 @@
module Apache module Apache
VERSION = '0.2.8' VERSION = '0.2.9'
end end