matthewgarysmith-rubypodder 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubypodder.rb +6 -3
- data/tests/tc_rubypodder.rb +11 -0
- metadata +6 -3
data/lib/rubypodder.rb
CHANGED
@@ -57,7 +57,7 @@ class RubyPodder
|
|
57
57
|
|
58
58
|
def read_feeds
|
59
59
|
#IO.readlines(@conf_file).each {|l| l.chomp!}
|
60
|
-
|
60
|
+
rio(@conf_file).chomp.readlines.reject {|i| i =~ /^#/}
|
61
61
|
end
|
62
62
|
|
63
63
|
def parse_rss(rss_source)
|
@@ -78,12 +78,15 @@ class RubyPodder
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def record_download(url, guid)
|
81
|
+
if guid
|
82
|
+
rio(@done_file) << "#{guid}\n"
|
83
|
+
end
|
81
84
|
rio(@done_file) << "#{url}\n"
|
82
|
-
rio(@done_file) << "#{guid}\n"
|
83
85
|
end
|
84
86
|
|
87
|
+
|
85
88
|
def already_downloaded(url, guid)
|
86
|
-
previously_downloaded = [url
|
89
|
+
previously_downloaded = [url, guid].compact.map{ |s| s.strip.downcase }
|
87
90
|
File.open(@done_file).detect do |line|
|
88
91
|
previously_downloaded.include?(line.strip.downcase)
|
89
92
|
end
|
data/tests/tc_rubypodder.rb
CHANGED
@@ -209,6 +209,17 @@ class TC_RubyPodder < Test::Unit::TestCase
|
|
209
209
|
assert(@rp.already_downloaded(url3, guid1), "url3 should be already downloaded because it is using giud1")
|
210
210
|
end
|
211
211
|
|
212
|
+
def test_already_downloaded_no_guid
|
213
|
+
url = "http://www.google.com/index.html"
|
214
|
+
guid = nil
|
215
|
+
assert(!@rp.already_downloaded(url, guid), "url should not be already downloaded before download of url")
|
216
|
+
@rp.download(url, guid)
|
217
|
+
File.open( @rp.log_file ) do |f|
|
218
|
+
return if (f.any? { |line| line =~ /ERROR/ }) # Don't test this case if no internet connection
|
219
|
+
end
|
220
|
+
assert(@rp.already_downloaded(url, guid), "url should be already downloaded after download of url")
|
221
|
+
end
|
222
|
+
|
212
223
|
def test_download_omits_done_items
|
213
224
|
dest_file = @rp.date_dir + "/" + "index.html"
|
214
225
|
system("rm -rf " + dest_file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matthewgarysmith-rubypodder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lex Miller
|
@@ -9,11 +9,12 @@ autorequire: rubypodder
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-15 00:00:00 -07:00
|
13
13
|
default_executable: rubypodder
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rio
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: rake
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -32,6 +34,7 @@ dependencies:
|
|
32
34
|
version:
|
33
35
|
- !ruby/object:Gem::Dependency
|
34
36
|
name: mocha
|
37
|
+
type: :runtime
|
35
38
|
version_requirement:
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
@@ -51,8 +54,8 @@ extra_rdoc_files:
|
|
51
54
|
files:
|
52
55
|
- lib/rubypodder.rb
|
53
56
|
- tests/tc_rubypodder.rb
|
54
|
-
- tests/ts_rubypodder.rb
|
55
57
|
- tests/tc_stdout.rb
|
58
|
+
- tests/ts_rubypodder.rb
|
56
59
|
- Rakefile
|
57
60
|
- README
|
58
61
|
- MIT-LICENSE
|