Sha256: 0065d91451cfe54451fdce025a55c75c4f2c15cf581b46ac728f33d36b310fa5

Contents?: true

Size: 344 Bytes

Versions: 5

Compression:

Stored size: 344 Bytes

Contents

require 'git'

module Learn
  class RepoParser
    def self.get_repo
      begin
        repo = Git.open(FileUtils.pwd)
      rescue
        puts "Not a valid Git repository"
        die
      end

      url = repo.remote.url
      url.match(/(?:https:\/\/|git@).*\/(.+?)(?:\.git)?$/)[1]
    end

    def self.die
      exit
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
learn-co-1.0.4 lib/learn/repo_parser.rb
learn-co-1.0.3 lib/learn/repo_parser.rb
learn-co-1.0.2 lib/learn/repo_parser.rb
learn-co-1.0.1 lib/learn/repo_parser.rb
learn-co-1.0.0 lib/learn/repo_parser.rb