web_rules 0.0.1 → 0.0.2

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.
@@ -1,6 +1,7 @@
1
1
  require "web_rules/version"
2
2
  require 'nokogiri'
3
3
  require 'open-uri'
4
+ require 'timeout'
4
5
 
5
6
  module WebRules
6
7
 
@@ -8,7 +9,11 @@ module WebRules
8
9
  return if recurse <= 0
9
10
  result = @objects[id]
10
11
  begin
11
- doc = Nokogiri::HTML(open(url))
12
+ doc = ''
13
+ status = Timeout::timeout(4) do
14
+ doc = Nokogiri::HTML(open(url))
15
+ end
16
+ # puts status
12
17
  rescue Exception => e
13
18
  puts e,"----",url
14
19
  return nil
@@ -23,6 +28,7 @@ module WebRules
23
28
  next
24
29
  end
25
30
  result[r['href']] = url
31
+ print "."
26
32
  a = r['href']
27
33
  begin
28
34
  a = URI::HTTP.build({:host => URI.parse(host).host, :path => r['href']}).to_s if uri.host.nil?
@@ -43,7 +49,8 @@ module WebRules
43
49
  host = URI::HTTP.build({host: uri.host}).to_s
44
50
  id = unique_id
45
51
  @objects[id] = {}
46
- recurse_select_refs(host, url, 2, id)
52
+ recurse_select_refs(host, url, level, id)
53
+ puts "+"
47
54
  # puts "-----------------------", @objects[id].length
48
55
  @data_stack.push id
49
56
  end
@@ -1,3 +1,3 @@
1
1
  module WebRules
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: web_rules
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:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-13 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Hi level web access library got rules
15
15
  email: