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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e574a4dc6570abaed41db607382a859f4e99d245
4
- data.tar.gz: 57d69eaac737b2f5369bd37cd67b8dc3e8292af2
3
+ metadata.gz: 08349a53320968c7d67ee7ee77d0c6a0e6d8141c
4
+ data.tar.gz: 612e284fddb33c71c2035bc4f07ea6b3058feb63
5
5
  SHA512:
6
- metadata.gz: 8a8dcd5f66b52a3036edb153abc251cef13015b77e7fd9ed3fd94b5aa6c257216d4da571bc0ba77a11e7dc3e77585b243c21ab94637dfcdab0663d90f2d2eda3
7
- data.tar.gz: 1b9bdea33770e3959a27bedc815c4712d31d0eaefa9b3057d6d652556657bb888b9bdcf6e7c8455e7fe77f1ea0b7de2d883edc347bbd982cf8841afe18c3cd32
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Searchable storage for RSS feed reader.
4
4
 
5
- Powered by rroonga with groonga!
5
+ Powered by rroonga with groonga.
6
6
 
7
7
  ## Installation
8
8
 
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"
@@ -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
- Feedcellar::Opml.parse(opml_xml).each do |resource|
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
- sorted_records = records.sort([{:key => "date", :order => "ascending"}])
97
- return sorted_records if api
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
- unless options[:desc]
105
- date = record.date.strftime("%Y/%m/%d")
106
- title = record.title
107
- resource = feed_resources.first.title
108
- link = record.link
109
- puts "#{date} #{title.gsub(/\n/, " ")} - #{resource}"
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
- puts feed_resources.first.title
112
- puts " #{record.title}"
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]
@@ -1,3 +1,3 @@
1
1
  module Feedcellar
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-09 00:00:00.000000000 Z
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: