exercism 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjVhNDk5Y2FiNGFiMGQ0ODBjNjg1YzUyZmM1ZDU0ODMwYTQ5Yzk1Mw==
4
+ NjQ1Mjc5YTZmYzg2OGYyOTAzNGM5NzY2Y2YwMzNhMzAzYjZiYTExNw==
5
5
  data.tar.gz: !binary |-
6
- M2M1ZDQ4MTMzNWZiNmJmZWQyZmQ1YmI2YzI5ZjllYjQ0NzhkMjY2OA==
6
+ ZmI1MjI3MzU5NjQ4N2YzZWYwNjVjYmEwYjU4NWIyNWZiOGYzM2YzNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzlhZDZmYzdhMjEzNTVhNzZhODI4MWU1N2E3MjQ2ZGQyM2NhYTMzYWI3NGYz
10
- Zjk3OWU1NzhiN2U0ODY5MWM4Yzc0ZTVmYzQyN2Y5NmZjZTJhOWExYWE3NWIy
11
- MTBmOWFkZGI4ZDA3MTg1ZTUzMzk5Nzk4NTQyZDA2Y2I4ZjY3NjU=
9
+ MTk0NWFjOTkxOWY0ZTE0YmQ5ODliYTQ2NDhjMjZjNDk5ZGQ0YzNkNGU1Nzc5
10
+ MjE2OTk0OTZjYmMzMWIxYTBjZGUxYTRmNGM0MTlmNmY5MzZlYThmN2JkZDdm
11
+ YTViZDUzOThjZjE2MzllMWQ0YTIxODdjZWZlN2MyOWQzMjkxNGI=
12
12
  data.tar.gz: !binary |-
13
- YTRkNjE1MThiMWZmMzA1NWJmY2E5MDFjZTFhMzQ4ZDE1Y2NmMzRkMjNiYTgx
14
- MTBmM2Y4MmU3NzJjMjExNDcyMjg3ODY2NDY0NDQ5MTA4ODRjNThkNDJkOTlm
15
- MjFlYTg0OGZiNDIyN2FjNTMzZGRlNjUwMjE0ODIwZDA4ZmE5MDg=
13
+ OTFiZjNlMmE5OWM5Yzg1OTdiNGU0NjU5ODNkN2I1MzNhZGQ5NGYxMGE0MDAy
14
+ NDBlOWVlMjljNmFhNDAxYzUyZmFlNzVhNWYyYTI2ZDIyMDc2NGJmYzliYWJk
15
+ MzE5ZTdhMGE5ZWRlMDg0OGQwMGIyYWYwZTc1ODBlMmE4ZTVhOTc=
data/README.md CHANGED
@@ -6,9 +6,18 @@ Client gem for the warmup-exercise app exercism.io.
6
6
 
7
7
  ## Usage
8
8
 
9
- $ exercism login YOUR_GITHUB_USERNAME -s YOUR_EXERCISM_SECRET
9
+ $ exercism login
10
+
11
+ You will be asked for your GitHub username, and an exercism.io API key. The
12
+ API key is displayed when you log in to the exercism.io website.
13
+
10
14
  $ exercism fetch
11
- $ exercism submit -f example.rb
15
+
16
+ This retrieves the README and test suite for your current assignment.
17
+
18
+ $ exercism submit example.rb
19
+
20
+ This submits `example.rb` on your current assignment.
12
21
 
13
22
  ## Contributing
14
23
 
data/exercism.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "vcr", '~> 2.4'
26
26
  spec.add_development_dependency "fakeweb"
27
+ spec.add_development_dependency "approvals"
27
28
  end
data/lib/exercism/api.rb CHANGED
@@ -12,8 +12,7 @@ class Exercism
12
12
  req.headers['User-Agent'] = "exercism-CLI v#{Exercism::VERSION}"
13
13
  req.params['key'] = user.key
14
14
  end
15
- assignment = Assignment.new(JSON.parse(response.body))
16
- assignment.save
15
+ Assignment.save(JSON.parse(response.body))
17
16
  end
18
17
 
19
18
  def self.submit(filename, options)
@@ -1,13 +1,19 @@
1
1
  class Exercism
2
2
  class Assignment
3
3
 
4
- attr_reader :track, :slug, :readme, :testfile, :tests
4
+ def self.save(data)
5
+ data['assignments'].each do |attributes|
6
+ Assignment.new(attributes).save
7
+ end
8
+ end
9
+
10
+ attr_reader :track, :slug, :readme, :test_file, :tests
5
11
 
6
12
  def initialize(attributes)
7
13
  @track = attributes['track']
8
14
  @slug = attributes['slug']
9
15
  @readme = attributes['readme']
10
- @testfile = attributes['testfile']
16
+ @test_file = attributes['test_file']
11
17
  @tests = attributes['tests']
12
18
  end
13
19
 
@@ -26,7 +32,7 @@ class Exercism
26
32
  end
27
33
 
28
34
  def tests_path
29
- File.join(assignment_dir, testfile)
35
+ File.join(assignment_dir, test_file)
30
36
  end
31
37
 
32
38
  def assignment_dir
@@ -1,3 +1,3 @@
1
1
  class Exercism
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -23,6 +23,7 @@ class ApiTest < MiniTest::Unit::TestCase
23
23
  def teardown
24
24
  FileUtils.cd @project_dir
25
25
  FileUtils.rm_rf File.join(@project_dir, 'test/fixtures/home/ruby')
26
+ FileUtils.rm_rf File.join(@project_dir, 'test/fixtures/home/javascript')
26
27
  end
27
28
 
28
29
  def test_fetch_assignment_from_api
@@ -24,7 +24,7 @@ class AssignmentTest < MiniTest::Unit::TestCase
24
24
  'track' => 'ruby',
25
25
  'slug' => 'queens',
26
26
  'readme' => 'Do it',
27
- 'testfile' => 'test.rb',
27
+ 'test_file' => 'test.rb',
28
28
  'tests' => 'assert true'
29
29
  }
30
30
  end
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  user-agent:
11
- - exercism-CLI v0.0.1.pre-alpha
11
+ - exercism-CLI v0.0.3
12
12
  accept-encoding:
13
13
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
14
  accept:
@@ -26,27 +26,24 @@ http_interactions:
26
26
  - nosniff
27
27
  x-frame-options:
28
28
  - SAMEORIGIN
29
- set-cookie:
30
- - rack.session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiJFYzk0MGNlOTJmYzJhNWIyOWU4YmUw%0AZmYxZTVmY2IxMTA2ZDcwNTk3OTRkZjFhZTEzOWJiZWRjMzdlMWE5ODNjMEki%0ADXRyYWNraW5nBjsARnsISSIUSFRUUF9VU0VSX0FHRU5UBjsARiItMGJiOWI4%0AY2FjOWEzZmQxMWMyNDVlZWE3YmIwNzk4NTZlZDY2NDc4MkkiGUhUVFBfQUND%0ARVBUX0VOQ09ESU5HBjsARiItZGRkMDk4OTE3NGYxOWE1YjE4NzkxMjEzY2M0%0AMGM1YTYwOWQyNTQ2Y0kiGUhUVFBfQUNDRVBUX0xBTkdVQUdFBjsARiItZGEz%0AOWEzZWU1ZTZiNGIwZDMyNTViZmVmOTU2MDE4OTBhZmQ4MDcwOQ%3D%3D%0A--2dec80587d5e97276c5cc9656485b9801d551970;
31
- path=/; HttpOnly
32
29
  connection:
33
30
  - close
34
31
  content-length:
35
- - '1961'
32
+ - '3558'
36
33
  body:
37
34
  encoding: US-ASCII
38
- string: ! '{"track":"ruby","slug":"bob","readme":"# Bob\n\nBob is a lackadaisical
39
- teenager. In conversation, his responses are very limited.\n\nBob answers
40
- ''Sure.'' if you ask him a question.\n\nHe answers ''Whatever.'' if you tell
41
- him something.\n\nHe answers ''Woah, chill out!'' if you yell at him (ALL
42
- CAPS).\n\nHe says ''Fine. Be that way!'' if you address him without actually
43
- saying anything.\n\nBob, Inspired by the 90s, is bringing back \"l33t sP34k\",
44
- and he''ll teach you how to do it. Start any sentence with \"Bro, \", and
45
- he''ll translate the rest of it into l33t sP34k for you.\n\n## Hints\n\n`gets`,
35
+ string: ! '{"assignments":[{"track":"ruby","slug":"bob","readme":"# Bob\n\nBob
36
+ is a lackadaisical teenager. In conversation, his responses are very limited.\n\nBob
37
+ answers ''Sure.'' if you ask him a question.\n\nHe answers ''Whatever.'' if
38
+ you tell him something.\n\nHe answers ''Woah, chill out!'' if you yell at
39
+ him (ALL CAPS).\n\nHe says ''Fine. Be that way!'' if you address him without
40
+ actually saying anything.\n\nBob, Inspired by the 90s, is bringing back \"l33t
41
+ sP34k\", and he''ll teach you how to do it. Start any sentence with \"Bro,
42
+ \", and he''ll translate the rest of it into l33t sP34k for you.\n\n## Hints\n\n`gets`,
46
43
  _get string_ is the opposite of `puts` _put string_.\n\nNotice that when you
47
44
  type \"Something\" and then hit enter, you get the string\n`\"Something\\n\"`\n\n\n##
48
45
  Source\n\nInspired by the ''Deaf Grandma'' exercise in Chris Pine''s Learn
49
- to Program tutorial. [view source](http://pine.fm/LearnToProgram/?Chapter=06)\n","testfile":"test.rb","tests":"require
46
+ to Program tutorial. [view source](http://pine.fm/LearnToProgram/?Chapter=06)\n","test_file":"test.rb","tests":"require
50
47
  ''minitest/autorun''\nrequire ''minitest/pride''\nrequire_relative ''bob''\n\nclass
51
48
  BobTest < MiniTest::Unit::TestCase\n attr_reader :bob\n\n def setup\n @bob
52
49
  = Bob.new\n end\n\n def test_stating_something\n assert_equal ''Whatever.'',
@@ -57,7 +54,24 @@ http_interactions:
57
54
  go make out behind the gym!\")\n end\n\n def test_shouting_numbers\n skip\n assert_equal
58
55
  ''Woah, chill out!'', bob.hey(''1, 2, 3 GO!'')\n end\n\n def test_shouting_with_special_characters\n skip\n assert_equal
59
56
  ''Woah, chill out!'', bob.hey(''ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!'')\n end\n\n def
60
- test_silence\n skip\n assert_equal ''Fine, be that way.'', bob.hey('''')\n end\n\nend\n"}'
57
+ test_silence\n skip\n assert_equal ''Fine, be that way.'', bob.hey('''')\n end\n\nend\n"},{"track":"javascript","slug":"anagram","readme":"#
58
+ Anagram\n\nWrite a program that, given a word and a list of possible anagrams,
59
+ selects the correct one(s).\n\nIn other words, given: `\"listen\"` and `%w(enlists
60
+ google inlets banana)` the program should return \"inlets\".\n\n\n## Source\n\nInspired
61
+ by the Extreme Startup game [view source](https://github.com/rchatley/extreme_startup)\n","test_file":"test.spec.js","tests":"require(''./anagram'');\n\ndescribe(''Anagram'',
62
+ function() {\n\n it(\"no matches\",function() {\n var detector = new Anagram(\"diaper\");\n var
63
+ matches = detector.match([ \"hello\", \"world\", \"zombies\", \"pants\"]);\n expect(matches).toEqual([]);\n });\n\n it(\"detects
64
+ simple anagram\",function() {\n var detector = new Anagram(\"ba\");\n var
65
+ matches = detector.match([''ab'', ''abc'', ''bac'']);\n expect(matches).toEqual([''ab'']);\n });\n\n it(\"detects
66
+ multiple anagrams\",function() {\n var detector = new Anagram(\"abc\");\n var
67
+ matches = detector.match([''ab'', ''abc'', ''bac'']);\n expect(matches).toEqual([''abc'',
68
+ ''bac'']);\n });\n\n it(\"detects anagram\",function() {\n var detector
69
+ = new Anagram(\"listen\");\n var matches = detector.match([''enlists'',
70
+ ''google'', ''inlets'', ''banana'']);\n expect(matches).toEqual([''inlets'']);\n });\n\n it(\"detects
71
+ multiple anagrams\",function() {\n var detector = new Anagram(\"allergy\");\n var
72
+ matches = detector.match([''gallery'', ''ballerina'', ''regally'', ''clergy'',
73
+ ''largely'', ''leading'']);\n expect(matches).toEqual([''gallery'', ''regally'',
74
+ ''largely'']);\n });\n});"}]}'
61
75
  http_version: '1.1'
62
- recorded_at: Sun, 02 Jun 2013 15:46:06 GMT
76
+ recorded_at: Mon, 10 Jun 2013 22:30:44 GMT
63
77
  recorded_with: VCR 2.5.0
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: ! '{"code":"puts ''hello world''","key":"634abfb095ed621e1c793c9875fcd9fda455ea90","path":"/Users/kytrinyx/code/exercism/test/fixtures/home/ruby/bob/bob.rb"}'
9
9
  headers:
10
10
  user-agent:
11
- - exercism-CLI v0.0.1
11
+ - exercism-CLI v0.0.3
12
12
  accept:
13
13
  - application/json
14
14
  content-type:
@@ -26,16 +26,13 @@ http_interactions:
26
26
  - nosniff
27
27
  x-frame-options:
28
28
  - SAMEORIGIN
29
- set-cookie:
30
- - rack.session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRiJFNWY4MWJlYmZkMjY0NzE5MDVmMDli%0AZDM0NzJmOTZhN2VmODgxM2JmMzY2NmY5NGJhZGZmNjEwMDQxZWI1YmJhM0ki%0ACWNzcmYGOwBGIkU4Y2M5MTRmMTIzOWUyMjA5NTZkM2ExZjhlYzFkM2ExN2U5%0ANTJjMDdmY2ZmY2Y4NTY3NGY0M2FhM2ZjMDFlNDhkSSINdHJhY2tpbmcGOwBG%0AewhJIhRIVFRQX1VTRVJfQUdFTlQGOwBGIi1hY2NhNzllM2E2MjE0MzY1NzUz%0AYmUyZGJlMTkyM2EyYmUyNjFjM2M1SSIZSFRUUF9BQ0NFUFRfRU5DT0RJTkcG%0AOwBGIi1kYTM5YTNlZTVlNmI0YjBkMzI1NWJmZWY5NTYwMTg5MGFmZDgwNzA5%0ASSIZSFRUUF9BQ0NFUFRfTEFOR1VBR0UGOwBGIi1kYTM5YTNlZTVlNmI0YjBk%0AMzI1NWJmZWY5NTYwMTg5MGFmZDgwNzA5%0A--0153d74f359b84b80ec7a049b9b11fff39c0abf0;
31
- path=/; HttpOnly
32
29
  connection:
33
30
  - close
34
31
  content-length:
35
- - '28'
32
+ - '53'
36
33
  body:
37
34
  encoding: US-ASCII
38
- string: Saved submission on ruby/bob
35
+ string: ! '{"status":"saved","language":"ruby","exercise":"bob"}'
39
36
  http_version: '1.1'
40
- recorded_at: Sun, 02 Jun 2013 16:47:15 GMT
37
+ recorded_at: Mon, 10 Jun 2013 22:30:44 GMT
41
38
  recorded_with: VCR 2.5.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exercism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-02 00:00:00.000000000 Z
11
+ date: 2013-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: approvals
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Client gem for the exercism.io app
98
112
  email:
99
113
  - katrina.owen@gmail.com