Cleanup and move common code to common.rb
This commit is contained in:
Родитель
2f72bce79d
Коммит
8158b24dc0
|
@ -0,0 +1,8 @@
|
|||
REGEX = %r{github\.com/([^/]+/[^/]+)/issues/(\d+)}
|
||||
# https://github.com/username/reponame/issues/2
|
||||
# -> username/reponame, 2
|
||||
def parse_issue_url(url)
|
||||
if md = REGEX.match(url)
|
||||
[md[1], md[2]]
|
||||
end
|
||||
end
|
|
@ -10,22 +10,13 @@ BANNER
|
|||
$stderr.sync = true
|
||||
require 'octokit'
|
||||
require 'optparse'
|
||||
require './common'
|
||||
|
||||
file = __FILE__
|
||||
issue_url = ARGV.first
|
||||
token = ENV['TOKEN']
|
||||
|
||||
abort banner if !issue_url || issue_url == '-h'
|
||||
|
||||
REGEX = %r{github\.com/([^/]+/[^/]+)/issues/(\d+)}
|
||||
# https://github.com/username/reponame/issues/2
|
||||
# -> username/reponame, 2
|
||||
def parse_issue_url(url)
|
||||
if md = REGEX.match(url)
|
||||
[md[1], md[2]]
|
||||
end
|
||||
end
|
||||
|
||||
Octokit.auto_paginate = true
|
||||
|
||||
client = Octokit::Client.new :access_token => ENV['GITHUBTEACHER_TOKEN']
|
||||
|
|
Загрузка…
Ссылка в новой задаче