Module: Opensource::Owner

Extended by:
Owner
Included in:
Owner
Defined in:
lib/opensource/owner.rb

Instance Method Summary collapse

Instance Method Details

#get_credentialsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/opensource/owner.rb', line 19

def get_credentials
  user = {}

  IO.foreach(File.expand_path("~/.osrc")) do |line|
    current_line = line.strip
    if !current_line.empty?
      key, value = current_line.split(':')
      user[key.strip] = value.strip
    end
  end

  user
end

#set_credentialsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/opensource/owner.rb', line 5

def set_credentials
  puts "Enter full name: "
  name = gets.chomp
  puts "Enter email address: "
  email = gets.chomp

  f = File.new(File.expand_path("~/.osrc"), "w")
  f.write <<-CREDENTIALS
    name: #{name}
    email: #{email}
  CREDENTIALS
  f.close
end