Class: Pushpop::CLI
- Inherits:
-
Thor
- Object
- Thor
- Pushpop::CLI
- Defined in:
- lib/pushpop/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.file_options ⇒ Object
9 10 11 |
# File 'lib/pushpop/cli.rb', line 9 def self. option :file, :aliases => '-f' end |
Instance Method Details
#describe_jobs ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/pushpop/cli.rb', line 26 def describe_jobs Dotenv.load Pushpop.require_file([:file]) Pushpop.jobs.tap do |jobs| jobs.each do |job| puts job.name end end end |
#run_jobs ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/pushpop/cli.rb', line 50 def run_jobs Dotenv.load Pushpop.require_file([:file]) Pushpop.schedule threads = [] threads << Pushpop.start_clock Pushpop.web.app.traps = false web_thread = Pushpop.start_webserver threads << web_thread if web_thread # Listen to exit signals, so the CLI doesn't hang infinitely on clock [:INT, :TERM].each do |signal| trap(signal) do threads.each do |thread| thread.exit end end end # Wait for both the clock thread and the sinatra thread to close before exiting ThreadsWait.all_waits(threads) do threads.each do |thread| thread.exit end end end |
#run_jobs_once ⇒ Object
40 41 42 43 44 |
# File 'lib/pushpop/cli.rb', line 40 def run_jobs_once Dotenv.load Pushpop.require_file([:file]) Pushpop.run end |