Module: DeployInfo::Git
Overview
> This is the Git Module. It interacts with Git resources.
Instance Method Summary collapse
- #ghclient ⇒ Object
-
#revision ⇒ Object
rubocop: disable AbcSize.
Instance Method Details
#ghclient ⇒ Object
20 21 22 23 |
# File 'lib/deploy-info/git.rb', line 20 def ghclient # => Instantiate a new GitHub Client Github::Client.new end |
#revision ⇒ Object
rubocop: disable AbcSize
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 |