lib/kryten/runner.rb in kryten-0.3.0 vs lib/kryten/runner.rb in kryten-0.3.1
- old
+ new
@@ -11,18 +11,23 @@
Signal.trap("INT", proc { stop_running })
Signal.trap("TERM", proc { stop_running })
end
def start
+ before_setup
setup
+ after_setup
+
log "started"
@started = true
while started do
sleep timer
@running = true
+ before_run
run
+ after_run
@running = false
end
log "stopped"
true
@@ -63,10 +68,13 @@
running ? 'running' : 'sleeping'].join
started
end
# hook methods
- def shutdown; nil; end
-
+ def before_setup; nil; end
+ def after_setup; nil; end
+ def before_run; nil; end
def run; nil; end
+ def after_run; nil; end
+ def shutdown; nil; end
end