http_status_checker 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e467b34263ad465437e1f6d08eb2dd5a13225421
4
- data.tar.gz: bbaacf45465a7f11d026f22ec46abebd4e356adb
3
+ metadata.gz: 22ef65c136b6eda46dfc0355b0568bcaac9377f2
4
+ data.tar.gz: 089b81cceedad49b06ed255eb52fd3b276c0ec22
5
5
  SHA512:
6
- metadata.gz: 96f2bec538fe36d31dc17983fed733fdba2c9758472421d8eab6d5617145a59cd7b126dba612148516432ee036bf775d2d816d0b01916b244e11b18d39fd83c0
7
- data.tar.gz: 2b2cd057aa67baa88abd4838524998fb9e60fe972616c6bbf621a9d56971ca6255eb315d9af42e585b849984138c84af33eca310b68957672add7cfdac83cbb2
6
+ metadata.gz: 92974f4e00c1f4344318e139402da46109123631fb1e17db18b432f76e0b8ac1a0d4f96d89663118abcb61fd41c2ec46e8a3f3d550237365865844b6ee1bf504
7
+ data.tar.gz: 1db50c138353d1367ca5bf9fb7e535573a1b2dcee7a65564c47b146c4b50497595eef6afe11868434966e9a7bfa2413b23c6ba79844764078225ad04dd7bc2a8
data/.travis.yml CHANGED
@@ -3,8 +3,9 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.5
6
+ - 2.2.0
6
7
  bundler_args: --jobs=2
7
- script: bundle exec rspec
8
+ script: CODECLIMATE_REPO_TOKEN=447dc71fd8e33c83633ed56349a98a676c4f27519a452df8bd871c3320b369ff bundle exec rspec
8
9
  branches:
9
10
  only:
10
11
  - master
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # HttpStatusChecker
1
+ # HttpStatusChecker [![Build Status](https://travis-ci.org/morizyun/http_status_checker.svg)](https://travis-ci.org/morizyun/http_status_checker) [![Code Climate](https://codeclimate.com/github/morizyun/http_status_checker/badges/gpa.svg)](https://codeclimate.com/github/morizyun/http_status_checker) [![Test Coverage](https://codeclimate.com/github/morizyun/http_status_checker/badges/coverage.svg)](https://codeclimate.com/github/morizyun/http_status_checker)
2
2
 
3
3
  Easily Checking http status by http header with Multi-threaded
4
4
 
@@ -24,15 +24,21 @@ Or install it yourself as:
24
24
 
25
25
  $ gem install http_status_checker
26
26
 
27
- ## Usage Command Line
27
+ ## Usage on Command Line
28
28
 
29
- $ http_status_checker http://morizyun.github.io
29
+ $ http_status_checker -u http://morizyun.github.io
30
+ #=> url: http://morizyun.github.io
31
+ #=> response: {:code=>"200", :is_alive=>true, :redirect_url=>nil}
30
32
 
31
- ## Usage Ruby Program
33
+ ## Usage on Ruby Program
32
34
 
33
35
  require 'http_status_checker'
34
36
 
35
- HttpStatusChecker.check ['http://morizyun.github.io', 'http://www.yahoo.co.jp']
37
+ urls = ['http://morizyun.github.io', 'http://www.yahoo.co.jp']
38
+ interval_sec = 1
39
+ HttpStatusChecker.check urls, interval_sec
40
+ #=> [{"http://morizyun.github.io"=>{:code=>"200", :is_alive=>true, :redirect_url=>nil}},
41
+ #=> {"http://www.yahoo.co.jp"=>{:code=>"200", :is_alive=>true, :redirect_url=>nil}}]
36
42
 
37
43
  ## Contributing
38
44
 
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 1.9.3'
22
22
  spec.add_dependency 'thor'
23
23
  spec.add_dependency 'parallel'
24
+ spec.add_dependency 'domainatrix'
24
25
  spec.add_development_dependency 'bundler', '~> 1.7'
25
26
  spec.add_development_dependency 'rake'
26
27
  spec.add_development_dependency 'rspec'
@@ -1,5 +1,5 @@
1
+ require 'domainatrix'
1
2
  require 'net/http'
2
- require 'open-uri'
3
3
  require 'parallel'
4
4
 
5
5
  require 'http_status_checker/version'
@@ -49,7 +49,7 @@ module HttpStatusChecker
49
49
 
50
50
  host_hash = {}
51
51
  urls.each do |url|
52
- host = URI.parse(url).host.to_sym
52
+ host = Domainatrix.parse(url).domain.to_sym
53
53
  host_hash[host] = host_hash[host].nil? ? [url] : host_hash[host] << url
54
54
  end
55
55
  return host_hash
@@ -1,3 +1,3 @@
1
1
  module HttpStatusChecker
2
- VERSION = '0.0.9'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -104,8 +104,7 @@ describe HttpStatusChecker::Connection do
104
104
  context 'when post 2urls' do
105
105
  it 'returns host with urls array in hash' do
106
106
  host_hash = HttpStatusChecker.__send__(:to_host_hash, [valid_url, redirect_url])
107
- expect(host_hash['www.yahoo.co.jp'.to_sym]).to eq([valid_url])
108
- expect(host_hash['yahoo.co.jp'.to_sym]).to eq([redirect_url])
107
+ expect(host_hash['yahoo'.to_sym]).to eq([valid_url, redirect_url])
109
108
  end
110
109
  end
111
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_status_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - morizyun
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: domainatrix
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement