exercism 0.0.16 → 0.0.17

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/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  language: ruby
3
3
  rvm:
4
+ - 1.8.7
4
5
  - 1.9.2
5
6
  - 1.9.3
6
7
  - 2.0.0
data/Rakefile CHANGED
@@ -5,5 +5,5 @@ Rake::TestTask.new do |t|
5
5
  t.pattern = "test/**/*_test.rb"
6
6
  end
7
7
 
8
- task default: :test
8
+ task :default => :test
9
9
 
data/exercism.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'exercism/version'
@@ -21,9 +21,18 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "faraday"
22
22
  spec.add_dependency "thor"
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "minitest", '~> 5.0'
25
25
  spec.add_development_dependency "vcr", '~> 2.4'
26
26
  spec.add_development_dependency "fakeweb"
27
+ spec.add_development_dependency "rake"
28
+
29
+
30
+ if RUBY_VERSION <= "1.8.7"
31
+ spec.add_dependency "json"
32
+ spec.add_development_dependency "nokogiri", "~>1.5.0"
33
+ else
34
+ spec.add_development_dependency "nokogiri", "~>1.6.0"
35
+ end
36
+
27
37
  spec.add_development_dependency "approvals"
28
- spec.add_development_dependency "minitest", '~> 5.0'
29
38
  end
data/lib/cli.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems' if RUBY_VERSION <= "1.8.7"
1
2
  require 'thor'
2
3
 
3
4
  class Exercism
@@ -13,7 +14,7 @@ class Exercism
13
14
  map "-v" => "version", "--version" => "version"
14
15
 
15
16
  desc "demo", "Fetch first assignment for each language from exercism.io"
16
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
17
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
17
18
  def demo
18
19
  require 'exercism'
19
20
 
@@ -28,7 +29,7 @@ class Exercism
28
29
  end
29
30
 
30
31
  desc "fetch", "Fetch current assignment from exercism.io"
31
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
32
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
32
33
  def fetch
33
34
  require 'exercism'
34
35
 
@@ -37,7 +38,7 @@ class Exercism
37
38
  end
38
39
 
39
40
  desc "peek", "Fetch upcoming assignment from exercism.io"
40
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
41
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
41
42
  def peek
42
43
  require 'exercism'
43
44
 
@@ -46,7 +47,7 @@ class Exercism
46
47
  end
47
48
 
48
49
  desc "submit FILE", "Submit code to exercism.io on your current assignment"
49
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
50
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
50
51
  def submit(file)
51
52
  require 'exercism'
52
53
 
@@ -55,7 +56,7 @@ class Exercism
55
56
  response = Exercism::Api.new(options[:host], Exercism.user).submit(file)
56
57
  puts "Your assignment has been submitted."
57
58
  url = submission_url(response.body, options[:host])
58
- puts "For feedback on your submission visit #{url}."
59
+ puts "For feedback on your submission visit #{url}"
59
60
  rescue Exception => e
60
61
  puts "There was an issue with your submission."
61
62
  puts e.message
data/lib/exercism.rb CHANGED
@@ -15,6 +15,7 @@ class Exercism
15
15
  if ENV["OS"] == 'Windows_NT' then
16
16
  ENV["HOMEDRIVE"]+ENV["HOMEPATH"]
17
17
  else
18
+ return File.expand_path('~') if RUBY_VERSION <= "1.8.7"
18
19
  Dir.home(Etc.getlogin)
19
20
  end
20
21
  end
data/lib/exercism/api.rb CHANGED
@@ -34,7 +34,7 @@ class Exercism
34
34
  req.url endpoint('user/assignments')
35
35
  req.headers['Accept'] = 'application/json'
36
36
  req.headers['Content-Type'] = 'application/json'
37
- req.body = {code: contents, key: user.key, path: path}.to_json
37
+ req.body = {:code => contents, :key => user.key, :path => path}.to_json
38
38
  end
39
39
  response
40
40
  end
@@ -56,7 +56,7 @@ class Exercism
56
56
  def endpoint(action = nil)
57
57
  "/api/v1/#{action}".chomp('/')
58
58
  end
59
-
59
+
60
60
  def save(body)
61
61
  Assignment.save(JSON.parse(body), project_dir)
62
62
  end
@@ -1,3 +1,3 @@
1
1
  class Exercism
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -38,8 +38,8 @@ class ApiTest < Minitest::Test
38
38
  VCR.use_cassette('alice-gets-bob') do
39
39
  Exercism::Api.new('http://localhost:4567', Exercism.user, project_dir).fetch
40
40
 
41
- Approvals.verify(File.read(readme_path), name: 'alice_gets_bob_readme')
42
- Approvals.verify(File.read(tests_path), name: 'alice_gets_bob_tests')
41
+ Approvals.verify(File.read(readme_path), :name => 'alice_gets_bob_readme', :format => :txt)
42
+ Approvals.verify(File.read(tests_path), :name => 'alice_gets_bob_tests', :format => :txt)
43
43
  end
44
44
  end
45
45
  end
@@ -53,8 +53,8 @@ class ApiTest < Minitest::Test
53
53
  VCR.use_cassette('alice-gets-word-count') do
54
54
  Exercism::Api.new('http://localhost:4567', Exercism.user, project_dir).peek
55
55
 
56
- Approvals.verify(File.read(readme_path), name: 'alice_gets_word_count_readme')
57
- Approvals.verify(File.read(tests_path), name: 'alice_gets_word_count_tests')
56
+ Approvals.verify(File.read(readme_path), :name => 'alice_gets_word_count_readme', :format => :txt)
57
+ Approvals.verify(File.read(tests_path), :name => 'alice_gets_word_count_tests', :format => :txt)
58
58
  end
59
59
  end
60
60
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'rubygems' if RUBY_VERSION <= "1.8.7"
2
+
1
3
  $:.unshift File.expand_path("../../lib", __FILE__)
2
4
  $:.unshift File.expand_path("../../test", __FILE__)
3
5
 
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.16
4
+ version: 0.0.17
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-23 00:00:00.000000000 Z
12
+ date: 2013-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -60,21 +60,21 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  - !ruby/object:Gem::Dependency
63
- name: rake
63
+ name: minitest
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ! '>='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: '5.0'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ! '>='
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: '5.0'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: vcr
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +108,7 @@ dependencies:
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  - !ruby/object:Gem::Dependency
111
- name: approvals
111
+ name: rake
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -124,13 +124,13 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
- name: minitest
127
+ name: nokogiri
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: '5.0'
133
+ version: 1.6.0
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,23 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: '5.0'
141
+ version: 1.6.0
142
+ - !ruby/object:Gem::Dependency
143
+ name: approvals
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
142
158
  description: Client gem for the exercism.io app
143
159
  email:
144
160
  - katrina.owen@gmail.com