Module: GithubRunDeck::Git

Extended by:
Git
Included in:
Git
Defined in:
lib/github-rundeck/git.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#ghclientObject



20
21
22
23
# File 'lib/github-rundeck/git.rb', line 20

def ghclient
  # => Instantiate a new GitHub Client
  Github::Client.new
end

#reposObject



25
26
27
# File 'lib/github-rundeck/git.rb', line 25

def repos
  ghclient.repos
end

#revisionObject

rubocop: disable AbcSize



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/github-rundeck/git.rb', line 33

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

#tagsObject



29
30
31
# File 'lib/github-rundeck/git.rb', line 29

def tags
  ghclient.tags
end