Class: Jenkins::CiOrg::Credential
- Inherits:
-
Object
- Object
- Jenkins::CiOrg::Credential
- Defined in:
- lib/jenkins/jenkins-ci.org/credential.rb
Overview
credential to access jenkins-ci.org TODO: move it elsewhere
Constant Summary collapse
- CREDENTIAL =
File.("~/.jenkins-ci.org")
Instance Method Summary collapse
-
#has_credential? ⇒ Boolean
do we already have the credential?.
-
#initialize ⇒ Credential
constructor
A new instance of Credential.
- #password ⇒ Object
- #user_name ⇒ Object
Constructor Details
#initialize ⇒ Credential
Returns a new instance of Credential.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jenkins/jenkins-ci.org/credential.rb', line 8 def initialize @props = {} if File.exists?(CREDENTIAL) then File.open(CREDENTIAL,'r') do |f| f.each_line do |l| if l[0]=='#' then return # comment end k,v = l.split("=",2) @props[k]=v.strip end end end end |
Instance Method Details
#has_credential? ⇒ Boolean
do we already have the credential?
26 27 28 |
# File 'lib/jenkins/jenkins-ci.org/credential.rb', line 26 def has_credential? @props["userName"] && @props["password"] end |
#password ⇒ Object
34 35 36 |
# File 'lib/jenkins/jenkins-ci.org/credential.rb', line 34 def password @props["password"] end |
#user_name ⇒ Object
30 31 32 |
# File 'lib/jenkins/jenkins-ci.org/credential.rb', line 30 def user_name @props["userName"] end |