apache-config-generator/lib/apache/config.rb

34 lines
621 B
Ruby
Raw Normal View History

2010-04-27 20:11:47 +00:00
require 'apache/master'
2010-04-27 21:00:43 +00:00
require 'apache/permissions'
2010-04-27 20:11:47 +00:00
module Apache
class Config
class << self
include Apache::Master
include Apache::Quoteize
2010-04-27 21:00:43 +00:00
include Apache::Permissions
2010-04-27 20:11:47 +00:00
def build(target, &block)
@config = []
@indent = 0
self.instance_eval(&block)
puts @config * "\n"
#File.open(target, 'w') { |f| f.puts @config * "\n" }
end
2010-04-28 20:19:03 +00:00
def indent(string)
" " * (@indent * 2) + string
end
def <<(string)
@config << indent(string)
end
2010-04-27 20:11:47 +00:00
end
block_methods :if_module, :directory, :virtual_host
end
end