Sha256: 6378cd8ad406eaa6c4437efd59abdaa2b8f9f1f7c4c166b388bae0c0b03a9688

Contents?: true

Size: 988 Bytes

Versions: 9

Compression:

Stored size: 988 Bytes

Contents

module Crono
  # Crono::Config stores Crono configuration
  class Config
    CRONOTAB  = 'config/cronotab.rb'
    LOGFILE   = 'log/crono.log'
    PIDFILE   = 'tmp/pids/crono.pid'
    PIDDIR    = 'tmp/pids'
    PROCESS_NAME = 'crono'

    attr_accessor :cronotab, :logfile, :pidfile, :piddir, :process_name,
                  :monitor, :daemonize, :deprecated_daemonize, :environment

    def initialize
      self.cronotab = CRONOTAB
      self.logfile  = LOGFILE
      self.piddir = PIDDIR
      self.process_name = PROCESS_NAME
      self.daemonize = false
      self.deprecated_daemonize = false
      self.monitor = false
      self.environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
    end

    def pidfile=(pidfile)
      @pidfile = pidfile
      self.process_name = Pathname.new(pidfile).basename(".*").to_s
      self.piddir = Pathname.new(pidfile).dirname.to_s 
    end

    def pidfile
      @pidfile || (deprecated_daemonize ? PIDFILE : nil)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
crono-1.1.2 lib/crono/config.rb
crono-1.1.1 lib/crono/config.rb
crono-1.1.0 lib/crono/config.rb
crono-1.0.3 lib/crono/config.rb
crono-1.0.2 lib/crono/config.rb
crono-1.0.1 lib/crono/config.rb
crono-1.0.0 lib/crono/config.rb
crono-1.0.0.pre3 lib/crono/config.rb
crono-1.0.0.pre2 lib/crono/config.rb