Module: RemoteCOB::Fire

Defined in:
lib/remote_cob.rb

Overview

This is the code for automatically checking out the matching issue in github

Class Method Summary collapse

Class Method Details

.runObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/remote_cob.rb', line 39

def self.run
  RemoteCOB.ensure_credentials_and_remote
  issue_number = ARGV[0].to_i
  paginator = Paginator.new(Credentials.new)

  while paginator.next?
    issue = paginator.issues.detect { |i| i['number'] == issue_number }

    if issue
      Git.checkout_branch(paginator.format_issue(issue))
      exit 0
    end

    puts "couldn't find issue on page: #{paginator.page}, fetching next..."

    paginator.inc
  end

  puts "couldn't find issue on github."
  exit 1
end