spandex 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spandex/finder.rb +3 -2
- data/lib/spandex/version.rb +1 -1
- data/spec/finder_spec.rb +4 -3
- metadata +1 -1
data/lib/spandex/finder.rb
CHANGED
@@ -28,7 +28,7 @@ module Spandex
|
|
28
28
|
roots = []
|
29
29
|
@pages ||= CaseInsensitiveHash.new
|
30
30
|
Dir.glob(File.join(@base_dir, "**/*"))
|
31
|
-
.map{|path|
|
31
|
+
.map{|path| Pathname.new(path)}
|
32
32
|
.select{|path| Page.registered?(path)}
|
33
33
|
.each{|path| load(path)}
|
34
34
|
@pages.values
|
@@ -52,10 +52,11 @@ module Spandex
|
|
52
52
|
@tags ||= all_pages.map{|p| p.tags}.flatten.uniq
|
53
53
|
end
|
54
54
|
|
55
|
-
def atom_feed(count, author, root, path_to_xml)
|
55
|
+
def atom_feed(count, title, author, root, path_to_xml)
|
56
56
|
articles = all_articles.take(count)
|
57
57
|
Atom::Feed.new do |f|
|
58
58
|
f.id = root
|
59
|
+
f.title = title
|
59
60
|
f.links << Atom::Link.new(:href => "http://#{root}#{path_to_xml}", :rel => "self")
|
60
61
|
f.links << Atom::Link.new(:href => "http://#{root}", :rel => "alternate")
|
61
62
|
f.authors << Atom::Person.new(:name => author)
|
data/lib/spandex/version.rb
CHANGED
data/spec/finder_spec.rb
CHANGED
@@ -72,9 +72,10 @@ describe Spandex::Finder do
|
|
72
72
|
create_file("more_stuff.md", :date => "1982/5/25")
|
73
73
|
|
74
74
|
#generate and then reparse
|
75
|
-
feed = make_finder.atom_feed(3, "The Sounds", "sounds.test.org", "articles.xml")
|
75
|
+
feed = make_finder.atom_feed(3, "Living in America", "The Sounds", "sounds.test.org", "articles.xml")
|
76
76
|
ratom = Atom::Feed.load_feed(feed)
|
77
77
|
|
78
|
+
ratom.title.should == "Living in America"
|
78
79
|
ratom.entries.size.should == 2
|
79
80
|
ratom.authors.first.name.should == "The Sounds"
|
80
81
|
ratom.links.size.should == 2
|
@@ -89,7 +90,7 @@ describe Spandex::Finder do
|
|
89
90
|
create_file("more_stuff.md", :date => "1986/5/25")
|
90
91
|
create_file("even_more_stuff.md", :date => "1986/5/25")
|
91
92
|
|
92
|
-
feed = make_finder.atom_feed(2, "The Sounds", "sounds.test.org", "articles.xml")
|
93
|
+
feed = make_finder.atom_feed(2, "Living in America", "The Sounds", "sounds.test.org", "articles.xml")
|
93
94
|
ratom = Atom::Feed.load_feed(feed)
|
94
95
|
|
95
96
|
ratom.entries.size.should == 2
|
@@ -99,7 +100,7 @@ describe Spandex::Finder do
|
|
99
100
|
create_file("stuff.md", :date => "2011/5/25")
|
100
101
|
create_file("more_stuff.md")
|
101
102
|
|
102
|
-
feed = make_finder.atom_feed(2, "The Sounds", "sounds.test.org", "articles.xml")
|
103
|
+
feed = make_finder.atom_feed(2, "Living in America", "The Sounds", "sounds.test.org", "articles.xml")
|
103
104
|
ratom = Atom::Feed.load_feed(feed)
|
104
105
|
|
105
106
|
ratom.entries.size.should == 1
|