module DeployInfo::Git

> This is the Git Module. It interacts with Git resources.

Public Instance Methods

ghclient() click to toggle source
# File lib/deploy-info/git.rb, line 20
def ghclient
  # => Instantiate a new GitHub Client
  Github::Client.new
end
revision() click to toggle source
# File lib/deploy-info/git.rb, line 25
def revision # rubocop: disable AbcSize
  # => Grab the Supplied Revision
  rev = Config.query_params['revision'] || return
  return rev unless Config.query_params['gh_repo']

  # => Break down the Params
  org, repo = Config.query_params['gh_repo'].split('/').map { |r| String(r) }
  return rev unless org && repo

  begin
    # => Pull the Shorthand SHA
    ghclient.git_data.trees.get(org, repo, rev).first[1][0, 7]
  rescue Github::Error::NotFound
    # => Return the Supplied Revision if Github Borks
    rev
  end
end