9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/app.rb', line 9
def self.setup
unless File.exists? @config_path
new_file = File.open(@config_path, 'w')
new_file.write $DEFAULT_CONFIG
new_file.close
end
@config_file = File.open(@config_path, 'r')
@config = JSON.parse(@config_file.read)
if @config['email'].empty? or @config['pass'].empty?
abort "You have not configured your credentials yet, add them to ~/.pack"
end
@config['username'] = @config['email'][/[^@]*/]
self.api.setup(@config)
end
|