class LearnTest::RepoParser
Public Class Methods
die()
click to toggle source
# File lib/learn_test/repo_parser.rb, line 23 def self.die exit end
get_repo()
click to toggle source
# File lib/learn_test/repo_parser.rb, line 7 def self.get_repo begin repo = ::Git.open(FileUtils.pwd) rescue puts "You don't appear to be in a Learn lesson's directory. Please enter 'learn open' or cd to an appropriate directory and try again." die end if url = repo.remote.url url.match(/(?:https?:\/\/|git@).*\/(.+?)(?:\.git)?$/)[1] else puts "You don't appear to be in a Learn lesson's directory. Please enter 'learn open' or cd to an appropriate directory and try again." die end end