Class: Give::User

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/give.rb

Overview

Give::User

Essentially a github user, relies on username and token existing in gitconfig help.github.com/set-your-user-name-email-and-github-token/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commands

#git, #sh

Constructor Details

#initialize(endpoint = github) ⇒ User

Returns a new instance of User.



114
115
116
117
# File 'lib/give.rb', line 114

def initialize(endpoint=github)
  @login, @token, @endpoint = , github_token, endpoint
  configure
end

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



113
114
115
# File 'lib/give.rb', line 113

def endpoint
  @endpoint
end

#loginObject

Returns the value of attribute login.



113
114
115
# File 'lib/give.rb', line 113

def 
  @login
end

#tokenObject

Returns the value of attribute token.



113
114
115
# File 'lib/give.rb', line 113

def token
  @token
end

Instance Method Details

#configureObject



119
120
121
122
123
124
125
# File 'lib/give.rb', line 119

def configure
  Octokit.configure do |conf|
    conf. = 
    conf.token = token
    conf.endpoint = endpoint
  end
end

#githubObject



127
128
129
# File 'lib/give.rb', line 127

def github
  "https://github.com"
end

#github_loginObject



131
132
133
# File 'lib/give.rb', line 131

def 
 git('config --get-all github.user')
end

#github_tokenObject



135
136
137
# File 'lib/give.rb', line 135

def github_token
  git('config --get-all github.token')
end