Class: Exercism

Inherits:
Object
  • Object
show all
Defined in:
lib/cli.rb,
lib/exercism.rb,
lib/exercism/api.rb,
lib/exercism/config.rb,
lib/exercism/version.rb,
lib/exercism/assignment.rb

Defined Under Namespace

Classes: Api, Assignment, CLI, Config

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.configObject



32
33
34
# File 'lib/exercism.rb', line 32

def self.config
  @config ||= Config.read(home)
end

.homeObject



22
23
24
# File 'lib/exercism.rb', line 22

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

.login(github_username, key) ⇒ Object



26
27
28
29
30
# File 'lib/exercism.rb', line 26

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

.urlObject



14
15
16
17
18
19
20
# File 'lib/exercism.rb', line 14

def self.url
  if ENV['EXERCISM_ENV'] == 'test'
    'http://localhost:4567'
  else
    'http://exercism.herokuapp.com'
  end
end

.userObject



36
37
38
# File 'lib/exercism.rb', line 36

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