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 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
- Via the lib:
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'
@@ -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 <url>'
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
- result = CheckHTTP.check(url)
13
- puts KV.unparse(result)
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
@@ -1,3 +1,3 @@
1
1
  module CheckHTTP
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: check_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: