Sha256: 31ed83bb8d05826e452948c1b0fdf0a5cb3280ebb29b9ad3bb62519577eddbc8

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

module Instapusher
  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

2 entries across 2 versions & 1 rubygems

Version Path
instapusher-0.1.0 lib/instapusher/git.rb
instapusher-0.0.34 lib/instapusher/git.rb