Sha256: bfde5bcc77ad8351fbc8265b88ada61fc02caa079aec7615431fa7370fbf069b
Contents?: true
Size: 1.22 KB
Versions: 8
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: false require_relative 'shell_deb_verb' module Trop module InfoGit class User attr_accessor :user_name, :user_email def initialize @user_name ||= `git config --get --global user.name` @user_mail ||= `git config --get --global user.email` end def self.user_name initialize @user_name.chomp! end def self.user_mail initialize @user_mail.chomp! end end class GitProject 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 def self.commit_id commit_id = `git show --format='%H' -q` return commit_id end end end end
Version data entries
8 entries across 8 versions & 1 rubygems