Class: VhostGenerator::VhostConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/vhost_generator/vhost_configuration.rb

Overview

VhostConfiguration stores all the configuration values (to read from) env or cmdline needed to render the configuration template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application = 'myapp', static_folder = 'public', server_ports = '80', server_names = 'localhost', instance_ports = '', relative_root = '/', generator = 'nginx', generator_options = '', cmdline = nil) ⇒ VhostConfiguration

Returns a new instance of VhostConfiguration.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vhost_generator/vhost_configuration.rb', line 17

def initialize(application='myapp', static_folder='public',
    server_ports='80', server_names='localhost', instance_ports='',
    relative_root='/', generator='nginx', generator_options='',
    cmdline=nil)
  self.application = application
  self.static_folder = static_folder
  self.server_ports = server_ports
  self.server_names = server_names
  self.instance_ports = instance_ports
  self.relative_root = relative_root
  self.cmdline = cmdline # usually set later using attr_writer
  self.generator = generator
  self.generator_options = generator_options
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def application
  @application
end

#cmdlineObject

Returns the value of attribute cmdline.



15
16
17
# File 'lib/vhost_generator/vhost_configuration.rb', line 15

def cmdline
  @cmdline
end

#generatorObject

Returns the value of attribute generator.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def generator
  @generator
end

#generator_optionsObject

Returns the value of attribute generator_options.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def generator_options
  @generator_options
end

#instance_portsObject

Returns the value of attribute instance_ports.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def instance_ports
  @instance_ports
end

#relative_rootObject

Returns the value of attribute relative_root.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def relative_root
  @relative_root
end

#server_namesObject

Returns the value of attribute server_names.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def server_names
  @server_names
end

#server_portsObject

Returns the value of attribute server_ports.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def server_ports
  @server_ports
end

#static_folderObject

Returns the value of attribute static_folder.



12
13
14
# File 'lib/vhost_generator/vhost_configuration.rb', line 12

def static_folder
  @static_folder
end

Instance Method Details

#configure!(parser) ⇒ Object



67
68
69
# File 'lib/vhost_generator/vhost_configuration.rb', line 67

def configure!(parser)
  parser.parse(self)
end

#outputObject



71
72
73
# File 'lib/vhost_generator/vhost_configuration.rb', line 71

def output
  generator_for(self.generator).new(self, self.generator_options).render
end