hugeurl 0.0.4 → 0.0.5

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. data/History.txt +4 -0
  2. data/README.rdoc +1 -1
  3. data/bin/hugeurl +1 -0
  4. data/lib/hugeurl.rb +9 -3
  5. metadata +5 -5
@@ -1,3 +1,7 @@
1
+ === 0.0.5 2012-04-11
2
+
3
+ * support HTTPS
4
+
1
5
 
2
6
  === 0.0.4 2012-04-11
3
7
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- expand tinyurl and bit.ly
7
+ expand tinyurl, bit.ly, t.co and more.
8
8
 
9
9
 
10
10
  == SYNOPSIS:
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
  require 'hugeurl'
4
+ #require File.dirname(__FILE__)+'/../lib/hugeurl'
4
5
 
5
6
  unless ARGV.empty?
6
7
  puts URI.parse(ARGV.shift).to_huge
@@ -4,13 +4,19 @@ $:.unshift(File.dirname(__FILE__)) unless
4
4
  require 'rubygems'
5
5
  require 'uri'
6
6
  require 'net/http'
7
+ require 'net/https'
7
8
 
8
9
  module Hugeurl
9
- VERSION = '0.0.4'
10
+ VERSION = '0.0.5'
10
11
  def self.get(url)
11
12
  url = URI.parse url unless url.class.to_s =~ /^URI::/
12
- res = Net::HTTP.start(url.host, url.port).
13
- head(url.path.size < 1 ? '/' : url.path)
13
+ if url.class == URI::HTTPS
14
+ http = Net::HTTP.new(url.host, 443)
15
+ http.use_ssl = true
16
+ else
17
+ http = Net::HTTP.new(url.host, url.port)
18
+ end
19
+ res = http.head(url.path.size < 1 ? '/' : url.path)
14
20
  URI.parse res['location'] rescue return url
15
21
  end
16
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hugeurl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sho Hashimoto
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: "2.15"
64
64
  type: :development
65
65
  version_requirements: *id003
66
- description: expand tinyurl and bit.ly
66
+ description: expand tinyurl, bit.ly, t.co and more.
67
67
  email:
68
68
  - hashimoto@shokai.org
69
69
  executables:
@@ -121,7 +121,7 @@ rubyforge_project: hugeurl
121
121
  rubygems_version: 1.8.17
122
122
  signing_key:
123
123
  specification_version: 3
124
- summary: expand tinyurl and bit.ly
124
+ summary: expand tinyurl, bit.ly, t.co and more.
125
125
  test_files:
126
126
  - test/test_helper.rb
127
127
  - test/test_hugeurl.rb