lib/exercism.rb in exercism-0.0.18 vs lib/exercism.rb in exercism-0.0.19
- old
+ new
@@ -1,47 +1,53 @@
require 'rubygems' if RUBY_VERSION <= "1.8.7"
require 'etc'
require 'json'
require 'yaml'
require 'fileutils'
-require 'faraday'
+
+old_warn, $-w = $-w, nil
+begin
+ require 'faraday'
+ensure
+ $-w = old_warn
+end
+
require 'exercism/version'
+require 'exercism/env'
require 'exercism/config'
require 'exercism/user'
require 'exercism/assignment'
+require 'exercism/submission'
require 'exercism/api'
class Exercism
def self.home
- if ENV["OS"] == 'Windows_NT' then
- ENV["HOMEDRIVE"]+ENV["HOMEPATH"]
- else
- return File.expand_path('~') if RUBY_VERSION <= "1.8.7"
- Dir.home(Etc.getlogin)
- end
+ @home ||= Env.home
end
- def self.login(github_username, key, dir)
+ def self.login(github_username, key, dir, config_path)
data = {
'github_username' => github_username,
'key' => key,
'project_dir' => dir
}
- Config.write(home, data)
- User.new(github_username, key)
+ Config.write(config_path, data)
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
+ def self.alternate_config_path
+ Config.alternate_path
+ end
+
+ def self.config
+ Config.read(home)
+ end
end