lib/sanford/host.rb in sanford-0.4.0 vs lib/sanford/host.rb in sanford-0.6.0

- old
+ new

@@ -1,9 +1,9 @@ require 'ns-options' require 'pathname' +require 'singleton' -require 'sanford/exceptions' require 'sanford/logger' module Sanford module Host @@ -16,18 +16,19 @@ # still function as a mixin). Also, since it is making the `Host` # a `Singleton`, mixing that with `NsOptions::Proxy` could have strange # effects (messing up someone's `initialize`). Thus, the `Configuration` # is a separate class and not on the `Host` directly. - option :name, String - option :ip, String, :default => '0.0.0.0' - option :port, Integer - option :pid_dir, Pathname, :default => Dir.pwd - option :logger, :default => proc{ Sanford::NullLogger.new } - option :verbose_logging, :default => true - option :error_proc, Proc, :default => proc{ } - option :setup_proc, Proc, :default => proc{ } + option :name, String + option :ip, String, :default => '0.0.0.0' + option :port, Integer + option :pid_file, Pathname + option :logger, :default => proc{ Sanford.config.logger } + option :verbose_logging, :default => true + option :receives_keep_alive, :default => false + option :error_proc, Proc, :default => proc{ } + option :init_proc, Proc, :default => proc{ } def initialize(host) self.name = host.class.to_s end @@ -58,27 +59,31 @@ def port(*args) self.configuration.port *args end - def pid_dir(*args) - self.configuration.pid_dir *args + def pid_file(*args) + self.configuration.pid_file *args end def logger(*args) self.configuration.logger *args end def verbose_logging(*args) self.configuration.verbose_logging *args end + def receives_keep_alive(*args) + self.configuration.receives_keep_alive *args + end + def error(&block) self.configuration.error_proc = block end - def setup(&block) - self.configuration.setup_proc = block + def init(&block) + self.configuration.init_proc = block end def version(name, &block) version_group = Sanford::Host::VersionGroup.new(name, &block) @versioned_services.merge!(version_group.to_hash)