hugeurl 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/History.txt +4 -0
  2. data/Rakefile +25 -25
  3. data/lib/hugeurl.rb +9 -11
  4. data/test/test_hugeurl.rb +23 -23
  5. metadata +60 -73
@@ -1,3 +1,7 @@
1
+ === 0.0.6 2012-06-28
2
+
3
+ * little fix
4
+
1
5
  === 0.0.5 2012-04-11
2
6
 
3
7
  * support HTTPS
data/Rakefile CHANGED
@@ -1,25 +1,25 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/hugeurl'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'hugeurl' do
14
- self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
15
- self.rubyforge_name = self.name # TODO this is default value
16
- # self.extra_deps = [['activesupport','>= 2.0.2']]
17
-
18
- end
19
-
20
- require 'newgem/tasks'
21
- Dir['tasks/**/*.rake'].each { |t| load t }
22
-
23
- # TODO - want other tests/tasks run by default? Add them to the list
24
- # remove_task :default
25
- # task :default => [:spec, :features]
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/hugeurl'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'hugeurl' do
14
+ self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
15
+ self.rubyforge_name = self.name # TODO this is default value
16
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
17
+
18
+ end
19
+
20
+ require 'newgem/tasks'
21
+ Dir['tasks/**/*.rake'].each { |t| load t }
22
+
23
+ # TODO - want other tests/tasks run by default? Add them to the list
24
+ # remove_task :default
25
+ # task :default => [:spec, :features]
@@ -1,23 +1,21 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
1
  require 'rubygems'
5
2
  require 'uri'
6
3
  require 'net/http'
7
4
  require 'net/https'
8
5
 
9
6
  module Hugeurl
10
- VERSION = '0.0.5'
11
- def self.get(url)
12
- url = URI.parse url unless url.class.to_s =~ /^URI::/
13
- if url.class == URI::HTTPS
14
- http = Net::HTTP.new(url.host, 443)
7
+ VERSION = '0.0.6'
8
+ def self.get(uri)
9
+ uri = URI.parse uri unless uri.class.to_s =~ /^URI::/
10
+ if uri.class == URI::HTTPS
11
+ http = Net::HTTP.new(uri.host, 443)
15
12
  http.use_ssl = true
16
13
  else
17
- http = Net::HTTP.new(url.host, url.port)
14
+ http = Net::HTTP.new(uri.host, uri.port)
18
15
  end
19
- res = http.head(url.path.size < 1 ? '/' : url.path)
20
- URI.parse res['location'] rescue return url
16
+ res = http.request(Net::HTTP::Head.new uri.request_uri)
17
+ return uri unless res['location']
18
+ URI.parse res['location'] rescue return uri
21
19
  end
22
20
  end
23
21
 
@@ -1,23 +1,23 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestHugeurl < Test::Unit::TestCase
4
-
5
- def setup
6
- @source = "http://shokai.org"
7
- @tinyurl = URI.parse("http://tinyurl.com/242tthb").to_huge
8
- @tco = URI.parse("http://t.co/sdMbEC7n").to_huge
9
- end
10
-
11
- def test_response
12
- assert true if @tco.class == URI::HTTP
13
- end
14
-
15
- def test_tco
16
- assert true if @tco.to_s == @source
17
- end
18
-
19
- def test_tinyurl
20
- assert true if @tinyurl.to_s == @source
21
- end
22
-
23
- end
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestHugeurl < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @source = "http://shokai.org"
7
+ @tinyurl = URI.parse("http://tinyurl.com/242tthb").to_huge
8
+ @tco = URI.parse("http://t.co/sdMbEC7n").to_huge
9
+ end
10
+
11
+ def test_response
12
+ assert @tco.class == URI::HTTP
13
+ end
14
+
15
+ def test_tco
16
+ assert @tco.to_s == @source
17
+ end
18
+
19
+ def test_tinyurl
20
+ assert @tinyurl.to_s == @source
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,80 +1,75 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hugeurl
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sho Hashimoto
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-10 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rdoc
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 3
31
- - 10
32
- version: "3.10"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: newgem
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.10'
30
+ - !ruby/object:Gem::Dependency
31
+ name: newgem
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 5
44
- segments:
45
- - 1
46
- - 5
47
- - 3
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
48
37
  version: 1.5.3
49
38
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: hoe
53
39
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
55
41
  none: false
56
- requirements:
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: hoe
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
57
51
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 29
60
- segments:
61
- - 2
62
- - 15
63
- version: "2.15"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
64
54
  type: :development
65
- version_requirements: *id003
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
66
62
  description: expand tinyurl, bit.ly, t.co and more.
67
- email:
63
+ email:
68
64
  - hashimoto@shokai.org
69
- executables:
65
+ executables:
70
66
  - hugeurl
71
67
  extensions: []
72
-
73
- extra_rdoc_files:
68
+ extra_rdoc_files:
74
69
  - History.txt
75
70
  - Manifest.txt
76
71
  - README.rdoc
77
- files:
72
+ files:
78
73
  - History.txt
79
74
  - Manifest.txt
80
75
  - README.rdoc
@@ -90,38 +85,30 @@ files:
90
85
  - .gemtest
91
86
  homepage: http://github.com/shokai/hugeurl
92
87
  licenses: []
93
-
94
88
  post_install_message:
95
- rdoc_options:
89
+ rdoc_options:
96
90
  - --main
97
91
  - README.rdoc
98
- require_paths:
92
+ require_paths:
99
93
  - lib
100
- required_ruby_version: !ruby/object:Gem::Requirement
94
+ required_ruby_version: !ruby/object:Gem::Requirement
101
95
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
109
- required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
101
  none: false
111
- requirements:
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- hash: 3
115
- segments:
116
- - 0
117
- version: "0"
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
118
106
  requirements: []
119
-
120
107
  rubyforge_project: hugeurl
121
- rubygems_version: 1.8.17
108
+ rubygems_version: 1.8.24
122
109
  signing_key:
123
110
  specification_version: 3
124
111
  summary: expand tinyurl, bit.ly, t.co and more.
125
- test_files:
112
+ test_files:
126
113
  - test/test_helper.rb
127
114
  - test/test_hugeurl.rb