check_http 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -2
- data/lib/check_http/cli.rb +13 -6
- data/lib/check_http/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -18,14 +18,20 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
Via the command line:
|
21
|
+
### Via the command line:
|
22
22
|
|
23
23
|
```bash
|
24
24
|
$ check_http http://www.github.com
|
25
25
|
# return_code=ok total_time=0.209625 connect_time=0.111266 namelookup_time=0.028197 effective_url=http://www.github.com primary_ip=207.97.227.243 response_code=301 redirect_count=0 url=http://www.github.com
|
26
26
|
```
|
27
27
|
|
28
|
-
|
28
|
+
You can also stream urls into it:
|
29
|
+
|
30
|
+
```bash
|
31
|
+
$ cat list_or_urls.txt | check_http
|
32
|
+
```
|
33
|
+
|
34
|
+
### Via the lib:
|
29
35
|
|
30
36
|
```ruby
|
31
37
|
require 'check_http'
|
data/lib/check_http/cli.rb
CHANGED
@@ -1,16 +1,23 @@
|
|
1
1
|
module CheckHTTP
|
2
2
|
class CLI
|
3
|
+
def perform(url)
|
4
|
+
result = CheckHTTP.check(url.strip)
|
5
|
+
puts KV.unparse(result)
|
6
|
+
end
|
7
|
+
|
3
8
|
def run
|
4
9
|
opts = {}
|
5
10
|
ARGV.options do |o|
|
6
|
-
o.banner = 'Usage: check_http
|
11
|
+
o.banner = 'Usage: check_http [url]'
|
7
12
|
o.parse!
|
8
|
-
url = ARGV.shift
|
9
|
-
|
10
|
-
abort("Error: url not provided.\n\n#{o}") unless url
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
if url = ARGV.shift
|
15
|
+
perform(url)
|
16
|
+
else
|
17
|
+
ARGF.each_line do |url|
|
18
|
+
perform(url)
|
19
|
+
end
|
20
|
+
end
|
14
21
|
end
|
15
22
|
end
|
16
23
|
end
|
data/lib/check_http/version.rb
CHANGED