class Trop::InfoGit::GitProject

Public Class Methods

commit_id() click to toggle source
# File lib/trop/infogit.rb, line 42
def self.commit_id
  commit_id = `git show --format='%H' -q`
  return commit_id
end
project_git_info(projectdir = '.') click to toggle source
# File lib/trop/infogit.rb, line 29
def self.project_git_info(projectdir = '.')
  Dir.chdir(File.absolute_path(projectdir)) do
    @project_git_repo = `git config --get remote.origin.url`.chomp
    @project_git_name = @project_git_repo.to_s.split('/').last.gsub(/.git$/, '') unless @project_git_repo.empty?

    @project_username = `git config --get user.name`.chomp
    @project_useremail = `git config --get user.email`.chomp
    puts 'Project repo: #{@project_git_repo}'.blue if Sh.verbose?

    return @project_git_name, @project_git_repo, @project_username, @project_useremail
  end
end