em-whois 0.2.0 → 0.3.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.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source :gemcutter
2
2
 
3
3
  gem 'em-synchrony'
4
- gem 'whois', '= 2.5.0' # Locked to specific version as internals of whois gem are overridden
4
+ gem 'whois', '= 2.7.0' # Locked to specific version as internals of whois gem are overridden
5
5
 
6
6
  group :development do
7
7
  gem 'rake'
data/Gemfile.lock CHANGED
@@ -2,19 +2,19 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  diff-lcs (1.1.3)
5
- em-synchrony (1.0.0)
5
+ em-synchrony (1.0.2)
6
6
  eventmachine (>= 1.0.0.beta.1)
7
- eventmachine (1.0.0.beta.4)
7
+ eventmachine (1.0.0)
8
8
  rake (0.9.2.2)
9
- rspec (2.9.0)
10
- rspec-core (~> 2.9.0)
11
- rspec-expectations (~> 2.9.0)
12
- rspec-mocks (~> 2.9.0)
13
- rspec-core (2.9.0)
14
- rspec-expectations (2.9.1)
9
+ rspec (2.11.0)
10
+ rspec-core (~> 2.11.0)
11
+ rspec-expectations (~> 2.11.0)
12
+ rspec-mocks (~> 2.11.0)
13
+ rspec-core (2.11.1)
14
+ rspec-expectations (2.11.3)
15
15
  diff-lcs (~> 1.1.3)
16
- rspec-mocks (2.9.0)
17
- whois (2.5.0)
16
+ rspec-mocks (2.11.3)
17
+ whois (2.7.0)
18
18
 
19
19
  PLATFORMS
20
20
  ruby
@@ -23,4 +23,4 @@ DEPENDENCIES
23
23
  em-synchrony
24
24
  rake
25
25
  rspec
26
- whois (= 2.5.0)
26
+ whois (= 2.7.0)
data/README.md CHANGED
@@ -33,11 +33,6 @@ end
33
33
  Also take a look at `examples/async_whois.rb`.
34
34
 
35
35
 
36
- ## TODO
37
-
38
- * Support for ruby 1.8 (remove em-synchrony/Fiber requirement)
39
-
40
-
41
36
  ## License & Notes
42
37
 
43
38
  The MIT License - Copyright (c) 2012 [Mike Jarema](http://mikejarema.com)
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :patch: 0
3
3
  :major: 0
4
- :minor: 2
4
+ :minor: 3
@@ -0,0 +1,39 @@
1
+ $: << File.dirname(__FILE__) + '/../lib'
2
+ require 'em-whois'
3
+ require 'atomic'
4
+
5
+ # Asynchronous, parallel multi-domain WHOIS lookup
6
+ domains = ARGV.empty? ? ["github.com", "google.com", "bing.com", "yahoo.com", "mikejarema.com"] : ARGV
7
+ whois = {}
8
+
9
+ EM.synchrony do
10
+
11
+ # Progress indicator
12
+ EM.add_periodic_timer(0.1) do
13
+ STDERR.print "."
14
+ end
15
+
16
+ # Exit condition
17
+ EM.add_periodic_timer(0.1) do
18
+ if domains.size == whois.keys.size
19
+ puts ""
20
+ whois.each do |k,v|
21
+ if v.properties[:available?]
22
+ puts "#{k}: available"
23
+ else
24
+ puts "#{k}: taken, expires #{v.properties[:expires_on]}"
25
+ end
26
+ end
27
+
28
+ EM.stop
29
+ end
30
+ end
31
+
32
+ # Async WHOIS lookup - fire and forget via parallel fibers
33
+ domains.each do |i|
34
+ Fiber.new do
35
+ whois[i] = Whois.whois(i)
36
+ end.resume
37
+ end
38
+
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-whois
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-01 00:00:00.000000000 Z
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: em-synchrony
16
- requirement: &70340966931840 !ruby/object:Gem::Requirement
16
+ requirement: &70358519233500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,19 +21,20 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70340966931840
24
+ version_requirements: *70358519233500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: whois
27
- requirement: &70340966931120 !ruby/object:Gem::Requirement
27
+ requirement: &70358519246440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
31
31
  - !ruby/object:Gem::Version
32
- version: 2.5.0
32
+ version: 2.7.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70340966931120
36
- description: Wrapper around whois gem providing asynchronous WHOIS queries via EventMachine
35
+ version_requirements: *70358519246440
36
+ description: Asynchronous WHOIS queries via EventMachine (based on synchronous whois
37
+ gem)
37
38
  email: mike@jarema.com
38
39
  executables: []
39
40
  extensions: []
@@ -46,6 +47,7 @@ files:
46
47
  - Gemfile.lock
47
48
  - Rakefile
48
49
  - examples/async_whois.rb
50
+ - examples/async_parallel_whois.rb
49
51
  - examples/sync_whois.rb
50
52
  - lib/em-whois.rb
51
53
  - spec/em-whois_spec.rb
@@ -75,4 +77,6 @@ rubygems_version: 1.8.11
75
77
  signing_key:
76
78
  specification_version: 3
77
79
  summary: Query WHOIS servers using native EventMachine connection classes.
78
- test_files: []
80
+ test_files:
81
+ - spec/em-whois_spec.rb
82
+ - spec/helper/all.rb