Sha256: 3fd585074cd0e1d67bf859cde3db74d1614b1ef488acc8c1c8883421b16b075d
Contents?: true
Size: 534 Bytes
Versions: 12
Compression:
Stored size: 534 Bytes
Contents
LOG_DIR = File.join(File.dirname(__FILE__), *%w[logs]) God.task do |t| t.name = 'task' t.valid_states = [:ok, :clean] t.initial_state = :ok t.interval = 5 # t.clean = lambda do # Dir[File.join(LOG_DIR, '*.log')].each do |f| # File.delete(f) # end # end t.clean = "rm #{File.join(LOG_DIR, '*.log')}" t.transition(:clean, :ok) t.transition(:ok, :clean) do |on| on.condition(:lambda) do |c| c.lambda = lambda do Dir[File.join(LOG_DIR, '*.log')].size > 1 end end end end
Version data entries
12 entries across 12 versions & 3 rubygems