gisty 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +16 -14
- data/lib/commands/post.rb +1 -0
- data/lib/commands/private_post.rb +1 -0
- data/lib/gisty.rb +9 -3
- data/test/gisty_test.rb +2 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
1
|
= gisty
|
3
2
|
|
3
|
+
{<img src="https://secure.travis-ci.org/swdyh/gisty.png?branch=master" alt="Build Status" />}[http://travis-ci.org/swdyh/gisty]
|
4
4
|
|
5
5
|
== Description
|
6
6
|
|
@@ -10,16 +10,16 @@ yet another command line client for gist supported API V3.
|
|
10
10
|
|
11
11
|
=== Gem Installation
|
12
12
|
|
13
|
-
|
13
|
+
gem install gisty
|
14
14
|
|
15
15
|
set environment variable GISTY_DIR.
|
16
16
|
|
17
|
-
|
17
|
+
export GISTY_DIR="$HOME/dev/gists"
|
18
18
|
|
19
19
|
get OAuth access token here. https://swdyh-gisty.heroku.com/
|
20
20
|
set environment variable GISTY_ACCESS_TOKEN
|
21
21
|
|
22
|
-
|
22
|
+
export GISTY_ACCESS_TOKEN=your_access_key
|
23
23
|
|
24
24
|
if you use zsh command completion, download this file to $fpath directory.
|
25
25
|
http://github.com/swdyh/gisty/raw/master/_gisty
|
@@ -29,22 +29,24 @@ http://github.com/swdyh/gisty/raw/master/_gisty
|
|
29
29
|
|
30
30
|
if "certificate verify failed" is occurred, set environment variable GISTY_SSL_CA.
|
31
31
|
|
32
|
-
|
32
|
+
export GISTY_SSL_CA="/your_ca_file_path/cert.pem"
|
33
33
|
|
34
34
|
if you do not want to verify, set GISTY_SSL_VERIFY.
|
35
35
|
|
36
|
-
|
36
|
+
export GISTY_SSL_VERIFY="NONE"
|
37
37
|
|
38
38
|
== Synopsis
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
commands
|
41
|
+
|
42
|
+
gisty list show local list.
|
43
|
+
gisty post file1 file2 ... post new gist.
|
44
|
+
gisty private_post file1 file2 ... post new private gist.
|
45
|
+
gisty sync sync remote gist. (clone all remote gist)
|
46
|
+
gisty sync_delete sync remote gist. delete local gist if remote gist was deleted.
|
47
|
+
gisty pull_all pull all gist.
|
48
|
+
gisty about show about gisty
|
49
|
+
gisty help show help
|
48
50
|
|
49
51
|
== Copyright
|
50
52
|
|
data/lib/commands/post.rb
CHANGED
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.2'
|
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
|
@@ -72,11 +72,12 @@ class Gisty
|
|
72
72
|
open_uri_opt[:ssl_verify_mode] = @ssl_verify
|
73
73
|
end
|
74
74
|
OpenURI.open_uri(url, open_uri_opt) do |f|
|
75
|
-
{ :content => JSON.parse(f.read), :link => Gisty.parse_link(f.meta['link']) }
|
75
|
+
{ :content => JSON.parse(f.read), :link => Gisty.parse_link(f.meta['link']) || {} }
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
def self.parse_link link
|
80
|
+
return nil if link.nil?
|
80
81
|
link.split(', ').inject({}) do |r, i|
|
81
82
|
url, rel = i.split '; '
|
82
83
|
r[rel.gsub(/^rel=/, '').gsub('"', '').to_sym] = url.gsub(/[<>]/, '').strip
|
@@ -164,7 +165,12 @@ class Gisty
|
|
164
165
|
url = URI.parse('https://api.github.com/gists')
|
165
166
|
req = Net::HTTP::Post.new url.path + '?access_token=' + @access_token
|
166
167
|
req.body = params.to_json
|
167
|
-
|
168
|
+
if ENV['https_proxy']
|
169
|
+
proxy_uri = URI.parse(ENV['https_proxy'])
|
170
|
+
https = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port).new(url.host, url.port)
|
171
|
+
else
|
172
|
+
https = Net::HTTP.new(url.host, url.port)
|
173
|
+
end
|
168
174
|
https.use_ssl = true
|
169
175
|
https.verify_mode = @ssl_verify
|
170
176
|
https.verify_depth = 5
|
data/test/gisty_test.rb
CHANGED
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: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
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-05-01 00:00:00 +09:00
|
19
19
|
default_executable: gisty
|
20
20
|
dependencies: []
|
21
21
|
|