gisty 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +4 -1
  2. data/bin/gisty +1 -1
  3. data/lib/gisty.rb +10 -4
  4. metadata +4 -4
data/README.rdoc CHANGED
@@ -17,10 +17,13 @@ example .zshrc
17
17
 
18
18
  export GISTY_DIR="$HOME/dev/gists"
19
19
 
20
+ open https://swdyh-gisty.heroku.com/
21
+
22
+ export GISTY_ACCESS_TOKEN=your_access_key
23
+
20
24
  set global git config. see "Global Git Config" at https://github.com/account
21
25
 
22
26
  git config --global github.user your_id
23
- git config --global github.token your_token
24
27
 
25
28
  if you use zsh command completion, download this file to $fpath directory.
26
29
  http://github.com/swdyh/gisty/raw/master/_gisty
data/bin/gisty CHANGED
@@ -29,7 +29,7 @@ end
29
29
  if ENV['GISTY_DIR']
30
30
  begin
31
31
  @g = Gisty.new ENV['GISTY_DIR'], nil, nil, :ssl_ca => ENV['GISTY_SSL_CA'],
32
- :ssl_verify => ENV['GISTY_SSL_VERIFY']
32
+ :ssl_verify => ENV['GISTY_SSL_VERIFY'], :access_token => ENV['GISTY_ACCESS_TOKEN']
33
33
  rescue Gisty::UnsetAuthInfoException => e
34
34
  puts 'Error: set your api token.'
35
35
  puts 'see Global Git Config at https://github.com/account'
data/lib/gisty.rb CHANGED
@@ -9,7 +9,7 @@ require 'json'
9
9
  require 'highline/import'
10
10
 
11
11
  class Gisty
12
- VERSION = '0.1.1'
12
+ VERSION = '0.1.2'
13
13
  GIST_URL = 'https://gist.github.com/'
14
14
  GISTY_URL = 'http://github.com/swdyh/gisty/tree/master'
15
15
  COMMAND_PATH = Pathname.new(File.join(File.dirname(__FILE__), 'commands')).realpath.to_s
@@ -51,6 +51,8 @@ class Gisty
51
51
  else
52
52
  OpenSSL::SSL::VERIFY_PEER
53
53
  end
54
+ @access_token = (opt[:access_token] && opt[:access_token].size > 0) ?
55
+ opt[:access_token] : nil
54
56
  end
55
57
 
56
58
  def next_link str
@@ -170,11 +172,15 @@ class Gisty
170
172
 
171
173
  def post params
172
174
  url = URI.parse('https://api.github.com/gists')
173
- req = Net::HTTP::Post.new url.path
174
175
 
175
- req.basic_auth @auth['login'], get_password
176
- req.body = params.to_json
176
+ if @access_token
177
+ req = Net::HTTP::Post.new url.path + '?access_token=' + @access_token
178
+ else
179
+ req = Net::HTTP::Post.new url.path
180
+ req.basic_auth @auth['login'], get_password
181
+ end
177
182
 
183
+ req.body = params.to_json
178
184
  https = Net::HTTP.new(url.host, url.port)
179
185
  https.use_ssl = true
180
186
  https.verify_mode = @ssl_verify
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: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.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-19 00:00:00 +09:00
18
+ date: 2012-03-20 00:00:00 +09:00
19
19
  default_executable: gisty
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency