class Cp8Cli::Repo

Attributes

path[R]

Public Class Methods

current() click to toggle source
# File lib/cp8_cli/repo.rb, line 3
def self.current
  path = Command.read("git config --get remote.origin.url").match(/github.com[:\/](\S+\/\S+)\.git/)[1]
  new(path)
end
new(path) click to toggle source
# File lib/cp8_cli/repo.rb, line 8
def initialize(path)
  @path = path
end

Public Instance Methods

shorthand() click to toggle source
# File lib/cp8_cli/repo.rb, line 12
def shorthand
  "#{user}/#{name}"
end
url() click to toggle source
# File lib/cp8_cli/repo.rb, line 16
def url
  "https://github.com/#{shorthand}"
end
user() click to toggle source
# File lib/cp8_cli/repo.rb, line 20
def user
  path.split('/').first
end

Private Instance Methods

name() click to toggle source
# File lib/cp8_cli/repo.rb, line 28
def name
  path.split('/').last
end