Class: LearnTest::RepoParser

Inherits:
Object
  • Object
show all
Defined in:
lib/learn_test/repo_parser.rb

Class Method Summary collapse

Class Method Details

.dieObject



17
18
19
# File 'lib/learn_test/repo_parser.rb', line 17

def self.die
  exit
end

.get_repoObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/learn_test/repo_parser.rb', line 5

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