Skip to content

Commit d442d43

Browse files
committed
v4.6.1
1 parent c12fe61 commit d442d43

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

build/gist

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,18 +1318,18 @@ end
13181318
module Gist
13191319
extend self
13201320

1321-
VERSION = '4.6.0'
1321+
VERSION = '4.6.1'
13221322

13231323
# A list of clipboard commands with copy and paste support.
13241324
CLIPBOARD_COMMANDS = {
1325+
'pbcopy' => 'pbpaste',
13251326
'xclip' => 'xclip -o',
13261327
'xsel -i' => 'xsel -o',
1327-
'pbcopy' => 'pbpaste',
1328-
'putclip' => 'getclip'
1328+
'putclip' => 'getclip',
13291329
}
13301330

13311331
GITHUB_API_URL = URI("https://api.github.com/")
1332-
GIT_IO_URL = URI("http://git.io")
1332+
GIT_IO_URL = URI("https://git.io")
13331333

13341334
GITHUB_BASE_PATH = ""
13351335
GHE_BASE_PATH = "/api/v3"
@@ -1350,7 +1350,7 @@ module Gist
13501350
module AuthTokenFile
13511351
def self.filename
13521352
if ENV.key?(URL_ENV_NAME)
1353-
File.expand_path "~/.gist.#{ENV[URL_ENV_NAME].gsub(/[^a-z.]/, '')}"
1353+
File.expand_path "~/.gist.#{ENV[URL_ENV_NAME].gsub(/:/, '.').gsub(/[^a-z0-9.]/, '')}"
13541354
else
13551355
File.expand_path "~/.gist"
13561356
end
@@ -1590,10 +1590,12 @@ module Gist
15901590
# @param [String] url
15911591
# @return [String] shortened url, or long url if shortening fails
15921592
def shorten(url)
1593-
request = Net::HTTP::Post.new("/")
1593+
request = Net::HTTP::Post.new("/create")
15941594
request.set_form_data(:url => url)
15951595
response = http(GIT_IO_URL, request)
15961596
case response.code
1597+
when "200"
1598+
URI.join(GIT_IO_URL, response.body).to_s
15971599
when "201"
15981600
response['Location']
15991601
else
@@ -1666,7 +1668,7 @@ module Gist
16661668

16671669
if Net::HTTPCreated === response
16681670
AuthTokenFile.write JSON.parse(response.body)['token']
1669-
puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
1671+
puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/tokens"
16701672
return
16711673
elsif Net::HTTPUnauthorized === response
16721674
puts "Error: #{JSON.parse(response.body)['message']}"

lib/gist.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
module Gist
1313
extend self
1414

15-
VERSION = '4.6.0'
15+
VERSION = '4.6.1'
1616

1717
# A list of clipboard commands with copy and paste support.
1818
CLIPBOARD_COMMANDS = {

0 commit comments

Comments
 (0)