jist 0.3 → 0.4.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jist.rb +8 -8
  2. metadata +13 -9
data/lib/jist.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'net/https'
2
2
  require 'cgi'
3
- require 'multi_json'
3
+ require 'json'
4
4
 
5
5
  # It just gists.
6
6
  module Jist
7
7
 
8
- VERSION = '0.3'
8
+ VERSION = '0.4.pre.1'
9
9
 
10
10
  module_function
11
11
  # Upload a gist to https://gist.github.com
@@ -42,12 +42,12 @@ module Jist
42
42
  url << "?access_token=" << CGI.escape(access_token) if access_token.to_s != ''
43
43
 
44
44
  request = Net::HTTP::Post.new(url)
45
- request.body = MultiJson.encode(json)
45
+ request.body = JSON.dump(json)
46
46
 
47
47
  response = http(request)
48
48
 
49
49
  if Net::HTTPCreated === response
50
- MultiJson.decode(response.body)
50
+ JSON.parse(response.body)
51
51
  else
52
52
  raise RuntimeError.new "Got #{response.class} from gist: #{response.body}"
53
53
  end
@@ -63,15 +63,15 @@ module Jist
63
63
  username = gets.strip
64
64
  print "Github password: "
65
65
  password = begin
66
- `stty -echo 2>/dev/null`
66
+ `stty -echo` rescue nil
67
67
  gets.strip
68
68
  ensure
69
- `stty echo 2>/dev/null`
69
+ `stty echo` rescue nil
70
70
  end
71
71
  puts ""
72
72
 
73
73
  request = Net::HTTP::Post.new("/authorizations")
74
- request.body = MultiJson.encode({
74
+ request.body = JSON.dump({
75
75
  :scopes => [:gist],
76
76
  :note => "The jist gem",
77
77
  :note_url => "https://github.com/ConradIrwin/jist"
@@ -82,7 +82,7 @@ module Jist
82
82
 
83
83
  if Net::HTTPCreated === response
84
84
  File.open(File.expand_path("~/.jist"), 'w') do |f|
85
- f.write MultiJson.decode(response.body)['token']
85
+ f.write JSON.parse(response.body)['token']
86
86
  end
87
87
  puts "Success! https://github.com/settings/applications"
88
88
  else
metadata CHANGED
@@ -1,12 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jist
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease:
4
+ hash: 3965969091
5
+ prerelease: 4
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.3"
8
+ - 4
9
+ - pre
10
+ - 1
11
+ version: 0.4.pre.1
10
12
  platform: ruby
11
13
  authors:
12
14
  - Conrad Irwin
@@ -17,7 +19,7 @@ cert_chain: []
17
19
  date: 2012-06-23 00:00:00 Z
18
20
  dependencies:
19
21
  - !ruby/object:Gem::Dependency
20
- name: multi_json
22
+ name: json
21
23
  prerelease: false
22
24
  requirement: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
@@ -61,12 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
63
  required_rubygems_version: !ruby/object:Gem::Requirement
62
64
  none: false
63
65
  requirements:
64
- - - ">="
66
+ - - ">"
65
67
  - !ruby/object:Gem::Version
66
- hash: 3
68
+ hash: 25
67
69
  segments:
68
- - 0
69
- version: "0"
70
+ - 1
71
+ - 3
72
+ - 1
73
+ version: 1.3.1
70
74
  requirements: []
71
75
 
72
76
  rubyforge_project: