exercism 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/README.md +2 -0
- data/lib/cli.rb +17 -20
- data/lib/exercism.rb +2 -2
- data/lib/exercism/api.rb +1 -1
- data/lib/exercism/config.rb +1 -3
- data/lib/exercism/version.rb +1 -1
- data/test/exercism_test.rb +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -29,6 +29,8 @@ This submits `example.rb` on your current assignment.
|
|
29
29
|
|
30
30
|
Reveals stack traces on errors.
|
31
31
|
|
32
|
+
By default, Exercism will create a config file in the base of your home directory, i.e. `~/.exercism`. This file can be moved to `~/.config/exercism` if desired.
|
33
|
+
|
32
34
|
## Contributing
|
33
35
|
|
34
36
|
1. Fork it
|
data/lib/cli.rb
CHANGED
@@ -77,26 +77,7 @@ class Exercism
|
|
77
77
|
def login
|
78
78
|
require 'exercism'
|
79
79
|
|
80
|
-
username
|
81
|
-
key = ask("Your exercism.io API key:")
|
82
|
-
default_dir = FileUtils.pwd
|
83
|
-
say "What is your exercism exercises project path?"
|
84
|
-
say "Press Enter to select the default (#{default_dir}):\n"
|
85
|
-
dir = ask ">"
|
86
|
-
if dir.empty?
|
87
|
-
dir = default_dir
|
88
|
-
end
|
89
|
-
project_dir = File.expand_path(dir)
|
90
|
-
|
91
|
-
say "Where do you want your configuration stored? (type a number)"
|
92
|
-
say "1. #{File.join(Exercism.home, '.exercism')}"
|
93
|
-
say "2. #{File.join(Exercism.home, '.config', 'exercism')}"
|
94
|
-
|
95
|
-
if ask(">").to_i == 2
|
96
|
-
Exercism.login username, key, project_dir, File.join(Exercism.home, '.config')
|
97
|
-
else
|
98
|
-
Exercism.login username, key, project_dir, Exercism.home
|
99
|
-
end
|
80
|
+
Exercism.login username, key, project_dir
|
100
81
|
|
101
82
|
say("Your credentials have been written to #{Exercism.config.file}")
|
102
83
|
end
|
@@ -119,6 +100,22 @@ class Exercism
|
|
119
100
|
|
120
101
|
private
|
121
102
|
|
103
|
+
def username
|
104
|
+
ask("Your GitHub username:")
|
105
|
+
end
|
106
|
+
|
107
|
+
def key
|
108
|
+
ask("Your exercism.io API key:")
|
109
|
+
end
|
110
|
+
|
111
|
+
def project_dir
|
112
|
+
default_dir = FileUtils.pwd
|
113
|
+
say "What is your exercism exercises project path?"
|
114
|
+
say "Press Enter to select the default (#{default_dir}):\n"
|
115
|
+
dir = ask ">", :default => default_dir
|
116
|
+
File.expand_path(dir)
|
117
|
+
end
|
118
|
+
|
122
119
|
def api(host = options[:host])
|
123
120
|
Exercism::Api.new(host, Exercism.user, Exercism.project_dir)
|
124
121
|
end
|
data/lib/exercism.rb
CHANGED
@@ -25,13 +25,13 @@ class Exercism
|
|
25
25
|
@home ||= Env.home
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.login(github_username, key, dir
|
28
|
+
def self.login(github_username, key, dir)
|
29
29
|
data = {
|
30
30
|
'github_username' => github_username,
|
31
31
|
'key' => key,
|
32
32
|
'project_dir' => dir
|
33
33
|
}
|
34
|
-
Config.write
|
34
|
+
Config.write home, data
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.user
|
data/lib/exercism/api.rb
CHANGED
data/lib/exercism/config.rb
CHANGED
data/lib/exercism/version.rb
CHANGED
data/test/exercism_test.rb
CHANGED
@@ -21,7 +21,7 @@ class ExercismTest < Minitest::Test
|
|
21
21
|
home = './test/fixtures'
|
22
22
|
Exercism.stub(:home, home) do
|
23
23
|
key = '97e9975'
|
24
|
-
Exercism.login('bob', key, '/tmp'
|
24
|
+
Exercism.login('bob', key, '/tmp')
|
25
25
|
user = Exercism.user
|
26
26
|
assert_equal 'bob', user.github_username
|
27
27
|
assert_equal key, user.key
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exercism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|