Class: Cipr::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/cipr.rb

Class Method Summary collapse

Class Method Details

.go(repo, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cipr.rb', line 7

def self.go(repo, options={})
  wait_time = 1
  c = Cipr::Repo.new(repo, options)

  begin
    sleep 1
    while true
      puts "Checking for Pull Requests..."
      restart_on_interrupt = true
      if c.test > 0
        wait_time = 2
      else
        wait_time += 2 if wait_time < 30
      end
      
      sleep 60*wait_time
    end
  rescue Interrupt => i
    if restart_on_interrupt
      restart_on_interrupt = false
      puts "Hit ^C again to quit"
      retry 
    end
  end
end