exercism 0.0.27 → 0.0.28

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.
@@ -13,3 +13,17 @@ rescue StandardError => e
13
13
  puts
14
14
  raise e if ENV['EXERCISM_ENV'] =~ /test|development/
15
15
  end
16
+
17
+ puts <<-DEPRECATED
18
+
19
+ The exercism ruby gem has been deprecated.
20
+
21
+ Please uninstall the gem, and install the latest CLI
22
+ from https://github.com/exercism/cli/releases/latest
23
+
24
+ For more info about getting started with the CLI, see
25
+ http://exercism.io/help/how-to-access-exercises
26
+
27
+ Thanks!
28
+
29
+ DEPRECATED
data/lib/cli.rb CHANGED
@@ -122,6 +122,20 @@ class Exercism
122
122
  puts "You are not logged in."
123
123
  end
124
124
 
125
+ desc "current", "Get the current exercise that you are on"
126
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
127
+ def current
128
+ require 'exercism'
129
+
130
+ result = Exercism::Api.new(options[:host], Exercism.user).current
131
+ body = JSON.parse(result.body)
132
+ puts "Current Assignments"
133
+ body['assignments'].each do |assignment|
134
+ track = assignment['track']
135
+ puts "Language: " + track.ljust(17) + "Exercise: " + assignment['slug']
136
+ end
137
+ end
138
+
125
139
  desc "stash [SUBCOMMAND]", "Stash or apply code that is in-progress"
126
140
  subcommand "stash", Stash
127
141
 
@@ -166,7 +180,12 @@ class Exercism
166
180
  end
167
181
  end
168
182
  end
169
- end
170
183
 
171
-
184
+ def spacing(track)
185
+ len = 17 - track.length
186
+ space = ''
187
+ len.times {space += ' '}
188
+ space
189
+ end
190
+ end
172
191
  end
@@ -70,6 +70,13 @@ class Exercism
70
70
  JSON.parse(response.body)
71
71
  end
72
72
 
73
+ def current
74
+ conn.get do |req|
75
+ req.url endpoint('user/assignments/current')
76
+ req.params = {:key => user.key}
77
+ end
78
+ end
79
+
73
80
  private
74
81
 
75
82
  def get_stash(action, filename)
@@ -1,3 +1,3 @@
1
1
  class Exercism
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.28"
3
3
  end
@@ -75,6 +75,16 @@ class ApiTest < Minitest::Test
75
75
  end
76
76
  end
77
77
 
78
+ def test_get_current_assignments
79
+ Exercism.stub(:home, home) do
80
+ VCR.use_cassette('alice-gets-current-assignments') do
81
+ response = Exercism::Api.new('http://localhost:4567', Exercism.user).current
82
+ body = JSON.parse(response.body)
83
+ assert_equal 200, response.status
84
+ end
85
+ end
86
+ end
87
+
78
88
  def test_save_stash_to_api
79
89
  submission = File.join(FileUtils.pwd, 'bob.rb')
80
90
  File.open(submission, 'w') do |f|
@@ -116,6 +126,4 @@ class ApiTest < Minitest::Test
116
126
  end
117
127
  end
118
128
  end
119
-
120
-
121
129
  end
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:4567/api/v1/user/assignments/current?key=634abfb095ed621e1c793c9875fcd9fda455ea90
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - github.com/kytrinyx/exercism CLI v0.0.26
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - ! '*/*'
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '18'
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ Set-Cookie:
28
+ - rack.session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiJFY2UzMTdhMTc3ZjlkMTZkYjc1ZjFk%0AMDcwNGIxM2I1OTRmMWZmMDFlNGYyYjJkNTIwZWUwYTc4MWVmZTIzZDU1YUki%0ADXRyYWNraW5nBjsARnsISSIUSFRUUF9VU0VSX0FHRU5UBjsARiItZjYxZWRk%0AYzg2NjFhZjU5M2JlYzNlZTY0MzIyZjgxZTBkNDBmMDdlMkkiGUhUVFBfQUND%0ARVBUX0VOQ09ESU5HBjsARiItZGRkMDk4OTE3NGYxOWE1YjE4NzkxMjEzY2M0%0AMGM1YTYwOWQyNTQ2Y0kiGUhUVFBfQUNDRVBUX0xBTkdVQUdFBjsARiItZGEz%0AOWEzZWU1ZTZiNGIwZDMyNTViZmVmOTU2MDE4OTBhZmQ4MDcwOQ%3D%3D%0A--dff0a93591a346db42fd626ac38bcafc962c3467;
29
+ path=/; HttpOnly
30
+ Connection:
31
+ - keep-alive
32
+ Server:
33
+ - thin 1.5.1 codename Straight Razor
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! '{"assignments":[]}'
37
+ http_version:
38
+ recorded_at: Tue, 24 Sep 2013 01:23:54 GMT
39
+ recorded_with: VCR 2.5.0
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.27
4
+ version: 0.0.28
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-09-21 00:00:00.000000000 Z
12
+ date: 2013-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -228,6 +228,7 @@ files:
228
228
  - test/fixtures/home/.exercism
229
229
  - test/fixtures/ruby/bob/bob.rb
230
230
  - test/fixtures/vcr_cassettes/alice-gets-bob.yml
231
+ - test/fixtures/vcr_cassettes/alice-gets-current-assignments.yml
231
232
  - test/fixtures/vcr_cassettes/alice-gets-stash-list.yml
232
233
  - test/fixtures/vcr_cassettes/alice-gets-stash.yml
233
234
  - test/fixtures/vcr_cassettes/alice-gets-word-count.yml
@@ -274,9 +275,11 @@ test_files:
274
275
  - test/fixtures/home/.exercism
275
276
  - test/fixtures/ruby/bob/bob.rb
276
277
  - test/fixtures/vcr_cassettes/alice-gets-bob.yml
278
+ - test/fixtures/vcr_cassettes/alice-gets-current-assignments.yml
277
279
  - test/fixtures/vcr_cassettes/alice-gets-stash-list.yml
278
280
  - test/fixtures/vcr_cassettes/alice-gets-stash.yml
279
281
  - test/fixtures/vcr_cassettes/alice-gets-word-count.yml
280
282
  - test/fixtures/vcr_cassettes/alice-submits-bob.yml
281
283
  - test/fixtures/vcr_cassettes/alice-submits-stash.yml
282
284
  - test/test_helper.rb
285
+ has_rdoc: