vimgolf 0.1.1 → 0.1.2

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/Gemfile.lock CHANGED
@@ -1,14 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vimgolf (0.1.0)
4
+ vimgolf (0.1.1)
5
+ highline
5
6
  json
6
- thor
7
+ thor (>= 0.14.6)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
12
  diff-lcs (1.1.2)
13
+ highline (1.6.1)
12
14
  json (1.4.6)
13
15
  rspec (2.3.0)
14
16
  rspec-core (~> 2.3.0)
@@ -24,7 +26,8 @@ PLATFORMS
24
26
  ruby
25
27
 
26
28
  DEPENDENCIES
29
+ highline
27
30
  json
28
31
  rspec
29
- thor
32
+ thor (>= 0.14.6)
30
33
  vimgolf!
data/lib/vimgolf/cli.rb CHANGED
@@ -124,7 +124,7 @@ module VimGolf
124
124
  if data['client'] != Vimgolf::VERSION
125
125
  VimGolf.ui.error "Client version mismatch. Installed: #{Vimgolf::VERSION}, Required: #{data['client']}."
126
126
  VimGolf.ui.error "\t gem install vimgolf"
127
- raise
127
+ raise "Bad Version"
128
128
  end
129
129
 
130
130
  File.open(Config.put_path + "/#{id}.#{data['in']['type']}", "w") {|f| f.puts data['in']['data']}
@@ -142,14 +142,12 @@ module VimGolf
142
142
  begin
143
143
  url = URI.parse("#{GOLFHOST}/entry.json")
144
144
  http = Net::HTTP.new(url.host, url.port)
145
- res = http.start do |conn|
146
- key = Config.load['key']
147
- data = "challenge_id=#{id}&entry=#{IO.read(log(id))}&apikey=#{key}"
148
- head = {'Accept' => 'application/json'}
149
145
 
150
- conn.post(url.path, data, head)
151
- end
146
+ request = Net::HTTP::Post.new(url.request_uri)
147
+ request.set_form_data({"challenge_id" => id, "apikey" => Config.load['key'], "entry" => IO.read(log(id))})
148
+ request["Accept"] = "application/json"
152
149
 
150
+ res = http.request(request)
153
151
  JSON.parse(res.body)['status'].to_sym
154
152
 
155
153
  rescue Exception => e
@@ -172,4 +170,4 @@ module VimGolf
172
170
  p [caller.first, msg] if GOLFDEBUG
173
171
  end
174
172
  end
175
- end
173
+ end
@@ -1,3 +1,3 @@
1
1
  module Vimgolf
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -30,7 +30,7 @@ describe VimGolf do
30
30
  end
31
31
 
32
32
  it "should return type of challenge on success" do
33
- c.download('4d1a1c36567bac34a9000002').should == "rb"
33
+ c.download('4d1a21e88ae121365c00000e').should == "rb"
34
34
  end
35
35
 
36
36
  it "should raise error on invalid upload id" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ilya Grigorik