class GhIssues::GitHub
I retrieve the GitHub
user name and repository name from a local repository.
Attributes
repository[R]
user[R]
Public Class Methods
new(folder)
click to toggle source
@param [String] full path of the local repository
# File lib/gh-issues/github.rb, line 25 def initialize folder hidden_git = File.join(folder, '.git') raise NoGitError unless File.directory?(hidden_git) config_file = File.join(hidden_git, 'config') raise NoConfigError unless File.file?(config_file) input = IO.readlines(config_file) url_line = '' input.each {|line| url_line = line if line =~ / *url *=/} raise BadConfigError if url_line.empty? /(?<repository>[\w-]+)\.git$/ =~ url_line @repository = repository /git@github\.com:(?<user>\w+)/ =~ url_line @user = user end