gisty 0.2.0 → 0.2.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/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
- sudo gem install gisty
13
+ gem install gisty
14
14
 
15
15
  set environment variable GISTY_DIR.
16
16
 
17
- export GISTY_DIR="$HOME/dev/gists"
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
- export GISTY_ACCESS_TOKEN=your_access_key
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
- export GISTY_SSL_CA="/your_ca_file_path/cert.pem"
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
- export GISTY_SSL_VERIFY="NONE"
36
+ export GISTY_SSL_VERIFY="NONE"
37
37
 
38
38
  == Synopsis
39
39
 
40
- gisty list show local list.
41
- gisty post file1 file2 ... post new gist.
42
- gisty private_post file1 file2 ... post new private gist.
43
- gisty sync sync remote gist. (clone all remote gist)
44
- gisty sync_delete sync remote gist. delete local gist if remote gist was deleted.
45
- gisty pull_all pull all gist.
46
- gisty about show about gisty
47
- gisty help show help
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
@@ -9,6 +9,7 @@ cmd :post, 'file1 file2 ...', 'post new gist' do |fs|
9
9
  else
10
10
  id = url.split('/').last
11
11
  html_url = "https://gist.github.com/#{id}"
12
+ puts html_url
12
13
  system "open #{html_url}" if /darwin/ === RUBY_PLATFORM
13
14
  @g.clone id
14
15
  end
@@ -7,6 +7,7 @@ cmd :private_post, 'file1 file2 ...', 'post new private gist' do |fs|
7
7
  else
8
8
  id = url.split('/').last
9
9
  html_url = "https://gist.github.com/#{id}"
10
+ puts html_url
10
11
  system "open #{html_url}" if /darwin/ === RUBY_PLATFORM
11
12
  @g.clone id
12
13
  end
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.0'
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
- https = Net::HTTP.new(url.host, url.port)
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
@@ -1,6 +1,7 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.dirname(__FILE__)) + '/test_helper.rb'
2
2
  require 'test/unit'
3
3
  require 'pp'
4
+ require 'pathname'
4
5
  require 'rr'
5
6
  require 'fakeweb'
6
7
 
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: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
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-03-26 00:00:00 +09:00
18
+ date: 2012-05-01 00:00:00 +09:00
19
19
  default_executable: gisty
20
20
  dependencies: []
21
21