feedcellar 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +13 -0
- data/README.md +4 -2
- data/feedcellar.gemspec +2 -2
- data/lib/feedcellar/command.rb +52 -13
- data/lib/feedcellar/version.rb +1 -1
- data/test/test-command.rb +9 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99485cd81b7d2ccc7e871f93c89f54d484c1a725
|
4
|
+
data.tar.gz: acf336156d13924926fe66805a457d7f6c574520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce6bbda93db793f7c36e82f6461890128dbb01031a2759ca2d8491a7bcae746e71329a3b01a9eb6218b2e2dcc0508104112d8e8ea0cf0fbe3419877b844c0266
|
7
|
+
data.tar.gz: 05daf037e95a72d01b876f20a8830f38d361c1cbc99bd63dc435715d84d42113473f53017964c46afb77bf8059fd79fb287fa90f1f1e6a44a1d011dcabdd492b
|
data/NEWS.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.1.3: 2013-06-06
|
4
|
+
|
5
|
+
Experimental functions release!
|
6
|
+
|
7
|
+
### Changes
|
8
|
+
|
9
|
+
* Improvements
|
10
|
+
* Add browser option to search command
|
11
|
+
* Improve search order sort by date ascending
|
12
|
+
* Add simple format to search command
|
13
|
+
* gemspec: change homepage to myokoym.net
|
14
|
+
* Add version command
|
15
|
+
|
3
16
|
## 0.1.2: 2013-06-04
|
4
17
|
|
5
18
|
Bug fixes release!
|
data/README.md
CHANGED
data/feedcellar.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Feedcellar::VERSION
|
9
9
|
spec.authors = ["Masafumi Yokoyama"]
|
10
10
|
spec.email = ["myokoym@gmail.com"]
|
11
|
-
spec.description = %q{
|
11
|
+
spec.description = %q{Searchable storage for RSS feed reader by rroonga with groonga!}
|
12
12
|
spec.summary = %q{Searchable Storage for Feed Reader}
|
13
|
-
spec.homepage = "
|
13
|
+
spec.homepage = "http://myokoym.net/feedcellar/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
data/lib/feedcellar/command.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "rss"
|
3
|
+
require "feedcellar/version"
|
3
4
|
require "feedcellar/groonga_database"
|
4
5
|
require "feedcellar/opml"
|
5
6
|
|
@@ -10,6 +11,11 @@ module Feedcellar
|
|
10
11
|
@work_dir = File.join(File.expand_path("~"), ".feedcellar")
|
11
12
|
end
|
12
13
|
|
14
|
+
desc "version", "Show version number."
|
15
|
+
def version
|
16
|
+
puts Feedcellar::VERSION
|
17
|
+
end
|
18
|
+
|
13
19
|
desc "register URL", "Register a URL."
|
14
20
|
def register(url)
|
15
21
|
@database = GroongaDatabase.new
|
@@ -19,12 +25,12 @@ module Feedcellar
|
|
19
25
|
rescue RSS::InvalidRSSError
|
20
26
|
rss = RSS::Parser.parse(url, false)
|
21
27
|
rescue
|
22
|
-
$stderr.puts "
|
28
|
+
$stderr.puts "WARNNING: #{$!} (#{url})"
|
23
29
|
return 1
|
24
30
|
end
|
25
31
|
|
26
32
|
unless rss
|
27
|
-
$stderr.puts "
|
33
|
+
$stderr.puts "ERROR: Invalid URL"
|
28
34
|
return 1
|
29
35
|
end
|
30
36
|
|
@@ -83,11 +89,11 @@ module Feedcellar
|
|
83
89
|
begin
|
84
90
|
rss = RSS::Parser.parse(feed_url, false)
|
85
91
|
rescue
|
86
|
-
$stderr.puts "
|
92
|
+
$stderr.puts "WARNNING: #{$!} (#{feed_url})"
|
87
93
|
next
|
88
94
|
end
|
89
95
|
rescue
|
90
|
-
$stderr.puts "
|
96
|
+
$stderr.puts "WARNNING: #{$!} (#{feed_url})"
|
91
97
|
next
|
92
98
|
end
|
93
99
|
next unless rss
|
@@ -106,7 +112,7 @@ module Feedcellar
|
|
106
112
|
end
|
107
113
|
|
108
114
|
unless link
|
109
|
-
$stderr.puts "
|
115
|
+
$stderr.puts "WARNNING: missing link (#{title})"
|
110
116
|
next
|
111
117
|
end
|
112
118
|
|
@@ -118,24 +124,57 @@ module Feedcellar
|
|
118
124
|
|
119
125
|
desc "search WORD", "Search feeds."
|
120
126
|
option :desc, :type => :boolean, :aliases => "-d", :desc => "show description"
|
127
|
+
option :simple, :type => :boolean, :desc => "simple format as one liner"
|
128
|
+
option :browser, :type => :boolean, :desc => "open *ALL* links in browser"
|
121
129
|
def search(word)
|
122
130
|
@database = GroongaDatabase.new
|
123
131
|
@database.open(@work_dir) do |database|
|
124
132
|
feeds = @database.feeds
|
125
133
|
resources = @database.resources
|
126
134
|
|
127
|
-
feeds.select
|
128
|
-
|
135
|
+
records = feeds.select do |v|
|
136
|
+
(v.title =~ word) | (v.description =~ word)
|
137
|
+
end
|
138
|
+
|
139
|
+
records.sort([{:key => "date", :order => "ascending"}]).each do |record|
|
129
140
|
feed_resources = resources.select {|v| v.xmlUrl =~ record.resource }
|
130
141
|
next unless feed_resources
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
142
|
+
if options[:simple]
|
143
|
+
# TODO This format will be to default from 0.2.0
|
144
|
+
date = record.date.strftime("%Y/%m/%d")
|
145
|
+
title= record.title
|
146
|
+
resource = feed_resources.first.title
|
147
|
+
link = record.link
|
148
|
+
puts "#{date} #{title} - #{resource}"
|
149
|
+
else
|
150
|
+
puts feed_resources.first.title
|
151
|
+
puts " #{record.title}"
|
152
|
+
puts " #{record.date}"
|
153
|
+
puts " #{record.link}"
|
154
|
+
puts " #{record.description}" if options[:desc]
|
155
|
+
puts
|
156
|
+
end
|
157
|
+
|
158
|
+
if options[:browser]
|
159
|
+
Gtk.show_uri(record.link) if browser_available?
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
private
|
166
|
+
def browser_available?
|
167
|
+
if @browser.nil?
|
168
|
+
begin
|
169
|
+
require "gtk2"
|
170
|
+
rescue LoadError
|
171
|
+
$stderr.puts "WARNNING: Sorry, browser option required \"gtk2\"."
|
172
|
+
@browser = false
|
173
|
+
else
|
174
|
+
@browser = true
|
137
175
|
end
|
138
176
|
end
|
177
|
+
@browser
|
139
178
|
end
|
140
179
|
end
|
141
180
|
end
|
data/lib/feedcellar/version.rb
CHANGED
data/test/test-command.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require "stringio"
|
3
|
+
require "feedcellar/version"
|
3
4
|
require "feedcellar/command"
|
4
5
|
require "feedcellar/groonga_database"
|
5
6
|
|
@@ -12,11 +13,18 @@ class CommandTest < Test::Unit::TestCase
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def test_command
|
16
|
+
s = ""
|
17
|
+
io = StringIO.new(s)
|
18
|
+
$stdout = io
|
19
|
+
@command.version
|
20
|
+
assert_equal("#{Feedcellar::VERSION}\n", s)
|
21
|
+
$stdout = STDOUT
|
22
|
+
|
15
23
|
s = ""
|
16
24
|
io = StringIO.new(s)
|
17
25
|
$stderr = io
|
18
26
|
assert_equal(1, @command.register("hoge"))
|
19
|
-
assert_equal("
|
27
|
+
assert_equal("ERROR: Invalid URL\n", s)
|
20
28
|
$stderr = STDERR
|
21
29
|
|
22
30
|
@command.register("http://myokoym.github.io/entries.rss")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedcellar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rroonga
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description: Searchable storage for RSS feed reader by rroonga with groonga!
|
112
112
|
email:
|
113
113
|
- myokoym@gmail.com
|
114
114
|
executables:
|
@@ -134,7 +134,7 @@ files:
|
|
134
134
|
- test/run-test.rb
|
135
135
|
- test/test-command.rb
|
136
136
|
- test/test-opml.rb
|
137
|
-
homepage:
|
137
|
+
homepage: http://myokoym.net/feedcellar/
|
138
138
|
licenses:
|
139
139
|
- MIT
|
140
140
|
metadata: {}
|