Sha256: b4ab36fd432de9e179aa4a6c9075daabe999c37bbca9b1b293c5a8d7dc7c9f60
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module Jets::Git class Local include GitCli extend Memoist def params return {} unless git? && git_branch params = { git_system: 'local', git_branch: git_branch, git_sha: git_sha, git_dirty: git_dirty?, git_message: git_message, git_version: git_version, } params[:git_url] = git_url if git_url params end def git_message git "log -1 --pretty=%B" end def git_branch git "rev-parse --abbrev-ref HEAD" end def git_sha git "rev-parse HEAD" end def git_url # IE: git "config --get remote.origin.url" git "config --get remote.#{git_remote}.url" end def git_dirty? !git("status --porcelain").empty? end def git_version git "--version", on_error: :raise end # discover git remote name. in case it's not origin def git_remote # 2>&1 to suppress error message # "fatal: not a git repository (or any parent up to mount point /path)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n" `git remote 2>&1` return unless $?.success? `git remote`.strip # IE: origin or blank string end memoize :git_remote end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jets-git-0.2.1 | lib/jets/git/local.rb |
jets-git-0.2.0 | lib/jets/git/local.rb |