gisty 0.2.2 → 0.2.3
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/gisty.rb +12 -2
- metadata +4 -4
data/lib/gisty.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'rubygems'
|
|
|
7
7
|
require 'json'
|
|
8
8
|
|
|
9
9
|
class Gisty
|
|
10
|
-
VERSION = '0.2.
|
|
10
|
+
VERSION = '0.2.3'
|
|
11
11
|
GIST_URL = 'https://gist.github.com/'
|
|
12
12
|
GISTY_URL = 'https://github.com/swdyh/gisty'
|
|
13
13
|
COMMAND_PATH = Pathname.new(File.join(File.dirname(__FILE__), 'commands')).realpath.to_s
|
|
@@ -71,6 +71,11 @@ class Gisty
|
|
|
71
71
|
if @ssl_verify && OpenURI::Options.key?(:ssl_verify_mode)
|
|
72
72
|
open_uri_opt[:ssl_verify_mode] = @ssl_verify
|
|
73
73
|
end
|
|
74
|
+
proxy = URI.parse(url.to_s).find_proxy
|
|
75
|
+
|
|
76
|
+
if proxy && proxy.user && OpenURI::Options.key?(:proxy_http_basic_authentication)
|
|
77
|
+
open_uri_opt[:proxy_http_basic_authentication] = [proxy, proxy.user, proxy.password]
|
|
78
|
+
end
|
|
74
79
|
OpenURI.open_uri(url, open_uri_opt) do |f|
|
|
75
80
|
{ :content => JSON.parse(f.read), :link => Gisty.parse_link(f.meta['link']) || {} }
|
|
76
81
|
end
|
|
@@ -164,10 +169,15 @@ class Gisty
|
|
|
164
169
|
def post params
|
|
165
170
|
url = URI.parse('https://api.github.com/gists')
|
|
166
171
|
req = Net::HTTP::Post.new url.path + '?access_token=' + @access_token
|
|
172
|
+
req.set_content_type('application/json')
|
|
167
173
|
req.body = params.to_json
|
|
168
174
|
if ENV['https_proxy']
|
|
169
175
|
proxy_uri = URI.parse(ENV['https_proxy'])
|
|
170
|
-
|
|
176
|
+
if proxy_uri.user && proxy_uri.password
|
|
177
|
+
https = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password).new(url.host, url.port)
|
|
178
|
+
else
|
|
179
|
+
https = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port).new(url.host, url.port)
|
|
180
|
+
end
|
|
171
181
|
else
|
|
172
182
|
https = Net::HTTP.new(url.host, url.port)
|
|
173
183
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gisty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 17
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.2.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- swdyh
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2012-
|
|
18
|
+
date: 2012-06-29 00:00:00 +09:00
|
|
19
19
|
default_executable: gisty
|
|
20
20
|
dependencies: []
|
|
21
21
|
|