feedcellar 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +14 -0
- data/README.md +1 -1
- data/feedcellar.gemspec +1 -1
- data/lib/feedcellar/command.rb +21 -25
- data/lib/feedcellar/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08349a53320968c7d67ee7ee77d0c6a0e6d8141c
|
4
|
+
data.tar.gz: 612e284fddb33c71c2035bc4f07ea6b3058feb63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3f12931734d1dd9f4a7a55b2b6f0f5b73ac24134fa186787885eacaed0c0773675c3540c5a685ff637915322d05a15b2ac1adde39a37d072ef90c211d3852e
|
7
|
+
data.tar.gz: 07444c6e22023537652c9836dbd20d2ae72a1461da9672c4991ea8cf983eacc6376b6faff5a2051684babeab565af7398289d102f38bedc6d2069959c262608a
|
data/NEWS.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.2.1: 2013-06-10
|
4
|
+
|
5
|
+
Fix output format of search command.
|
6
|
+
|
7
|
+
### Changes
|
8
|
+
|
9
|
+
* Improvements
|
10
|
+
* Add reverse option to search command
|
11
|
+
* Remove desc option from search command
|
12
|
+
* Add long option to search command
|
13
|
+
|
14
|
+
* Fixes
|
15
|
+
* Use "==" instead of "=~" at selecting resources
|
16
|
+
|
3
17
|
## 0.2.0: 2013-06-09
|
4
18
|
|
5
19
|
Improve something to do with output release!
|
data/README.md
CHANGED
data/feedcellar.gemspec
CHANGED
@@ -8,7 +8,7 @@ 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{Searchable storage for RSS feed reader by rroonga with groonga
|
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
13
|
spec.homepage = "http://myokoym.net/feedcellar/"
|
14
14
|
spec.license = "MIT"
|
data/lib/feedcellar/command.rb
CHANGED
@@ -38,7 +38,7 @@ module Feedcellar
|
|
38
38
|
desc "import FILE", "Import feed resources by OPML format."
|
39
39
|
def import(opml_xml)
|
40
40
|
GroongaDatabase.new.open(@database_dir) do |database|
|
41
|
-
|
41
|
+
Opml.parse(opml_xml).each do |resource|
|
42
42
|
database.register(resource["title"], resource)
|
43
43
|
end
|
44
44
|
end
|
@@ -82,38 +82,34 @@ module Feedcellar
|
|
82
82
|
end
|
83
83
|
|
84
84
|
desc "search WORD", "Search feeds from local database."
|
85
|
-
option :desc, :type => :boolean, :aliases => "-d", :desc => "show description"
|
86
85
|
option :browser, :type => :boolean, :desc => "open *ALL* links in browser"
|
86
|
+
option :long, :type => :boolean, :aliases => "-l", :desc => "use a long listing format"
|
87
|
+
option :reverse, :type => :boolean, :aliases => "-r", :desc => "reverse order while sorting"
|
87
88
|
def search(word, api=false)
|
88
89
|
GroongaDatabase.new.open(@database_dir) do |database|
|
89
|
-
feeds = database.feeds
|
90
|
-
resources = database.resources
|
91
|
-
|
92
|
-
records = feeds.select do |v|
|
90
|
+
feeds = database.feeds.select do |v|
|
93
91
|
(v.title =~ word) | (v.description =~ word)
|
94
92
|
end
|
95
93
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
sorted_records.each do |record|
|
100
|
-
feed_resources = resources.select {|v| v.xmlUrl =~ record.resource }
|
101
|
-
next unless feed_resources
|
102
|
-
next unless feed_resources.first # FIXME
|
94
|
+
order = options[:reverse] ? "descending" : "ascending"
|
95
|
+
sorted_feeds = feeds.sort([{:key => "date", :order => order}])
|
96
|
+
return sorted_feeds if api
|
103
97
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
98
|
+
sorted_feeds.each do |record|
|
99
|
+
resources = database.resources.select do |v|
|
100
|
+
v.xmlUrl == record.resource
|
101
|
+
end
|
102
|
+
next unless resources
|
103
|
+
next unless resources.first # FIXME
|
104
|
+
|
105
|
+
title = record.title.gsub(/\n/, " ")
|
106
|
+
if options[:long]
|
107
|
+
date = record.date.strftime("%Y/%m/%d %H:%M")
|
108
|
+
resource = resources.first.title
|
109
|
+
puts "#{date} #{title} - #{resource} / #{record.link}"
|
110
110
|
else
|
111
|
-
|
112
|
-
puts "
|
113
|
-
puts " #{record.date}"
|
114
|
-
puts " #{record.link}"
|
115
|
-
puts " #{record.description}" if options[:desc]
|
116
|
-
puts
|
111
|
+
date = record.date.strftime("%Y/%m/%d")
|
112
|
+
puts "#{date} #{title}"
|
117
113
|
end
|
118
114
|
|
119
115
|
if options[:browser]
|
data/lib/feedcellar/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.1
|
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-10 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: Searchable storage for RSS feed reader by rroonga with groonga
|
111
|
+
description: Searchable storage for RSS feed reader by rroonga with groonga.
|
112
112
|
email:
|
113
113
|
- myokoym@gmail.com
|
114
114
|
executables:
|