hugeurl 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,14 @@
1
1
 
2
+ === 0.0.4 2012-04-11
3
+
4
+ * add hugeurl command
5
+
6
+
2
7
  === 0.0.3 2012-04-10
3
8
 
4
9
  * use HTTP-HEAD and check location param of HTTP Response.
5
10
 
11
+
6
12
  === 0.0.1 2010-09-17
7
13
 
8
14
  * start project
@@ -9,3 +9,4 @@ script/generate
9
9
  examples/example.rb
10
10
  test/test_helper.rb
11
11
  test/test_hugeurl.rb
12
+ bin/hugeurl
@@ -13,6 +13,16 @@ expand tinyurl and bit.ly
13
13
  require 'hugeurl'
14
14
  puts URI.parse("http://bit.ly/d4VYD2").to_huge # get expanded URI instance
15
15
 
16
+
17
+ == Hugeurl command
18
+
19
+ % hugeurl http://bit.ly/d4VYD2
20
+
21
+ or
22
+
23
+ % cat foo.txt | hugeurl
24
+
25
+
16
26
  == REQUIREMENTS:
17
27
 
18
28
  * Ruby 1.8+
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'hugeurl'
4
+
5
+ unless ARGV.empty?
6
+ puts URI.parse(ARGV.shift).to_huge
7
+ else
8
+ pat = /(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
9
+ ARGF.each do |line|
10
+ puts line.split(pat).map{|i|
11
+ begin
12
+ res = i =~ pat ? URI.parse(i).to_huge.to_s : i
13
+ rescue
14
+ res = i
15
+ end
16
+ res
17
+ }.join('')
18
+ end
19
+ end
@@ -6,7 +6,7 @@ require 'uri'
6
6
  require 'net/http'
7
7
 
8
8
  module Hugeurl
9
- VERSION = '0.0.3'
9
+ VERSION = '0.0.4'
10
10
  def self.get(url)
11
11
  url = URI.parse url unless url.class.to_s =~ /^URI::/
12
12
  res = Net::HTTP.start(url.host, url.port).
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: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sho Hashimoto
@@ -66,8 +66,8 @@ dependencies:
66
66
  description: expand tinyurl and bit.ly
67
67
  email:
68
68
  - hashimoto@shokai.org
69
- executables: []
70
-
69
+ executables:
70
+ - hugeurl
71
71
  extensions: []
72
72
 
73
73
  extra_rdoc_files:
@@ -86,6 +86,7 @@ files:
86
86
  - examples/example.rb
87
87
  - test/test_helper.rb
88
88
  - test/test_hugeurl.rb
89
+ - bin/hugeurl
89
90
  - .gemtest
90
91
  homepage: http://github.com/shokai/hugeurl
91
92
  licenses: []