vimgolf 0.4.3 → 0.4.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.
- data/lib/vimgolf.rb +1 -0
- data/lib/vimgolf/challenge.rb +8 -5
- data/lib/vimgolf/version.rb +1 -1
- data/vimgolf.gemspec +1 -0
- metadata +19 -3
data/lib/vimgolf.rb
CHANGED
data/lib/vimgolf/challenge.rb
CHANGED
@@ -13,14 +13,14 @@ module VimGolf
|
|
13
13
|
|
14
14
|
def download
|
15
15
|
begin
|
16
|
-
url = URI.parse("#{GOLFHOST}/challenges/#{@id}.
|
16
|
+
url = URI.parse("#{GOLFHOST}/challenges/#{@id}.json")
|
17
17
|
req = Net::HTTP::Get.new(url.path)
|
18
18
|
|
19
19
|
proxy_url, proxy_user, proxy_pass = get_proxy
|
20
20
|
proxy = Net::HTTP::Proxy(proxy_url.host, proxy_url.port, proxy_user, proxy_pass)
|
21
21
|
res = proxy.start(url.host, url.port) { |http| http.request(req) }
|
22
22
|
|
23
|
-
@data =
|
23
|
+
@data = JSON.parse(res.body)
|
24
24
|
|
25
25
|
if !@data.is_a? Hash
|
26
26
|
raise
|
@@ -31,6 +31,9 @@ module VimGolf
|
|
31
31
|
raise "Bad Version"
|
32
32
|
end
|
33
33
|
|
34
|
+
@data['in']['data'].gsub!(/\r\n/, "\n")
|
35
|
+
@data['out']['data'].gsub!(/\r\n/, "\n")
|
36
|
+
|
34
37
|
@type = @data['in']['type']
|
35
38
|
save
|
36
39
|
start
|
@@ -52,7 +55,7 @@ module VimGolf
|
|
52
55
|
|
53
56
|
def upload
|
54
57
|
begin
|
55
|
-
url = URI.parse("#{GOLFHOST}/entry.
|
58
|
+
url = URI.parse("#{GOLFHOST}/entry.json")
|
56
59
|
|
57
60
|
proxy_url, proxy_user, proxy_pass = get_proxy
|
58
61
|
proxy = Net::HTTP::Proxy(proxy_url.host, proxy_url.port, proxy_user, proxy_pass)
|
@@ -60,10 +63,10 @@ module VimGolf
|
|
60
63
|
proxy.start(url.host, url.port) do |http|
|
61
64
|
request = Net::HTTP::Post.new(url.request_uri)
|
62
65
|
request.set_form_data({"challenge_id" => @id, "apikey" => Config.load['key'], "entry" => IO.read(log_path)})
|
63
|
-
request["Accept"] = "
|
66
|
+
request["Accept"] = "application/json"
|
64
67
|
|
65
68
|
res = http.request(request)
|
66
|
-
res =
|
69
|
+
res = JSON.parse(res.body)
|
67
70
|
|
68
71
|
raise if !res.is_a? Hash
|
69
72
|
res['status'].to_sym
|
data/lib/vimgolf/version.rb
CHANGED
data/vimgolf.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimgolf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
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-06-
|
12
|
+
date: 2013-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.14.6
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json_pure
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: highline
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +137,7 @@ post_install_message: ! '
|
|
121
137
|
|
122
138
|
------------------------------------------------------------------------------
|
123
139
|
|
124
|
-
Thank you for installing vimgolf-0.4.
|
140
|
+
Thank you for installing vimgolf-0.4.4.
|
125
141
|
|
126
142
|
|
127
143
|
0.1.3: custom vimgolf .vimrc file to help level the playing field
|