some code cleanup stuff

This commit is contained in:
John Bintz 2010-05-12 14:24:35 -04:00
parent 0d17547925
commit 30c925a4f1
4 changed files with 15 additions and 16 deletions

1
.gitignore vendored
View File

@ -5,5 +5,6 @@ docs/*
pkg/*
Manifest
*.gemspec
tmp/*

View File

@ -47,8 +47,8 @@ module Apache
when String
@config << "#{which} #{opts * " "}"
when Array
which.each do |w|
@config << "#{w} #{opts.shift}"
which.each do |tag|
@config << "#{tag} #{opts.shift}"
end
end
end

View File

@ -170,7 +170,7 @@ module Apache
module RegularExpressionMatcher
# Test this rewritable thing
def test(from, opts = {})
from = from.gsub(@from, @to.gsub(/\$([0-9])/) { |m| '\\' + $1 })
from = from.gsub(@from, @to.gsub(/\$([0-9])/) { |match| '\\' + $1 })
replace_placeholders(from, opts)
end
@ -179,14 +179,14 @@ module Apache
end
# Replace the placeholders in this rewritable thing
def replace_placeholders(s, opts)
def replace_placeholders(string, opts)
opts.each do |opt, value|
case value
when String
s = s.gsub('%{' + opt.to_s.upcase + '}', value)
string = string.gsub('%{' + opt.to_s.upcase + '}', value)
end
end
s.gsub(%r{%\{[^\}]+\}}, '')
string.gsub(%r{%\{[^\}]+\}}, '')
end
end
@ -387,12 +387,9 @@ module Apache
end
result = false
case to[0..0]
when '-'
case to
when '-f'
result = opts[:files].include? source if opts[:files]
end
result = opts[:files].include?(source) if opts[:files]
else
result = source[Regexp.new(to)]
end

View File

@ -3,12 +3,13 @@ module Apache
def enable_ssl_engine(options = {})
self << ""
self << "SSLEngine on"
options.each do |k, v|
case k
options.each do |key, value|
value = quoteize(value).first
case key
when :certificate_file, :certificate_key_file
self << "SSL#{apachify(k)} #{quoteize(v).first}"
self << "SSL#{apachify(key)} #{value}"
when :ca_certificate_file
self << "SSLCACertificateFile #{quoteize(v).first}"
self << "SSLCACertificateFile #{value}"
end
end
self << ""