Sha256: c2d5403c8433ef46130090f177f35ada2ef559bd521c9ec8232e4cb684eab15a

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

require 'etc'
require 'json'
require 'yaml'
require 'fileutils'
require 'faraday'
require 'exercism/version'
require 'exercism/config'
require 'exercism/user'
require 'exercism/assignment'
require 'exercism/api'

class Exercism

  def self.home
    if ENV["OS"] == 'Windows_NT' then
      ENV["HOMEDRIVE"]+ENV["HOMEPATH"]
    else
      Dir.home(Etc.getlogin)
    end
  end

  def self.login(github_username, key, dir)
    data = {
      'github_username' => github_username,
      'key' => key,
      'project_dir' => dir
    }
    Config.write(home, data)
    User.new(github_username, key)
  end

  def self.config
    Config.read(home)
  end

  def self.user
    c = config
    User.new(c.github_username, c.key)
  end

  def self.project_dir
    config.project_dir
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exercism-0.0.16 lib/exercism.rb
exercism-0.0.15 lib/exercism.rb