spidey-mongo 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spidey-mongo/version.rb +1 -1
- data/lib/spidey/strategies/mongo.rb +3 -3
- data/spidey-mongo.gemspec +1 -2
- metadata +36 -22
data/lib/spidey-mongo/version.rb
CHANGED
@@ -16,7 +16,7 @@ module Spidey::Strategies
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def handle(url, handler, default_data = {})
|
19
|
-
|
19
|
+
Spidey.logger.info "Queueing #{url.inspect[0..200]}..."
|
20
20
|
url_collection.update(
|
21
21
|
{'spider' => self.class.name, 'url' => url},
|
22
22
|
{'$set' => {'handler' => handler, 'default_data' => default_data}},
|
@@ -26,7 +26,7 @@ module Spidey::Strategies
|
|
26
26
|
|
27
27
|
def record(data)
|
28
28
|
doc = data.merge('spider' => self.class.name)
|
29
|
-
|
29
|
+
Spidey.logger.info "Recording #{doc.inspect[0..500]}..."
|
30
30
|
if respond_to?(:result_key) && key = result_key(doc)
|
31
31
|
result_collection.update({'key' => key}, {'$set' => doc}, upsert: true)
|
32
32
|
else
|
@@ -46,7 +46,7 @@ module Spidey::Strategies
|
|
46
46
|
error = attrs.delete(:error)
|
47
47
|
doc = attrs.merge(created_at: Time.now, error: error.class.name, message: error.message, spider: self.class.name)
|
48
48
|
error_collection.insert doc
|
49
|
-
|
49
|
+
Spidey.logger.error "Error on #{attrs[:url]}. #{error.class}: #{error.message}"
|
50
50
|
end
|
51
51
|
|
52
52
|
private
|
data/spidey-mongo.gemspec
CHANGED
@@ -21,9 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_development_dependency "rake"
|
23
23
|
s.add_development_dependency "rspec"
|
24
|
-
s.add_development_dependency "ruby-debug19"
|
25
24
|
|
26
|
-
s.add_runtime_dependency "spidey"
|
25
|
+
s.add_runtime_dependency "spidey", ">= 0.1.0"
|
27
26
|
s.add_runtime_dependency "mongo"
|
28
27
|
s.add_runtime_dependency "bson_ext"
|
29
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spidey-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.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:
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,32 +37,31 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: ruby-debug19
|
38
|
-
requirement: &70172417845560 !ruby/object:Gem::Requirement
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
42
|
requirements:
|
41
43
|
- - ! '>='
|
42
44
|
- !ruby/object:Gem::Version
|
43
45
|
version: '0'
|
44
|
-
type: :development
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70172417845560
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
47
|
name: spidey
|
49
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
50
49
|
none: false
|
51
50
|
requirements:
|
52
51
|
- - ! '>='
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
53
|
+
version: 0.1.0
|
55
54
|
type: :runtime
|
56
55
|
prerelease: false
|
57
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.0
|
58
62
|
- !ruby/object:Gem::Dependency
|
59
63
|
name: mongo
|
60
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
61
65
|
none: false
|
62
66
|
requirements:
|
63
67
|
- - ! '>='
|
@@ -65,10 +69,15 @@ dependencies:
|
|
65
69
|
version: '0'
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: bson_ext
|
71
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
72
81
|
none: false
|
73
82
|
requirements:
|
74
83
|
- - ! '>='
|
@@ -76,7 +85,12 @@ dependencies:
|
|
76
85
|
version: '0'
|
77
86
|
type: :runtime
|
78
87
|
prerelease: false
|
79
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
80
94
|
description: Implements a MongoDB back-end for Spidey, a framework for crawling and
|
81
95
|
scraping web sites.
|
82
96
|
email:
|
@@ -111,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
125
|
version: '0'
|
112
126
|
segments:
|
113
127
|
- 0
|
114
|
-
hash:
|
128
|
+
hash: 4205551958644275814
|
115
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
130
|
none: false
|
117
131
|
requirements:
|
@@ -120,10 +134,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
134
|
version: '0'
|
121
135
|
segments:
|
122
136
|
- 0
|
123
|
-
hash:
|
137
|
+
hash: 4205551958644275814
|
124
138
|
requirements: []
|
125
139
|
rubyforge_project: spidey-mongo
|
126
|
-
rubygems_version: 1.8.
|
140
|
+
rubygems_version: 1.8.25
|
127
141
|
signing_key:
|
128
142
|
specification_version: 3
|
129
143
|
summary: Implements a MongoDB back-end for Spidey, a framework for crawling and scraping
|