Skip to content

brianokeefe/vhost_writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VhostWriter

Gem Version Code Climate Build Status Coverage Status

Automatically generate virtual host config files based on a directory of sites and a given ERB template.

Installation

$ gem install vhost_writer

Usage

Writing configs

vhost_writer write takes the following:

  • A directory of directories that contain sites
    • Each site's directory should share the name of its domain (like example.com)
  • A directory to write config files to
  • The path to a template file written in ERB
    • Within the template, the site variable contains the name of the site.

Example

$ vhost_writer write /srv/www/ /etc/apache2/sites-available/ /home/bok/template.erb

Scaffolding

vhost_writer has the ability to generate sane default ERB templates for you to modify and use with vhost_writer write. Access this functionality with vhost_writer scaffold.

# Display a list of included scaffolds
$ vhost_writer scaffold

# Generate an Apache ERB template
$ vhost_writer scaffold apache

Template Example

<VirtualHost *:80>
  ServerAdmin admin@<%= site %>
  ServerName <%= site %>
  ServerAlias www.<%= site %>
  DocumentRoot /srv/www/<%= site %>/public_html/
  ErrorLog /srv/www/<%= site %>/logs/error.log
  CustomLog /srv/www/<%= site %>/logs/access.log combined
</VirtualHost>

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Virtual host configuration generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages