class T1k::Repositories::Github

Constants

Issue

Public Class Methods

create_issue(title) click to toggle source
# File lib/t1k/repositories/github.rb, line 23
def self.create_issue title
  begin
    puts 'Creating issue'
    github_auth = self.login
    issue       = github_auth.issues.create(user: self.user, repo: self.repo, title: title)

    issue.html_url
  rescue
    raise 'Issue not created'
  end
end
get_issue(issue_number) click to toggle source
# File lib/t1k/repositories/github.rb, line 35
def self.get_issue issue_number
  begin
    puts 'Recovering existent issue'
    github_auth = self.login
    issue       = github_auth.issues.get(user: self.user, repo: self.repo, number: issue_number)

    issue.html_url
  rescue
    raise 'Issue not recovered'
  end
end
get_issue_number(html_url) click to toggle source
# File lib/t1k/repositories/github.rb, line 47
def self.get_issue_number html_url
  code = html_url[html_url.rindex('/')+1..html_url.size]
  Issue.new(code, "Link to code: [#{code}](#{html_url})")
end
login() click to toggle source
# File lib/t1k/repositories/github.rb, line 52
def self.login
  ::Github.new(oauth_token: self.oauth_token)
end
setup() { |self| ... } click to toggle source
# File lib/t1k/repositories/github.rb, line 56
def self.setup &block
  yield(self) if block_given?
end
valid_keys?() click to toggle source
# File lib/t1k/repositories/github.rb, line 60
def self.valid_keys?
  begin
    me = self.login.users.get
    @@messages << "Wecolme #{me.name} - Github"
    return true
  rescue Exception => e
    @@errors << e.message
    return false
  end
end