audrey2 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/audrey2.gemspec +23 -36
- data/lib/audrey2.rb +28 -6
- data/test/test_helper.rb +70 -0
- metadata +11 -19
- data/.gitignore +0 -21
data/README.rdoc
CHANGED
@@ -15,8 +15,8 @@ existing installations. They are all very easy to deal with:
|
|
15
15
|
1) The default location of the configuration file has moved from /etc/audrey2/audrey2.conf
|
16
16
|
to /etc/audrey2.conf
|
17
17
|
|
18
|
-
2) In a theme's entry.haml when you reference data in the
|
19
|
-
the hash using symbols rather than strings:
|
18
|
+
2) In a theme's entry.haml when you reference data in the source hash you now need to index
|
19
|
+
the hash using symbols rather than strings: source[:name] replaces source['name'].
|
20
20
|
|
21
21
|
3) If email notification of errors is configured via SMTP you now need to identify the
|
22
22
|
SMTP server with the key 'address' instead of 'server' in Audrey 2.0's configuration file.
|
data/Rakefile
CHANGED
@@ -11,9 +11,9 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/svenaas/audrey2"
|
12
12
|
gem.authors = ["Sven Aas"]
|
13
13
|
gem.add_dependency "feed-normalizer", "~>1.5.2"
|
14
|
-
gem.add_dependency "haml", "~>3.0.13"
|
14
|
+
gem.add_dependency "haml", "~>3.0.13"
|
15
15
|
gem.add_development_dependency "shoulda", ">= 2.11.1"
|
16
|
-
gem.add_development_dependency "mocha", ">= 0.9.8"
|
16
|
+
gem.add_development_dependency "mocha", ">= 0.9.8"
|
17
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
18
|
end
|
19
19
|
Jeweler::GemcutterTasks.new
|
@@ -45,7 +45,7 @@ task :test => :check_dependencies
|
|
45
45
|
|
46
46
|
task :default => :test
|
47
47
|
|
48
|
-
require '
|
48
|
+
require 'rdoc/task'
|
49
49
|
Rake::RDocTask.new do |rdoc|
|
50
50
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
51
51
|
|
@@ -53,4 +53,4 @@ Rake::RDocTask.new do |rdoc|
|
|
53
53
|
rdoc.title = "audrey2 #{version}"
|
54
54
|
rdoc.rdoc_files.include('README*')
|
55
55
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
-
end
|
56
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/audrey2.gemspec
CHANGED
@@ -1,63 +1,50 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{audrey2}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sven Aas"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2013-02-12}
|
13
13
|
s.default_executable = %q{feedme}
|
14
14
|
s.description = %q{Audrey 2.0 is a command-line utility for customizable feed processing, aggregation, and output.}
|
15
15
|
s.email = %q{sven.aas@gmail.com}
|
16
16
|
s.executables = ["feedme"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
19
|
+
"README.rdoc"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"audrey2.conf.sample",
|
28
|
+
"audrey2.gemspec",
|
29
|
+
"bin/feedme",
|
30
|
+
"lib/audrey2.rb",
|
31
|
+
"test/helper.rb",
|
32
|
+
"test/test_config.rb",
|
33
|
+
"test/test_email.rb",
|
34
|
+
"test/test_helper.rb",
|
35
|
+
"test/test_misc.rb",
|
36
|
+
"test/test_options.rb",
|
37
|
+
"test/test_parse.rb",
|
38
|
+
"test/test_recipes.rb",
|
39
|
+
"test/test_sort.rb",
|
40
|
+
"test/test_themes.rb"
|
41
41
|
]
|
42
42
|
s.homepage = %q{http://github.com/svenaas/audrey2}
|
43
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
44
43
|
s.require_paths = ["lib"]
|
45
|
-
s.rubygems_version = %q{1.
|
44
|
+
s.rubygems_version = %q{1.4.2}
|
46
45
|
s.summary = %q{Feed processing and aggregation}
|
47
|
-
s.test_files = [
|
48
|
-
"test/helper.rb",
|
49
|
-
"test/test_config.rb",
|
50
|
-
"test/test_email.rb",
|
51
|
-
"test/test_misc.rb",
|
52
|
-
"test/test_options.rb",
|
53
|
-
"test/test_parse.rb",
|
54
|
-
"test/test_recipes.rb",
|
55
|
-
"test/test_sort.rb",
|
56
|
-
"test/test_themes.rb"
|
57
|
-
]
|
58
46
|
|
59
47
|
if s.respond_to? :specification_version then
|
60
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
61
48
|
s.specification_version = 3
|
62
49
|
|
63
50
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/audrey2.rb
CHANGED
@@ -24,6 +24,28 @@ module HashExtensions # Adapted from http://gist.github.com/151324 by Avdi Grimm
|
|
24
24
|
end
|
25
25
|
Hash.send(:include, HashExtensions)
|
26
26
|
|
27
|
+
# Monkeypatch to get alternate link rather than comments Atom feed for blogspot Atom feed entries
|
28
|
+
# Adapted from https://github.com/jbrownlee/AIFeeds/blob/master/part1/parserss.rb
|
29
|
+
module FeedNormalizer
|
30
|
+
class SimpleRssParser < Parser
|
31
|
+
def self.parse(xml, loose)
|
32
|
+
begin
|
33
|
+
atomrss = parser.parse(xml)
|
34
|
+
rescue Exception => e
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
|
38
|
+
atomrss.items.each do |item|
|
39
|
+
if item[:'link+alternate']
|
40
|
+
item[:link] = item[:'link+alternate']
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
package(atomrss)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
27
49
|
module Audrey2
|
28
50
|
class Options
|
29
51
|
def self.parse(args)
|
@@ -125,7 +147,7 @@ EOF
|
|
125
147
|
mail[:to] = @email[:to]
|
126
148
|
mail[:subject] = "[AUDREY 2.0] Exception Notification"
|
127
149
|
mail[:body] = e
|
128
|
-
|
150
|
+
|
129
151
|
@email[:via] ||= 'sendmail' # Do this somewhere else?
|
130
152
|
case @email[:via].to_sym # Do this somewhere else too?
|
131
153
|
when :sendmail
|
@@ -191,13 +213,13 @@ EOF
|
|
191
213
|
end
|
192
214
|
end
|
193
215
|
|
194
|
-
# Implements sort orders which may be specified in configuration
|
216
|
+
# Implements sort orders which may be specified in configuration
|
195
217
|
def entry_sort_comparator(sort = @sort) # Defaults to the sort order specified in configuration
|
196
218
|
case sort
|
197
219
|
when :reverse_chronological
|
198
|
-
Proc.new {|a, b| b.date_published <=> a.date_published }
|
220
|
+
Proc.new {|a, b| b.date_published <=> a.date_published }
|
199
221
|
when :chronological
|
200
|
-
Proc.new {|a, b| a.date_published <=> b.date_published }
|
222
|
+
Proc.new {|a, b| a.date_published <=> b.date_published }
|
201
223
|
end
|
202
224
|
end
|
203
225
|
|
@@ -223,7 +245,7 @@ EOF
|
|
223
245
|
parsed_feed.entries.sort!(&entry_sort_comparator)
|
224
246
|
parsed_feed.entries.slice!(feed[:max_entries], parsed_feed.entries.size - feed[:max_entries])
|
225
247
|
end
|
226
|
-
|
248
|
+
|
227
249
|
# Store the entry sources. TODO: Store this information in the entries themselves
|
228
250
|
parsed_feed.entries.each { |entry| entry_sources[entry] = feed }
|
229
251
|
|
@@ -302,4 +324,4 @@ EOF
|
|
302
324
|
end
|
303
325
|
end
|
304
326
|
|
305
|
-
end
|
327
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestParse < Test::Unit::TestCase
|
4
|
+
context "With an initialized, configured Aggregator, helper methods" do
|
5
|
+
setup do
|
6
|
+
@config
|
7
|
+
File.stubs(:exist?).with('configfile').returns(true)
|
8
|
+
File.stubs(:readable?).with('configfile').returns(true)
|
9
|
+
YAML.stubs(:load_file).with('configfile').returns({
|
10
|
+
'recipes_folder' => 'recipes_folder',
|
11
|
+
'themes_folder' => 'themes_folder',
|
12
|
+
'user_agent' => 'user_agent',
|
13
|
+
'sort' => 'sort'
|
14
|
+
})
|
15
|
+
File.stubs(:exist?).with('recipes_folder').returns(true)
|
16
|
+
File.stubs(:readable?).with('recipes_folder').returns(true)
|
17
|
+
File.stubs(:exist?).with('themes_folder').returns(true)
|
18
|
+
File.stubs(:readable?).with('themes_folder').returns(true)
|
19
|
+
@aggregator = Audrey2::Aggregator.new('configfile')
|
20
|
+
recipefile = File.join('recipes_folder', 'recipe')
|
21
|
+
outputfile = File.join('output_folder', 'output_file')
|
22
|
+
File.stubs(:exist?).with(recipefile).returns(true)
|
23
|
+
File.stubs(:readable?).with(recipefile).returns(true)
|
24
|
+
@feed = { 'name' => 'feed', 'url' => 'http://test.com/feed.xml' }
|
25
|
+
YAML.stubs(:load_file).with(recipefile).returns({
|
26
|
+
'feeds' => [@feed],
|
27
|
+
'theme' => 'theme',
|
28
|
+
'output_file' => outputfile
|
29
|
+
})
|
30
|
+
File.stubs(:exist?).with('output_folder').returns(true)
|
31
|
+
File.stubs(:writable?).with('output_folder').returns(true)
|
32
|
+
File.stubs(:exist?).with(outputfile).returns(false)
|
33
|
+
theme_path = File.join('themes_folder', 'theme')
|
34
|
+
File.stubs(:exist?).with(theme_path).returns(true)
|
35
|
+
File.stubs(:readable?).with(theme_path).returns(true)
|
36
|
+
entry_template_path = File.join(theme_path, 'entry.haml')
|
37
|
+
File.stubs(:exist?).with(entry_template_path).returns(true)
|
38
|
+
File.stubs(:readable?).with(entry_template_path).returns(true)
|
39
|
+
File.stubs(:read).with(entry_template_path).returns('%p= foo')
|
40
|
+
@helpers_file_path = File.join(theme_path, 'helpers.rb')
|
41
|
+
feed_content =<<-EOF
|
42
|
+
<?xml version="1.0"?>
|
43
|
+
<rss version="2.0">
|
44
|
+
<channel>
|
45
|
+
<title>Test</title>
|
46
|
+
<link>http://test.com/</link>
|
47
|
+
<description>Test channel</description>
|
48
|
+
<item>
|
49
|
+
<title>Title</title>
|
50
|
+
<link>http://test.com/title</link>
|
51
|
+
<description>Test description</description>
|
52
|
+
<pubDate>Sun, 15 Aug 2010 16:46:00 EDT</pubDate>
|
53
|
+
</item>
|
54
|
+
</channel>
|
55
|
+
</rss>
|
56
|
+
EOF
|
57
|
+
@aggregator.stubs(:open).with('http://test.com/feed.xml', {'User-Agent' => 'user_agent'}).returns(feed_content)
|
58
|
+
end
|
59
|
+
|
60
|
+
should 'be available in the template' do
|
61
|
+
File.expects(:exist?).with(@helpers_file_path).returns(true)
|
62
|
+
File.expects(:readable?).with(@helpers_file_path).returns(true)
|
63
|
+
File.expects(:open).with(@helpers_file_path).returns("def foo; 'bar'; end")
|
64
|
+
s = StringIO.new
|
65
|
+
s.expects(:<<).with("<p>bar</p>\n")
|
66
|
+
File.stubs(:open).with(File.join('output_folder', 'output_file'), 'w').yields s
|
67
|
+
@aggregator.feed_me('recipe')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audrey2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Aas
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-02-12 00:00:00 -05:00
|
19
19
|
default_executable: feedme
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -93,7 +93,6 @@ extra_rdoc_files:
|
|
93
93
|
- README.rdoc
|
94
94
|
files:
|
95
95
|
- .document
|
96
|
-
- .gitignore
|
97
96
|
- LICENSE
|
98
97
|
- README.rdoc
|
99
98
|
- Rakefile
|
@@ -105,6 +104,7 @@ files:
|
|
105
104
|
- test/helper.rb
|
106
105
|
- test/test_config.rb
|
107
106
|
- test/test_email.rb
|
107
|
+
- test/test_helper.rb
|
108
108
|
- test/test_misc.rb
|
109
109
|
- test/test_options.rb
|
110
110
|
- test/test_parse.rb
|
@@ -116,8 +116,8 @@ homepage: http://github.com/svenaas/audrey2
|
|
116
116
|
licenses: []
|
117
117
|
|
118
118
|
post_install_message:
|
119
|
-
rdoc_options:
|
120
|
-
|
119
|
+
rdoc_options: []
|
120
|
+
|
121
121
|
require_paths:
|
122
122
|
- lib
|
123
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -141,17 +141,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements: []
|
142
142
|
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.
|
144
|
+
rubygems_version: 1.4.2
|
145
145
|
signing_key:
|
146
146
|
specification_version: 3
|
147
147
|
summary: Feed processing and aggregation
|
148
|
-
test_files:
|
149
|
-
|
150
|
-
- test/test_config.rb
|
151
|
-
- test/test_email.rb
|
152
|
-
- test/test_misc.rb
|
153
|
-
- test/test_options.rb
|
154
|
-
- test/test_parse.rb
|
155
|
-
- test/test_recipes.rb
|
156
|
-
- test/test_sort.rb
|
157
|
-
- test/test_themes.rb
|
148
|
+
test_files: []
|
149
|
+
|