feedcellar-web 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +20 -8
- data/NEWS.md +13 -0
- data/feedcellar-web.gemspec +2 -0
- data/lib/feedcellar/web/app.rb +29 -15
- data/lib/feedcellar/web/version.rb +2 -2
- data/lib/feedcellar/web/views/_feeds.haml +5 -3
- data/lib/feedcellar/web/views/_months_by_years.haml +1 -0
- data/lib/feedcellar/web/views/_years.haml +1 -0
- data/lib/feedcellar/web/views/index.haml +2 -1
- data/test/test-app.rb +15 -0
- metadata +32 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e59c602c1a93b977060a29b050cd40e6d66b9a2
|
4
|
+
data.tar.gz: 13c6dcf680bafcd1d50c5e8b242c3293a65db9b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ddc14f72b6d5842f13b403de0f3fbfb0c31f7a6e5fb1ce553bcfebf61419684c339334cf04ed23b7c01d786236bb91cd6ab99a51ef2c9e548d71ec7231122d
|
7
|
+
data.tar.gz: cc02710a77ca9d3ac9f69cace3d65896f5ca3aac232f321cca1137857e67ba094c2431d489c9b78f8c9d78c6cd0615b5799902861477a51520e3bcfd37f5bb78
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
feedcellar-web (0.3.
|
4
|
+
feedcellar-web (0.3.2)
|
5
5
|
feedcellar (>= 0.6.0)
|
6
6
|
haml
|
7
7
|
kaminari
|
@@ -9,6 +9,8 @@ PATH
|
|
9
9
|
padrino-helpers
|
10
10
|
racknga
|
11
11
|
sinatra
|
12
|
+
sinatra-contrib
|
13
|
+
sinatra-cross_origin
|
12
14
|
thor
|
13
15
|
|
14
16
|
GEM
|
@@ -36,13 +38,14 @@ GEM
|
|
36
38
|
addressable (2.3.8)
|
37
39
|
archive-zip (0.7.0)
|
38
40
|
io-like (~> 0.3.0)
|
41
|
+
backports (3.6.4)
|
39
42
|
builder (3.2.2)
|
40
43
|
erubis (2.7.0)
|
41
44
|
feedcellar (0.6.0)
|
42
45
|
rroonga (>= 5.0.0)
|
43
46
|
thor
|
44
47
|
gqtp (1.0.6)
|
45
|
-
groonga-client (0.1.
|
48
|
+
groonga-client (0.1.6)
|
46
49
|
gqtp (>= 1.0.4)
|
47
50
|
groonga-command (>= 1.0.8)
|
48
51
|
groonga-command (1.1.2)
|
@@ -51,16 +54,17 @@ GEM
|
|
51
54
|
tilt
|
52
55
|
i18n (0.7.0)
|
53
56
|
io-like (0.3.0)
|
54
|
-
json (1.8.
|
57
|
+
json (1.8.3)
|
55
58
|
kaminari (0.16.3)
|
56
59
|
actionpack (>= 3.0.0)
|
57
60
|
activesupport (>= 3.0.0)
|
58
61
|
launchy (2.4.3)
|
59
62
|
addressable (~> 2.3)
|
60
|
-
loofah (2.0.
|
63
|
+
loofah (2.0.2)
|
61
64
|
nokogiri (>= 1.5.9)
|
62
65
|
mini_portile (0.6.2)
|
63
|
-
minitest (5.
|
66
|
+
minitest (5.7.0)
|
67
|
+
multi_json (1.11.1)
|
64
68
|
nokogiri (1.6.6.2)
|
65
69
|
mini_portile (~> 0.6.0)
|
66
70
|
padrino-helpers (0.12.5)
|
@@ -71,7 +75,7 @@ GEM
|
|
71
75
|
activesupport (>= 3.1)
|
72
76
|
pkg-config (1.1.6)
|
73
77
|
power_assert (0.2.3)
|
74
|
-
rack (1.6.
|
78
|
+
rack (1.6.1)
|
75
79
|
rack-protection (1.5.3)
|
76
80
|
rack
|
77
81
|
rack-test (0.6.3)
|
@@ -89,7 +93,7 @@ GEM
|
|
89
93
|
loofah (~> 2.0)
|
90
94
|
rake (10.4.2)
|
91
95
|
rr (1.1.2)
|
92
|
-
rroonga (5.0.
|
96
|
+
rroonga (5.0.3)
|
93
97
|
archive-zip
|
94
98
|
groonga-client (>= 0.0.3)
|
95
99
|
json
|
@@ -98,7 +102,15 @@ GEM
|
|
98
102
|
rack (~> 1.4)
|
99
103
|
rack-protection (~> 1.4)
|
100
104
|
tilt (>= 1.3, < 3)
|
101
|
-
|
105
|
+
sinatra-contrib (1.4.4)
|
106
|
+
backports (>= 2.0)
|
107
|
+
multi_json
|
108
|
+
rack-protection
|
109
|
+
rack-test
|
110
|
+
sinatra (~> 1.4.0)
|
111
|
+
tilt (>= 1.3, < 3)
|
112
|
+
sinatra-cross_origin (0.3.2)
|
113
|
+
test-unit (3.1.2)
|
102
114
|
power_assert
|
103
115
|
test-unit-notify (1.0.4)
|
104
116
|
test-unit (>= 2.4.9)
|
data/NEWS.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.4.0: 2016-02-17
|
4
|
+
|
5
|
+
### Changes
|
6
|
+
|
7
|
+
#### Improvements
|
8
|
+
|
9
|
+
* Add space between resources and years.
|
10
|
+
* Break by years.
|
11
|
+
* Break by months by years.
|
12
|
+
* Added /search.json route.
|
13
|
+
* Supported CORS.
|
14
|
+
* Don't paginate unless params[:page] is specified.
|
15
|
+
|
3
16
|
## 0.3.1: 2015-04-13
|
4
17
|
|
5
18
|
Bug fix release for 0.3.0.
|
data/feedcellar-web.gemspec
CHANGED
@@ -40,6 +40,8 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_runtime_dependency("feedcellar", ">= 0.6.0")
|
41
41
|
spec.add_runtime_dependency("thor")
|
42
42
|
spec.add_runtime_dependency("sinatra")
|
43
|
+
spec.add_runtime_dependency("sinatra-contrib")
|
44
|
+
spec.add_runtime_dependency("sinatra-cross_origin")
|
43
45
|
spec.add_runtime_dependency("padrino-helpers")
|
44
46
|
spec.add_runtime_dependency("kaminari")
|
45
47
|
spec.add_runtime_dependency("haml")
|
data/lib/feedcellar/web/app.rb
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
require "feedcellar"
|
20
20
|
require "sinatra/base"
|
21
|
+
require "sinatra/json"
|
22
|
+
require "sinatra/cross_origin"
|
21
23
|
require "haml"
|
22
24
|
require "padrino-helpers"
|
23
25
|
require "kaminari/sinatra"
|
@@ -26,30 +28,24 @@ module Feedcellar
|
|
26
28
|
module Web
|
27
29
|
class App < Sinatra::Base
|
28
30
|
helpers Kaminari::Helpers::SinatraHelpers
|
31
|
+
register Sinatra::CrossOrigin
|
29
32
|
|
30
33
|
get "/" do
|
31
34
|
haml :index
|
32
35
|
end
|
33
36
|
|
34
37
|
get "/search" do
|
35
|
-
|
36
|
-
words = params[:word].split(" ")
|
37
|
-
else
|
38
|
-
words = []
|
39
|
-
end
|
40
|
-
options ||= {}
|
41
|
-
options[:resource_id] = params[:resource_id] if params[:resource_id]
|
42
|
-
options[:year] = params[:year].to_i if params[:year]
|
43
|
-
options[:month] = params[:month].to_i if params[:month]
|
44
|
-
@feeds = search(words, options)
|
45
|
-
if @feeds
|
46
|
-
page = params[:page]
|
47
|
-
n_per_page = options[:n_per_page] || 50
|
48
|
-
@paginated_feeds = pagenate_feeds(@feeds, page, n_per_page)
|
49
|
-
end
|
38
|
+
search_and_paginate
|
50
39
|
haml :index
|
51
40
|
end
|
52
41
|
|
42
|
+
get "/search.json" do
|
43
|
+
cross_origin
|
44
|
+
search_and_paginate
|
45
|
+
feeds = @paginated_feeds || @feeds
|
46
|
+
json feeds.collect {|feed| feed.attributes }
|
47
|
+
end
|
48
|
+
|
53
49
|
get "/registers.opml" do
|
54
50
|
content_type :xml
|
55
51
|
opml = nil
|
@@ -60,6 +56,24 @@ module Feedcellar
|
|
60
56
|
end
|
61
57
|
|
62
58
|
helpers do
|
59
|
+
def search_and_paginate
|
60
|
+
if params[:word]
|
61
|
+
words = params[:word].split(" ")
|
62
|
+
else
|
63
|
+
words = []
|
64
|
+
end
|
65
|
+
options ||= {}
|
66
|
+
options[:resource_id] = params[:resource_id] if params[:resource_id]
|
67
|
+
options[:year] = params[:year].to_i if params[:year]
|
68
|
+
options[:month] = params[:month].to_i if params[:month]
|
69
|
+
@feeds = search(words, options)
|
70
|
+
if @feeds and params[:page]
|
71
|
+
page = params[:page]
|
72
|
+
n_per_page = options[:n_per_page] || 50
|
73
|
+
@paginated_feeds = pagenate_feeds(@feeds, page, n_per_page)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
63
77
|
def search(words, options={})
|
64
78
|
database = GroongaDatabase.new
|
65
79
|
database.open(Command.new.database_dir)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# constant Feedcellar::Web::VERSION
|
2
2
|
#
|
3
|
-
# Copyright (C) 2015 Masafumi Yokoyama <myokoym@gmail.com>
|
3
|
+
# Copyright (C) 2015-2016 Masafumi Yokoyama <myokoym@gmail.com>
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -18,6 +18,6 @@
|
|
18
18
|
|
19
19
|
module Feedcellar
|
20
20
|
module Web
|
21
|
-
VERSION = "0.
|
21
|
+
VERSION = "0.4.0"
|
22
22
|
end
|
23
23
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
- if @paginated_feeds
|
2
|
+
= paginate(@paginated_feeds)
|
2
3
|
%ul
|
3
|
-
- @paginated_feeds.each do |feed|
|
4
|
+
- (@paginated_feeds || @feeds).each do |feed|
|
4
5
|
%li
|
5
6
|
%p
|
6
7
|
= feed.date.strftime("%Y-%m-%d")
|
7
8
|
= link_to("#{feed.title} - #{feed.resource.title}", feed.link)
|
8
|
-
|
9
|
+
- if @paginated_feeds
|
10
|
+
= paginate(@paginated_feeds)
|
data/test/test-app.rb
CHANGED
@@ -11,4 +11,19 @@ class AppTest < Test::Unit::TestCase
|
|
11
11
|
get "/"
|
12
12
|
assert_true(last_response.ok?)
|
13
13
|
end
|
14
|
+
|
15
|
+
def test_search
|
16
|
+
get "/search"
|
17
|
+
assert_true(last_response.ok?)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_search_json
|
21
|
+
get "/search.json"
|
22
|
+
assert_true(last_response.ok?)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_registers
|
26
|
+
get "/registers.opml"
|
27
|
+
assert_true(last_response.ok?)
|
28
|
+
end
|
14
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedcellar-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: feedcellar
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sinatra-contrib
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sinatra-cross_origin
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: padrino-helpers
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
290
|
version: '0'
|
263
291
|
requirements: []
|
264
292
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
293
|
+
rubygems_version: 2.5.1
|
266
294
|
signing_key:
|
267
295
|
specification_version: 4
|
268
296
|
summary: Web interface for Feedcellar
|
@@ -270,3 +298,4 @@ test_files:
|
|
270
298
|
- test/run-test.rb
|
271
299
|
- test/test-app.rb
|
272
300
|
- test/test-command.rb
|
301
|
+
has_rdoc:
|