class OpsKit::VHost

Constants

PROVIDERS

Attributes

conf[R]

Public Class Methods

new( conf = {} ) click to toggle source
# File lib/opskit/vhost.rb, line 7
def initialize( conf = {} )
  @conf = conf
end

Public Instance Methods

render() click to toggle source
# File lib/opskit/vhost.rb, line 11
def render
  if PROVIDERS.include? @conf[ :template ].to_sym
    file_path = File.join( File.dirname(__FILE__), "templates/#{ @conf[ :template ] }.erb.conf" )
  elsif @conf[ :template ]
    file_path = @conf[ :template ]
  end

  template = File.read( file_path )
  vhost = Erubis::Eruby.new( template )
  vhost.result(@conf)
end
vhost_location() click to toggle source
# File lib/opskit/vhost.rb, line 23
def vhost_location
  case @conf[ :template ].to_sym
  when :apache
    "/etc/apache2/sites-available/#{ @conf[:url] }.conf"
  end
end