class GitPunch::User
Constants
- EVERYTHING_BUT_THE_OWNER
Attributes
token[R]
Public Class Methods
from_config()
click to toggle source
# File lib/git_punch/user.rb, line 35 def self.from_config username = `git config punch.username` api_key = `git config punch.token` new name: username, token: api_key end
from_origin()
click to toggle source
# File lib/git_punch/user.rb, line 22 def self.from_origin remote = `git remote show origin` raise "No origin configured" if remote.empty? line = remote.split("\n").select { |l| l =~ /Fetch URL/ }.first owner = if line =~ /\A(.*)\:(.*)\.git\Z/ $2.split('/')[-2] else "" end new name: owner end
new(from_options={})
click to toggle source
# File lib/git_punch/user.rb, line 8 def initialize from_options={} from_options.each do |key,value| instance_variable_set "@#{key}", value end end
Public Instance Methods
credentials()
click to toggle source
# File lib/git_punch/user.rb, line 42 def credentials { username: name, password: token } end
name()
click to toggle source
# File lib/git_punch/user.rb, line 14 def name @name.strip end
present?()
click to toggle source
# File lib/git_punch/user.rb, line 18 def present? not name.empty? end