Sha256: 78a595ce6b9a969cc0527e5f52e8a5dc17e88dee29bda3bebdc07a3fa3f307ed

Contents?: true

Size: 541 Bytes

Versions: 69

Compression:

Stored size: 541 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

69 entries across 69 versions & 21 rubygems

Version Path
god-0.7.0 test/configs/task/task.god
god-0.6.0 test/configs/task/task.god
god-0.7.13 test/configs/task/task.god
god-0.7.12 test/configs/task/task.god
god-0.7.3 test/configs/task/task.god
god-0.7.5 test/configs/task/task.god
god-0.7.6 test/configs/task/task.god
god-0.7.7 test/configs/task/task.god
god-0.7.8 test/configs/task/task.god