Class: H2OConfigurator::Builder
- Inherits:
-
Object
- Object
- H2OConfigurator::Builder
- Defined in:
- lib/h2o-configurator/builder.rb
Instance Method Summary collapse
- #check_config ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #make_config ⇒ Object
- #write_config ⇒ Object
Constructor Details
Instance Method Details
#check_config ⇒ Object
45 46 47 48 |
# File 'lib/h2o-configurator/builder.rb', line 45 def check_config system('h2o', '-t', '-c', H2OConfFile.to_s) exit($?.to_i) unless $?.success? end |
#make_config ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/h2o-configurator/builder.rb', line 24 def make_config config = { 'compress' => 'ON', 'reproxy' => 'ON', 'error-log' => ErrorLogFile.to_s, 'hosts' => {}, } Path.glob(SitesDirGlob).reject { |p| p.extname == '.old' || p.extname == '.new' }.each do |site_dir| site = Site.new(site_dir) config['hosts'].merge!(site.make_config) end config end |
#write_config ⇒ Object
38 39 40 41 42 43 |
# File 'lib/h2o-configurator/builder.rb', line 38 def write_config RedirectHandlerFile.copy(InstalledRedirectHandlerFile) AutoExtensionHandlerFile.copy(InstalledAutoExtensionHandlerFile) H2OConfFile.write(YAML.dump(make_config)) check_config end |