Sha256: 1acff2b4fcca832049cddc9ad7d95e6417cf7403a709fbda6647ff5120004463
Contents?: true
Size: 740 Bytes
Versions: 9
Compression:
Stored size: 740 Bytes
Contents
module Instapusher2 class Git def current_branch result = %x{git branch}.split("\n") if result.empty? raise "It seems your app is not a git repo" else result.select { |b| b =~ /^\*/ }.first.split(" ").last.strip end end def current_user `git config user.name`.chop! end def project_name result = `git config remote.origin.url`.chop!.scan(/\/([^\/]+)?$/).flatten.first result.sub!(/\.git$/, '') if result result ||= File.basename(Dir.getwd) result end def repo_owner string = `git remote -v | grep fetch | grep origin` regex = /.*:(.*)\/.*/ match_data = string.match(regex) match_data.to_a.last end end end
Version data entries
9 entries across 9 versions & 2 rubygems