grd 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/grd +3 -10
- data/lib/grd/version.rb +1 -1
- data/lib/grd.rb +14 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjdmODQ1Y2MwOGM3YWMzYzA1MzA2MDRmMjVkNmQ0YjI3YmMxY2M1Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzRmYzViYzhkNjU3ZDI3N2QzZTc5Y2MxM2E4MTdkN2E3NTg5Yzc0Nw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Yjk5Yzc1MGYxMDhhMTFjZGJlMGIxMDgxOWJkY2Y5YjhmY2U1Y2FjMmZiNTFl
|
10
|
+
YWIyMTlkNTZjNDBkMjM1ZDU4ZGZjMzMxYzQzYmFkYTdkNzcyMzdlNTBkYjVj
|
11
|
+
MWVmYzgwNjYyZDAwM2Q2ZTU4ZWU5OWI1ZWRjNDMzNTM1YzBhOWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTg3OWZiZmQ0ZmExZTkyODBmN2NhNTdiYjg4YTdlZDM4NTU4ZWRlZWM1MDdk
|
14
|
+
ZTNhOTk2ZGRlNjY3ZjdjYmZlYTNjNjJlMWJiNzM1MzVlYjdhMGEzZDBmOTcy
|
15
|
+
YjAxNTAwMDY2NDk5N2JiODFiN2Y0MDU4MDY4MzMxNzk0ZWRmODE=
|
data/bin/grd
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
2
|
+
#$: << File.join(File.dirname(__FILE__), '../lib')
|
3
|
+
require 'grd'
|
3
4
|
# GRD (Get ReDirect)
|
4
5
|
|
5
6
|
begin
|
6
|
-
|
7
|
-
|
8
|
-
val = ARGV[0].dup
|
9
|
-
val.prepend('http://') unless !!val['http://']
|
10
|
-
uri = URI.parse val
|
11
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
12
|
-
puts Net::HTTP.new(uri.host).start { |server|
|
13
|
-
server.request(req)
|
14
|
-
}["location"]
|
7
|
+
GRD::getredirect(ARGV[0])
|
15
8
|
rescue Exception => e
|
16
9
|
puts "Get ReDirect: Get the URL redirection."
|
17
10
|
puts "by Daniel P. Clark / License: The MIT License"
|
data/lib/grd/version.rb
CHANGED
data/lib/grd.rb
CHANGED
@@ -1 +1,14 @@
|
|
1
|
-
require 'grd/version'
|
1
|
+
require 'grd/version'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
module GRD
|
5
|
+
def self.getredirect(in_url)
|
6
|
+
val = in_url.dup
|
7
|
+
val.prepend('http://') unless !!val['http://']
|
8
|
+
uri = URI.parse val
|
9
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
10
|
+
puts Net::HTTP.new(uri.host).start { |server|
|
11
|
+
server.request(req)
|
12
|
+
}["location"]
|
13
|
+
end
|
14
|
+
end
|