some gem cleanup work
This commit is contained in:
parent
53e750853d
commit
9e2010266c
33
README.md
Normal file
33
README.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Apache Config Generator
|
||||||
|
|
||||||
|
Programmatically construct your Apache configuration using a powerful DSL built in Ruby.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
`gem install apache-config-generator`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Run `apache-configurator <directory>` to create a new directory to hold your config files.
|
||||||
|
A Rakefile and config.yml file will also be generated.
|
||||||
|
|
||||||
|
## Building a config file
|
||||||
|
|
||||||
|
Configs center around the Apache::Config.build method:
|
||||||
|
|
||||||
|
Apache::Config.build('sites-available/my-site.conf') do
|
||||||
|
server_name 'my-cool-website.cool.wow'
|
||||||
|
document_root '/var/www/my-cool-website'
|
||||||
|
|
||||||
|
directory '/' do
|
||||||
|
options :follow_sym_links, :indexes
|
||||||
|
allow_from_all
|
||||||
|
end
|
||||||
|
|
||||||
|
location_match %r{^/secret} do
|
||||||
|
deny_from_all
|
||||||
|
|
||||||
|
basic_authentication "My secret", '/etc/apache2/users/global.users', :user => :john
|
||||||
|
satisfy :any
|
||||||
|
end
|
||||||
|
end
|
12
bin/apache-configurator
Executable file
12
bin/apache-configurator
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
|
if File.directory? ARGV[0]
|
||||||
|
puts "You can't overwrite an existing directory."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
FileUtils.cp_r File.expand_path(File.join(File.dirname(__FILE__), '..', 'skel')), ARGV[0]
|
||||||
|
FileUtils.mkdir_p File.join(ARGV[0], 'source')
|
||||||
|
FileUtils.mkdir_p File.join(ARGV[0], 'conf.d')
|
4
skel/Rakefile
Normal file
4
skel/Rakefile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
require 'rubygems'
|
||||||
|
|
||||||
|
require 'apache-config-generator'
|
||||||
|
require 'apache/rake/create'
|
3
skel/config.yml
Normal file
3
skel/config.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
source: "source"
|
||||||
|
destination: "conf.d"
|
||||||
|
rotate_logs_path: '/path/to/apache/bin/rotatelogs'
|
Loading…
Reference in New Issue
Block a user