Class: Pra::App
- Inherits:
-
Object
- Object
- Pra::App
- Defined in:
- lib/pra/app.rb
Instance Method Summary collapse
- #fetch_and_refresh_pull_requests ⇒ Object
- #pull_request_fetcher_thread ⇒ Object
- #run ⇒ Object
- #spawn_pull_request_fetcher ⇒ Object
Instance Method Details
#fetch_and_refresh_pull_requests ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pra/app.rb', line 24 def fetch_and_refresh_pull_requests @window_system.fetching_pull_requests new_pull_requests = [] Pra::PullRequestService.fetch_pull_requests do |fetch| fetch.on_success do |pull_requests| new_pull_requests += pull_requests end fetch.on_error do |error| Pra::ErrorLog.log(error) @window_system.fetch_failed end end @window_system.refresh_pull_requests(new_pull_requests) Kernel.sleep(5 * 60) end |
#pull_request_fetcher_thread ⇒ Object
44 45 46 47 48 |
# File 'lib/pra/app.rb', line 44 def pull_request_fetcher_thread while( true ) do fetch_and_refresh_pull_requests end end |
#run ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/pra/app.rb', line 11 def run @window_system = Pra::WindowSystemFactory.build('curses') @window_system.setup spawn_pull_request_fetcher @window_system.run_loop end |
#spawn_pull_request_fetcher ⇒ Object
20 21 22 |
# File 'lib/pra/app.rb', line 20 def spawn_pull_request_fetcher Thread.new { pull_request_fetcher_thread } end |