remove deprecated

This commit is contained in:
Dzmitry Plashchynski
2022-05-29 21:18:07 +03:00
parent 5831e040fc
commit abbae2bb33
11 changed files with 13 additions and 39 deletions

View File

@@ -3,6 +3,7 @@ module Crono
end
require 'rails'
require 'sprockets/railtie'
require 'active_support/all'
require 'crono/version'
require 'crono/engine'

View File

@@ -50,25 +50,11 @@ module Crono
def setup_log
if config.daemonize
self.logfile = config.logfile
elsif config.deprecated_daemonize
self.logfile = config.logfile
deprecated_daemonize
else
self.logfile = STDOUT
end
end
def deprecated_daemonize
::Process.daemon(true, true)
[$stdout, $stderr].each do |io|
File.open(config.logfile, 'ab') { |f| io.reopen(f) }
io.sync = true
end
$stdin.reopen('/dev/null')
end
def write_pid
return unless config.pidfile
pidfile = File.expand_path(config.pidfile)
@@ -150,10 +136,6 @@ module Crono
config.process_name = process_name
end
opts.on("-d", "--[no-]daemonize", "Deprecated! Instead use crono [start|stop|restart] without this option; Daemonize process (Default: #{config.daemonize})") do |daemonize|
config.deprecated_daemonize = daemonize
end
opts.on("-m", "--monitor", "Start monitor process for a deamon (Default #{config.monitor})") do
config.monitor = true
end

View File

@@ -8,7 +8,7 @@ module Crono
PROCESS_NAME = 'crono'
attr_accessor :cronotab, :logfile, :pidfile, :piddir, :process_name,
:monitor, :daemonize, :deprecated_daemonize, :environment
:monitor, :daemonize, :environment
def initialize
self.cronotab = CRONOTAB
@@ -16,7 +16,6 @@ module Crono
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
@@ -28,7 +27,7 @@ module Crono
end
def pidfile
@pidfile || (deprecated_daemonize ? PIDFILE : nil)
@pidfile
end
end
end