class GitRemote

Constants

REPOSITORY_PATTERN

Attributes

project[R]
user[R]

Public Class Methods

new(url = nil) click to toggle source
# File lib/pimpmychangelog/git_remote.rb, line 10
def initialize(url = nil)
  @url = url || fetch_url

  match = @url.match(REPOSITORY_PATTERN)

  @user = match[:user]
  @project = match[:repo]

  unless @user && @project
    raise "Can't extract github user and project from origin remote"
  end
end

Private Instance Methods

fetch_url() click to toggle source
# File lib/pimpmychangelog/git_remote.rb, line 27
def fetch_url
  @fetch_url ||= run_command.split(' ').last
end
run_command() click to toggle source
# File lib/pimpmychangelog/git_remote.rb, line 31
def run_command
  `git config --get remote.origin.url`
end