Sha256: ff5150c6267612247ee76f62ff3e006fca933b986deff03e3f19ddaff1c79542
Contents?: true
Size: 947 Bytes
Versions: 4
Compression:
Stored size: 947 Bytes
Contents
module Glman module Repos class GitRepo def remote_origin_ssh_url %x[git remote -v].split("\t").select{ |c| c.include?('(push)')}.first.gsub('(push)', '').gsub("\n", '').strip rescue nil end def repository_name remote_origin_ssh_url.split(':').last.gsub('.git','') rescue nil end def current_branch %x[git br].split("\n").select{ |c| c.include?('*')}.first.gsub('*','').strip rescue nil end def last_commit_message %x[git log -1].split("\n").select{|c| c.include?('Subject:')}.first.gsub('Subject:','').strip rescue nil end def user_name %x[git config user.name] end def user_email %x[git config user.email] end def push(origin, branch) cmd = "git push #{origin} #{branch}" %x[#{cmd}] rescue nil end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
glman-0.1.3 | lib/glman/repos/git_repo.rb |
glman-0.1.2 | lib/glman/repos/git_repo.rb |
glman-0.1.1 | lib/glman/repos/git_repo.rb |
glman-0.1.0 | lib/glman/repos/git_repo.rb |