gist 4.1.0 → 4.1.1

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 (5) hide show
  1. checksums.yaml +4 -4
  2. data/build/gist +17 -5
  3. data/build/gist.1 +3 -3
  4. data/lib/gist.rb +2 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2a2602f4c36da451b2c5a2178c0212892ee1803
4
- data.tar.gz: 30bd2defacb65e653da924b422c64caa90acb274
3
+ metadata.gz: 0697ca6de8dfac847072d32aff530c770a62a669
4
+ data.tar.gz: fdf8f9e32e6a95fd0a78a6b3cb10e9cdd5f9ab14
5
5
  SHA512:
6
- metadata.gz: f2560a91c5d57ab0c9a5c1153fd22f906ca02ab3212705db4c5936d8c9c18e9bc9f3cbed0d46f11232b1befa7d4e4c0d549f5996dece869de8ac175e86dd7b7b
7
- data.tar.gz: ab29ddbc115d300ffa75ac55104c7bf2ef1225a75fbefbde9ea03bd673ef715d1f1d22be91106aaea8ff62943d4031c7977ca64e8fa52e03bbc150d6a3c8ca2d
6
+ metadata.gz: 387eacd18655cffa996e0295bcbe940c77cc912ed7acb4c5977fbc88da2addec3f7c80c87d7526a8e831e6d1fc80e4c47563ddb4860b807f79798e2fe4325343
7
+ data.tar.gz: 41754cd8989de51b1701bd6c5aaf8dd34ff13a09b9cd1cfdb8641c60071041af123907fa49982027bdda5deb58b23419a1760461c90869682bc1dbe5d8bc6e01
data/build/gist CHANGED
@@ -1313,7 +1313,7 @@ require 'uri'
1313
1313
  module Gist
1314
1314
  extend self
1315
1315
 
1316
- VERSION = '4.0.1'
1316
+ VERSION = '4.1.1'
1317
1317
 
1318
1318
  # A list of clipboard commands with copy and paste support.
1319
1319
  CLIPBOARD_COMMANDS = {
@@ -1443,13 +1443,16 @@ module Gist
1443
1443
  # and OAuth2 access token, which is then stored in ~/.gist
1444
1444
  #
1445
1445
  # @raise [Gist::Error] if something went wrong
1446
+ # @param [Hash] credentials login details
1447
+ # @option credentials [String] :username
1448
+ # @option credentials [String] :password
1446
1449
  # @see http://developer.github.com/v3/oauth/
1447
- def login!
1450
+ def login!(credentials={})
1448
1451
  puts "Obtaining OAuth2 access_token from github."
1449
1452
  print "GitHub username: "
1450
- username = $stdin.gets.strip
1453
+ username = credentials[:username] || $stdin.gets.strip
1451
1454
  print "GitHub password: "
1452
- password = begin
1455
+ password = credentials[:password] || begin
1453
1456
  `stty -echo` rescue nil
1454
1457
  $stdin.gets.strip
1455
1458
  ensure
@@ -1468,8 +1471,17 @@ module Gist
1468
1471
 
1469
1472
  response = http(api_url, request)
1470
1473
 
1474
+ if Net::HTTPUnauthorized === response && response['X-GitHub-OTP']
1475
+ print "2-factor auth code: "
1476
+ twofa_code = $stdin.gets.strip
1477
+ puts ""
1478
+
1479
+ request['X-GitHub-OTP'] = twofa_code
1480
+ response = http(api_url, request)
1481
+ end
1482
+
1471
1483
  if Net::HTTPCreated === response
1472
- File.open(auth_token_file, 'w') do |f|
1484
+ File.open(auth_token_file, 'w', 0600) do |f|
1473
1485
  f.write JSON.parse(response.body)['token']
1474
1486
  end
1475
1487
  puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "GIST" "1" "May 2013" "" "Gist manual"
4
+ .TH "GIST" "1" "September 2013" "" "Gist manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBgist\fR \- upload code to https://gist\.github\.com
@@ -74,10 +74,10 @@ If you\'d like to copy the resulting URL to your clipboard, use \fB\-c\fR\.
74
74
  gist \-c <a\.rb
75
75
  .
76
76
  .IP "\(bu" 4
77
- If you\'d like to copy the resulting embeddable URL to your clipboard, use \fB\-\-copy\-js\fR\.
77
+ If you\'d like to copy the resulting embeddable URL to your clipboard, use \fB\-e\fR\.
78
78
  .
79
79
  .IP
80
- gist \-\-copy\-js <a\.rb
80
+ gist \-e <a\.rb
81
81
  .
82
82
  .IP "\(bu" 4
83
83
  And you can just ask gist to open a browser window directly with \fB\-o\fR\.
@@ -7,7 +7,7 @@ require 'uri'
7
7
  module Gist
8
8
  extend self
9
9
 
10
- VERSION = '4.1.0'
10
+ VERSION = '4.1.1'
11
11
 
12
12
  # A list of clipboard commands with copy and paste support.
13
13
  CLIPBOARD_COMMANDS = {
@@ -175,7 +175,7 @@ module Gist
175
175
  end
176
176
 
177
177
  if Net::HTTPCreated === response
178
- File.open(auth_token_file, 'w') do |f|
178
+ File.open(auth_token_file, 'w', 0600) do |f|
179
179
  f.write JSON.parse(response.body)['token']
180
180
  end
181
181
  puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gist
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conrad Irwin