Class: Reposit::CredentialsSetter

Inherits:
Object
  • Object
show all
Defined in:
lib/reposit.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCredentialsSetter



106
107
108
# File 'lib/reposit.rb', line 106

def initialize
  @username, @api_key = "", ""
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



104
105
106
# File 'lib/reposit.rb', line 104

def api_key
  @api_key
end

#usernameObject

Returns the value of attribute username.



104
105
106
# File 'lib/reposit.rb', line 104

def username
  @username
end

Class Method Details

.runObject



110
111
112
# File 'lib/reposit.rb', line 110

def self.run
  new.run
end

Instance Method Details

#runObject



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_credentialsObject



122
123
124
125
126
127
# File 'lib/reposit.rb', line 122

def write_credentials
  File.open(File.expand_path('~') + '/.reposit', 'w+') do |f|
    f.puts username
    f.write api_key
  end
end