hugeurl 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +1 -0
- data/README.rdoc +10 -0
- data/bin/hugeurl +19 -0
- data/lib/hugeurl.rb +1 -1
- metadata +6 -5
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -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+
|
data/bin/hugeurl
ADDED
@@ -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
|
data/lib/hugeurl.rb
CHANGED
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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: []
|