lib/exercism.rb in exercism-0.0.1 vs lib/exercism.rb in exercism-0.0.2
- old
+ new
@@ -1,5 +1,40 @@
-require "exercism/version"
+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'
-module Exercism
- # Your code goes here...
+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