jist 0.3 → 0.4

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.
Files changed (2) hide show
  1. data/lib/jist.rb +8 -8
  2. metadata +4 -4
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'
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,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jist
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.3"
8
+ - 4
9
+ version: "0.4"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Conrad Irwin
@@ -17,7 +17,7 @@ cert_chain: []
17
17
  date: 2012-06-23 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
- name: multi_json
20
+ name: json
21
21
  prerelease: false
22
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
23
  none: false