jsl-feedzirra 0.0.12.5 → 0.0.12.6
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.
@@ -11,6 +11,7 @@ module Feedzirra
|
|
11
11
|
|
12
12
|
def initialize(options = { })
|
13
13
|
@options = DEFAULTS.merge(options)
|
14
|
+
initialize_store
|
14
15
|
end
|
15
16
|
|
16
17
|
def get(url)
|
@@ -24,6 +25,10 @@ module Feedzirra
|
|
24
25
|
|
25
26
|
private
|
26
27
|
|
28
|
+
def initialize_store
|
29
|
+
FileUtils.mkdir(@options[:path]) unless File.exist?(@options[:path])
|
30
|
+
end
|
31
|
+
|
27
32
|
def filename_for(url)
|
28
33
|
File.join(@options[:path], MD5.hexdigest(URI.parse(url).normalize.to_s))
|
29
34
|
end
|
data/lib/feedzirra/http_multi.rb
CHANGED
@@ -17,7 +17,7 @@ module Feedzirra
|
|
17
17
|
@retrievables = args.flatten
|
18
18
|
@multi = Curl::Multi.new
|
19
19
|
@responses = { }
|
20
|
-
@backend = @options[:backend][:class].new
|
20
|
+
@backend = @options[:backend][:class].new(@options[:backend].except(:class))
|
21
21
|
end
|
22
22
|
|
23
23
|
# Prepares the curl object and calls #perform
|
data/lib/feedzirra.rb
CHANGED
@@ -20,4 +20,12 @@ describe Feedzirra::Backend::Filesystem do
|
|
20
20
|
Feedzirra::Backend::Filesystem.new({:path => '/tmp'}).__send__(:filename_for, 'hey').should == '/tmp/bah'
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
describe "#initialize_store" do
|
25
|
+
it "should call File.mkdir if the directory does not exist" do
|
26
|
+
File.expects(:exist?).with('/tmp').returns(false)
|
27
|
+
FileUtils.expects(:mkdir).with('/tmp')
|
28
|
+
@backend.__send__(:initialize_store)
|
29
|
+
end
|
30
|
+
end
|
23
31
|
end
|