Class: Reposit::CredentialsSetter
- Inherits:
-
Object
- Object
- Reposit::CredentialsSetter
- Defined in:
- lib/reposit.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CredentialsSetter
constructor
A new instance of CredentialsSetter.
- #run ⇒ Object
- #write_credentials ⇒ Object
Constructor Details
#initialize ⇒ CredentialsSetter
106 107 108 |
# File 'lib/reposit.rb', line 106 def initialize @username, @api_key = "", "" end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
104 105 106 |
# File 'lib/reposit.rb', line 104 def api_key @api_key end |
#username ⇒ Object
Returns the value of attribute username.
104 105 106 |
# File 'lib/reposit.rb', line 104 def username @username end |
Class Method Details
.run ⇒ Object
110 111 112 |
# File 'lib/reposit.rb', line 110 def self.run new.run end |
Instance Method Details
#run ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/reposit.rb', line 114 def run print "GitHub username: " self.username = $stdin.gets.chomp print "API Key: " self.api_key = $stdin.gets.chomp write_credentials end |
#write_credentials ⇒ Object
122 123 124 125 126 127 |
# File 'lib/reposit.rb', line 122 def write_credentials File.open(File.('~') + '/.reposit', 'w+') do |f| f.puts username f.write api_key end end |