Sha256: 5b485a76d5db492dc8c49f6e2867b696d750441eb1e254a1eb7061b17bfe6e79
Contents?: true
Size: 874 Bytes
Versions: 3
Compression:
Stored size: 874 Bytes
Contents
require 'fileutils' require 'json' module Radon class Util def self.first_run return if (File.directory?(SETTINGS_DIR) && File.exist?(SETTINGS_FILE)) puts "Performing first time setup..." # Make settings dir FileUtils.mkdir_p(SETTINGS_DIR) vprint("Creating #{SETTINGS_DIR}") puts "Welcome to radon! It looks like it's your first time running radon." email = ask " Email: " gh_uname = ask " GitHub username: " data = { :email => email, :username => gh_uname } File.write(File.join(SETTINGS_DIR, 'settings.json'), JSON.pretty_generate(data)) vprint "Writing settings to #{File.join(SETTINGS_DIR, 'settings.json')}" end def self.get_email JSON.parse(File.read(SETTINGS_FILE))['email'] end def self.get_github_username JSON.parse(File.read(SETTINGS_FILE))['username'] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radon-0.1.6 | lib/core/util.rb |
radon-0.1.5 | lib/core/util.rb |
radon-0.1.4 | lib/core/util.rb |