wombat 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -1
- data/VERSION +1 -1
- data/lib/wombat/metadata.rb +3 -3
- data/lib/wombat/parser.rb +1 -1
- data/spec/crawler_spec.rb +4 -5
- data/spec/integration/integration_spec.rb +1 -1
- data/spec/parser_spec.rb +1 -1
- data/wombat.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -62,7 +62,7 @@ end
|
|
62
62
|
```
|
63
63
|
|
64
64
|
### This is just a sneak peek of what Wombat can do. For the complete documentation, please check the [project Wiki](http://github.com/felipecsl/wombat/wiki).
|
65
|
-
### [API Documentation](http://rubydoc.info/gems/wombat/0.
|
65
|
+
### [API Documentation](http://rubydoc.info/gems/wombat/0.5.0/frames).
|
66
66
|
|
67
67
|
|
68
68
|
## Contributing to Wombat
|
@@ -85,6 +85,10 @@ end
|
|
85
85
|
|
86
86
|
### version 1.0.0
|
87
87
|
|
88
|
+
* Breaking change: Metadata#format renamed to Metadata#document_format due to method name clash with [Kernel#format](http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-format)
|
89
|
+
|
90
|
+
### version 0.5.0
|
91
|
+
|
88
92
|
* [Fixed a bug on malformed selectors](https://github.com/felipecsl/wombat/commit/e0f4eec20e1e2bb07a1813a1edd019933edeceaa)
|
89
93
|
* [Fixed a bug where multiple calls to #crawl would not clean up previously iterated array results and yield repeated results](https://github.com/felipecsl/wombat/commit/40b09a5bf8b9ba08aa51b6f41f706b7c3c4e4252)
|
90
94
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/wombat/metadata.rb
CHANGED
@@ -5,7 +5,7 @@ require 'wombat/iterator'
|
|
5
5
|
module Wombat
|
6
6
|
class Metadata < PropertyContainer
|
7
7
|
def initialize
|
8
|
-
self[:
|
8
|
+
self[:document_format] = :html
|
9
9
|
super
|
10
10
|
end
|
11
11
|
|
@@ -17,8 +17,8 @@ module Wombat
|
|
17
17
|
self[:list_page] = url
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
self[:
|
20
|
+
def document_format(format)
|
21
|
+
self[:document_format] = format
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/wombat/parser.rb
CHANGED
data/spec/crawler_spec.rb
CHANGED
@@ -115,9 +115,9 @@ describe Wombat::Crawler do
|
|
115
115
|
|
116
116
|
it 'should assign metadata format' do
|
117
117
|
@crawler_instance.should_receive(:parse) do |arg|
|
118
|
-
arg[:
|
118
|
+
arg[:document_format].should == :xml
|
119
119
|
end
|
120
|
-
@crawler.
|
120
|
+
@crawler.document_format :xml
|
121
121
|
@crawler_instance.crawl
|
122
122
|
end
|
123
123
|
|
@@ -197,7 +197,7 @@ describe Wombat::Crawler do
|
|
197
197
|
@crawler.list_page '/portal'
|
198
198
|
|
199
199
|
@crawler.search "css=.btn-search"
|
200
|
-
@crawler.
|
200
|
+
@crawler.document_format :xml
|
201
201
|
|
202
202
|
@crawler_instance.crawl
|
203
203
|
@crawler_instance.response_code.should be(200)
|
@@ -224,12 +224,11 @@ describe Wombat::Crawler do
|
|
224
224
|
@crawler.list_page '/portal'
|
225
225
|
|
226
226
|
@crawler.search "css=.btn-search"
|
227
|
-
@crawler.
|
227
|
+
@crawler.document_format :xml
|
228
228
|
lambda { @crawler_instance.crawl }.should raise_error(RestClient::ResourceNotFound)
|
229
229
|
@crawler_instance.response_code.should be(404)
|
230
230
|
end
|
231
231
|
end
|
232
|
-
|
233
232
|
end
|
234
233
|
end
|
235
234
|
end
|
@@ -154,7 +154,7 @@ describe 'basic crawler setup' do
|
|
154
154
|
crawler = Class.new
|
155
155
|
crawler.send(:include, Wombat::Crawler)
|
156
156
|
|
157
|
-
crawler.
|
157
|
+
crawler.document_format :xml
|
158
158
|
crawler.base_url "http://ws.audioscrobbler.com"
|
159
159
|
crawler.list_page "/2.0/?method=geo.getevents&location=#{URI.escape('San Francisco')}&api_key=060decb474b73437d5bbec37f527ae7b"
|
160
160
|
|
data/spec/parser_spec.rb
CHANGED
@@ -113,7 +113,7 @@ describe Wombat::Parser do
|
|
113
113
|
it 'should correctly parse xml documents' do
|
114
114
|
fake_document = double :xml
|
115
115
|
fake_parser = double :parser
|
116
|
-
@metadata.
|
116
|
+
@metadata.document_format :xml
|
117
117
|
@parser.mechanize.should_not_receive(:get)
|
118
118
|
RestClient.should_receive(:get).and_return fake_document
|
119
119
|
Nokogiri.should_receive(:XML).with(fake_document).and_return fake_parser
|
data/wombat.gemspec
CHANGED