Sha256: aca1eda7cbd961523543b1b136e9534ebb955974d3c013868282e34a03398fe9

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 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, :environment

    def initialize
      self.cronotab = CRONOTAB
      self.logfile  = LOGFILE
      self.piddir = PIDDIR
      self.process_name = PROCESS_NAME
      self.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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crono-2.1.0 lib/crono/config.rb
crono-2.0.1 lib/crono/config.rb
crono-2.0.0 lib/crono/config.rb