Sha256: b6d2e879449c3d96509ae509aeba0d983564bcfef73c7da2d5ad89c3d68d59cf

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 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.url
    if ENV['EXERCISM_ENV'] == 'test'
      'http://localhost:4567'
    else
      'http://exercism.herokuapp.com'
    end
  end

  def self.home
    Dir.home(Etc.getlogin)
  end

  def self.login(github_username, key)
    data = {'github_username' => github_username, 'key' => key}
    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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exercism-0.0.4 lib/exercism.rb
exercism-0.0.3 lib/exercism.rb