Sha256: c900dbf3cca1ead38e84d0290cba1ab4f47347ece9ce0c730404ff2b57384722

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 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, 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

1 entries across 1 versions & 1 rubygems

Version Path
exercism-0.0.5 lib/exercism.rb