Sha256: d2f86433aab2574c7df3d37bd40221d87a4f493a387c8611b3b34b342da6f4e2

Contents?: true

Size: 768 Bytes

Versions: 6

Compression:

Stored size: 768 Bytes

Contents

# Try to load Settingslogic
begin
  require "settingslogic"
rescue LoadError
  raise "warning: Settingslogic is needed to provide configuration values to the Gemspec file"
end

# Configuration class
class Settings < Settingslogic
  # Read configuration
  namespace (defined?(APP_ENV) ? APP_ENV : "production")
  source ((File.exists? APP_CONF) ? APP_CONF : Hash.new)
  suppress_errors true

  # Compute my PID filename
  def pidfile
    self["pidfile"] || "/tmp/#{APP_NAME}.port#{self['port'].to_s}.pid"
  end

  # Direct access to any depth
  def at *path
    path.reduce(Settings) {|m,key| m && m[key.to_s] }
  end

  # Dump whole settings set to readable YAML
  def dump
    self.to_hash.to_yaml( :Indent => 4, :UseHeader => true, :UseVersion => false )
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rest-ftp-daemon-0.210.2 lib/rest-ftp-daemon/settings.rb
rest-ftp-daemon-0.210.1 lib/rest-ftp-daemon/settings.rb
rest-ftp-daemon-0.210.0 lib/rest-ftp-daemon/settings.rb
rest-ftp-daemon-0.202.2 lib/rest-ftp-daemon/settings.rb
rest-ftp-daemon-0.202.1 lib/rest-ftp-daemon/settings.rb
rest-ftp-daemon-0.202 lib/rest-ftp-daemon/settings.rb