Sha256: fb16d6b194c17bb4c5e5210d1c4d2f961680fd3bce710c1c19da40400e65d65b

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 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 ||= Config.read(home)
  end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exercism-0.0.2 lib/exercism.rb