Class: Autostager::CLI
Overview
Start and run the autostager in a loop.
Instance Method Summary collapse
-
#run ⇒ Object
Entry point for the app.
-
#sleep_interval ⇒ Object
rubocop:enable MethodLength.
- #trap_interrupt ⇒ Object
Methods included from Logger
Instance Method Details
#run ⇒ Object
Entry point for the app. Stage pull requests on a 30-second loop. rubocop:disable MethodLength
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/autostager/cli.rb', line 11 def run trap_interrupt loop do Autostager.run if sleep_interval > 0 log "Sleep for #{sleep_interval} seconds." sleep sleep_interval else exit!(0) end end rescue Interrupt log 'Exit on interrupt' exit!(0) end |
#sleep_interval ⇒ Object
rubocop:enable MethodLength
28 29 30 |
# File 'lib/autostager/cli.rb', line 28 def sleep_interval ENV['sleep_interval'].to_i || 30 end |
#trap_interrupt ⇒ Object
32 33 34 35 36 37 |
# File 'lib/autostager/cli.rb', line 32 def trap_interrupt Signal.trap('INT') do log 'Exit on interrupt' exit!(0) end end |