class Roper::Hub

This class is concerned with GitHub API communications.

Public Class Methods

create(repo, ref, options = {}) click to toggle source
# File lib/roper/hub.rb, line 33
def self.create(repo, ref, options = {})
  if options["disable-hub"]
    DumbHub.new(repo, ref)
  else
    self.new(repo, ref)
  end
end
new(repo, ref) click to toggle source

Create and instance of the Hub class

@param [String] repo A GitHub reposiory in the form <user>/<name> @param [String] ref The sha for a commit

# File lib/roper/hub.rb, line 14
def initialize(repo, ref)
  @repo = repo
  @ref = ref
  @client = Octokit::Client.new(netrc: true)
end

Public Instance Methods

create_status(state, options = {}) click to toggle source

Changes the status on a GitHub PR

@see octokit.github.io/octokit.rb/Octokit/Client/Statuses.html

@param state [String] The state: pending, success, failure

@param options [Hash] A customizable set of options @option options [String] :target_url A link to the built site @option options [String] :description A short human-readable description of this status

# File lib/roper/hub.rb, line 29
def create_status(state, options = {})
  @client.create_status(@repo, @ref, state, options.merge(context: "roper"))
end