Class: OpsKit::VHost
- Inherits:
-
Object
- Object
- OpsKit::VHost
- Defined in:
- lib/opskit/vhost.rb
Constant Summary collapse
- PROVIDERS =
Dir.entries( File.join( File.dirname(__FILE__), "templates/" ) ).select {|f| !File.directory? f}.map{ |e| e.split('.').first.to_sym }
Instance Attribute Summary collapse
-
#conf ⇒ Object
readonly
Returns the value of attribute conf.
Instance Method Summary collapse
-
#initialize(conf = {}) ⇒ VHost
constructor
A new instance of VHost.
- #render ⇒ Object
- #vhost_location ⇒ Object
Constructor Details
#initialize(conf = {}) ⇒ VHost
Returns a new instance of VHost.
7 8 9 |
# File 'lib/opskit/vhost.rb', line 7 def initialize( conf = {} ) @conf = conf end |
Instance Attribute Details
#conf ⇒ Object (readonly)
Returns the value of attribute conf.
5 6 7 |
# File 'lib/opskit/vhost.rb', line 5 def conf @conf end |
Instance Method Details
#render ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# 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 ⇒ Object
23 24 25 26 27 28 |
# 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 |