From bc5ca70f7515c6e99e8a22a5a1a7abb29b241e7c Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 27 Apr 2010 17:00:43 -0400 Subject: [PATCH] more changes --- lib/apache/config.rb | 2 ++ lib/apache/master.rb | 10 ---------- lib/apache/permissions.rb | 13 +++++++++++++ test/config/httpd.rb | 4 +++- 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 lib/apache/permissions.rb diff --git a/lib/apache/config.rb b/lib/apache/config.rb index 07544ea..748a376 100644 --- a/lib/apache/config.rb +++ b/lib/apache/config.rb @@ -1,10 +1,12 @@ require 'apache/master' +require 'apache/permissions' module Apache class Config class << self include Apache::Master include Apache::Quoteize + include Apache::Permissions def build(target, &block) @config = [] diff --git a/lib/apache/master.rb b/lib/apache/master.rb index d247063..b6e46af 100644 --- a/lib/apache/master.rb +++ b/lib/apache/master.rb @@ -59,16 +59,6 @@ module Apache group! group if group end - def deny_from_all - order! "deny,allow" - deny! "from all" - end - - def allow_from_all - order! "allow,deny" - allow! "from all" - end - def passenger(ruby_root, ruby_version, passenger_version) end diff --git a/lib/apache/permissions.rb b/lib/apache/permissions.rb new file mode 100644 index 0000000..dfef9c9 --- /dev/null +++ b/lib/apache/permissions.rb @@ -0,0 +1,13 @@ +module Apache + module Permissions + def deny_from_all + order! "deny,allow" + deny! "from all" + end + + def allow_from_all + order! "allow,deny" + allow! "from all" + end + end +end diff --git a/test/config/httpd.rb b/test/config/httpd.rb index 59a091e..1b909ea 100644 --- a/test/config/httpd.rb +++ b/test/config/httpd.rb @@ -1,3 +1,5 @@ +IPS = [ '127.0.0.1:80', '127.0.0.1:81' ] + Apache::Config.build('httpd.conf') do server_root '/var/html/apache' @@ -17,7 +19,7 @@ Apache::Config.build('httpd.conf') do deny_from_all end - virtual_host '127.0.0.1:80', '127.0.0.1:81' do + virtual_host *IPS do directory '/' do allow_from_all end