rutt 0.5.4 → 0.6.0
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.
- data/VERSION +1 -1
- data/bin/rutt +9 -0
- data/lib/rutt.rb +1 -0
- data/lib/rutt/db/item.rb +4 -0
- data/lib/rutt/share/kindle.rb +28 -0
- data/rutt.gemspec +3 -2
- metadata +6 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/bin/rutt
CHANGED
@@ -75,6 +75,15 @@ def main
|
|
75
75
|
exit
|
76
76
|
end
|
77
77
|
|
78
|
+
opts.on('-k', '--kindle FEED', 'Export feed to kindle.') do |feed_id|
|
79
|
+
feed = {
|
80
|
+
'id' => feed_id.to_i
|
81
|
+
}
|
82
|
+
|
83
|
+
Rutt::Share::Kindle.new(feed)
|
84
|
+
|
85
|
+
exit
|
86
|
+
end
|
78
87
|
# opts.on('-l', '--list-feeds', action='store_true', help="List the feeds")
|
79
88
|
|
80
89
|
end.parse!
|
data/lib/rutt.rb
CHANGED
data/lib/rutt/db/item.rb
CHANGED
@@ -26,6 +26,10 @@ module Rutt
|
|
26
26
|
$db.execute("select * from items where feed_id = ? order by published_at desc", feed['id'])
|
27
27
|
end
|
28
28
|
|
29
|
+
def unread(feed, limit=10)
|
30
|
+
$db.execute("select * from items where feed_id = ? and read = 0 order by published_at desc limit #{limit}", feed['id'])
|
31
|
+
end
|
32
|
+
|
29
33
|
def mark_as_unread(item)
|
30
34
|
$db.execute("update items set read = 0 where id = #{item['id']}")
|
31
35
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Rutt
|
2
|
+
module Share
|
3
|
+
class Kindle
|
4
|
+
def initialize(feed)
|
5
|
+
|
6
|
+
items = Rutt::DB::Item.unread(feed)
|
7
|
+
|
8
|
+
# TODO: Should be name of feed
|
9
|
+
title = "rutt feed"
|
10
|
+
|
11
|
+
puts "<html><head><title>#{title}</title></head><body>"
|
12
|
+
puts "<h1>rutt feed</h1>"
|
13
|
+
|
14
|
+
items.each do |item|
|
15
|
+
puts "<mbp:pagebreak/>"
|
16
|
+
puts "<h2>#{item['title']}</h2>"
|
17
|
+
puts ::Readability::Document.new(open(item['url']).read).content
|
18
|
+
end
|
19
|
+
puts "</body></html>"
|
20
|
+
|
21
|
+
items.each do |item|
|
22
|
+
Rutt::DB::Item.mark_as_read(item)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/rutt.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rutt}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Abhi Yerra"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-29}
|
13
13
|
s.default_executable = %q{rutt}
|
14
14
|
s.description = %q{The Mutt of RSS/Atom feeds.}
|
15
15
|
s.email = %q{abhi@berkeley.edu}
|
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
"lib/rutt/screen/feed.rb",
|
40
40
|
"lib/rutt/screen/item.rb",
|
41
41
|
"lib/rutt/share/instapaper.rb",
|
42
|
+
"lib/rutt/share/kindle.rb",
|
42
43
|
"rutt.gemspec",
|
43
44
|
"spec/rutt_spec.rb",
|
44
45
|
"spec/spec_helper.rb"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Abhi Yerra
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-29 00:00:00 +00:00
|
19
19
|
default_executable: rutt
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/rutt/screen/feed.rb
|
223
223
|
- lib/rutt/screen/item.rb
|
224
224
|
- lib/rutt/share/instapaper.rb
|
225
|
+
- lib/rutt/share/kindle.rb
|
225
226
|
- rutt.gemspec
|
226
227
|
- spec/rutt_spec.rb
|
227
228
|
- spec/spec_helper.rb
|