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

39 lines
1.0 KiB
Ruby
Raw Normal View History

2010-05-05 14:44:20 +00:00
module Apache
2010-05-10 19:57:34 +00:00
# Methods to handle directory settings
2010-05-05 14:44:20 +00:00
module Directories
2010-05-10 19:57:34 +00:00
# Create an Options directive
#
# The options passed into this method are Apachified:
# options :exec_cgi, :follow_sym_links #=> Options ExecCGI FollowSymLinks
2010-05-05 14:44:20 +00:00
def options(*opt)
2010-05-07 17:56:49 +00:00
create_options_list('Options', *opt)
2010-05-05 16:25:07 +00:00
end
2010-05-10 19:57:34 +00:00
# Create an IndexOptions directive
#
# The options passed into this method are Apachified:
# index_options :fancy_indexing, :suppress_description #=> IndexOptions FancyIndexing SuppressDescription
2010-05-05 16:25:07 +00:00
def index_options(*opt)
2010-05-07 17:56:49 +00:00
create_options_list('IndexOptions', *opt)
2010-05-05 14:44:20 +00:00
end
2010-05-07 17:56:49 +00:00
private
def create_options_list(tag, *opt)
2010-05-10 21:43:34 +00:00
opt = opt.collect do |o|
case o
when Symbol
if o.to_s[0..3] == 'not_'
"-#{apachify(o.to_s[4..-1])}"
else
apachify(o)
end
else
apachify(o)
end
end
self << "#{tag} #{opt * " "}"
2010-05-07 17:56:49 +00:00
end
2010-05-05 14:44:20 +00:00
end
end