weneedfeed 0.16.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +1 -1
- data/README.md +17 -10
- data/lib/weneedfeed/application.rb +1 -1
- data/lib/weneedfeed/command.rb +8 -1
- data/lib/weneedfeed/controllers/show_opml.rb +2 -2
- data/lib/weneedfeed/controllers/show_top_page.rb +2 -3
- data/lib/weneedfeed/schema.rb +7 -0
- data/lib/weneedfeed/version.rb +1 -1
- data/lib/weneedfeed/views/show_opml.rb +8 -3
- data/lib/weneedfeed/views/show_top_page.rb +8 -3
- data/templates/show_opml.xml.erb +3 -3
- data/templates/show_top_page.html.erb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15fe792e19590e141278496015fefd5f9b7b10c2fa467b2bb2d8f7b6b9206350
|
4
|
+
data.tar.gz: c0957471a1a209b3727a04eecec561aae7144c225b9ae469f7dfd66c9e698aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a52e5daab18cd4f8d5f303e6a065d0018efd23babe7b364c112bb08c488eab67e179efc5fb2037563e5d9706ec71e4992433f83cd70c0b1245ce7b54f50f145
|
7
|
+
data.tar.gz: a01540c21b8ddb8737b862530089df9216e6814a084a8e3c132e4b4d30c41dcd571c835c42a1d1a00c41cf39372a093f41449d028ea13282e29a0d084f2eb1ae
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## 0.18.0 - 2022-04-17
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Support configurable feeds title.
|
15
|
+
- Add --port= option to server command.
|
16
|
+
|
17
|
+
## 0.17.0 - 2022-04-15
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
- Change outline title on OPML.
|
22
|
+
|
23
|
+
## 0.16.1 - 2022-04-15
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Fix bug that opml.xml is not built.
|
28
|
+
|
10
29
|
## 0.16.0 - 2022-04-15
|
11
30
|
|
12
31
|
### Added
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -32,6 +32,8 @@ Weneedfeed requires `weneedfeed.yml` that describes URLs and selectors.
|
|
32
32
|
### Example
|
33
33
|
|
34
34
|
```yaml
|
35
|
+
title: Example RSS feeds
|
36
|
+
|
35
37
|
pages:
|
36
38
|
- id: example1
|
37
39
|
title: Example 1
|
@@ -55,70 +57,75 @@ pages:
|
|
55
57
|
item_title_selector: .//p[2]
|
56
58
|
```
|
57
59
|
|
58
|
-
### `
|
60
|
+
### `title`
|
61
|
+
|
62
|
+
- optional (default: `"Weneedfeed"`)
|
63
|
+
- Used for feeds title on top page and OPML outline.
|
64
|
+
|
65
|
+
### `pages.id`
|
59
66
|
|
60
67
|
Feed ID.
|
61
68
|
|
62
69
|
- required
|
63
70
|
- Used for feed URL and `<link>` element in `<channel>` element.
|
64
71
|
|
65
|
-
### `title`
|
72
|
+
### `pages.title`
|
66
73
|
|
67
74
|
Feed title.
|
68
75
|
|
69
76
|
- required
|
70
77
|
- Used for RSS `<title>` element in `<channel>` element.
|
71
78
|
|
72
|
-
### `description`
|
79
|
+
### `pages.description`
|
73
80
|
|
74
81
|
Feed description.
|
75
82
|
|
76
83
|
- optional
|
77
84
|
- Used for RSS `<description>` element in `<channel>` element.
|
78
85
|
|
79
|
-
### `url`
|
86
|
+
### `pages.url`
|
80
87
|
|
81
88
|
HTML source URL.
|
82
89
|
|
83
90
|
- required
|
84
91
|
- Used to fetch HTML page for building feed.
|
85
92
|
|
86
|
-
### `item_selector`
|
93
|
+
### `pages.item_selector`
|
87
94
|
|
88
95
|
CSS or XPath selector to search each item.
|
89
96
|
|
90
97
|
- required
|
91
98
|
- Equivalent unit to RSS `<item>` element.
|
92
99
|
|
93
|
-
### `item_link_selector`
|
100
|
+
### `pages.item_link_selector`
|
94
101
|
|
95
102
|
CSS or XPath selector to find `<a>` element in each item.
|
96
103
|
|
97
104
|
- required
|
98
105
|
- Used for `<link>` in `<item>`.
|
99
106
|
|
100
|
-
### `item_title_selector`
|
107
|
+
### `pages.item_title_selector`
|
101
108
|
|
102
109
|
CSS or XPath selector to find element with title information in each item.
|
103
110
|
|
104
111
|
- required
|
105
112
|
- Used for `<title>` in `<item>`.
|
106
113
|
|
107
|
-
### `item_description_selector`
|
114
|
+
### `pages.item_description_selector`
|
108
115
|
|
109
116
|
CSS or XPath selector to find element with description information in each item.
|
110
117
|
|
111
118
|
- optional
|
112
119
|
- Used for `<description>` in `<item>`.
|
113
120
|
|
114
|
-
### `item_image_selector`
|
121
|
+
### `pages.item_image_selector`
|
115
122
|
|
116
123
|
CSS or XPath selector to find `<img>`element in each item.
|
117
124
|
|
118
125
|
- optional
|
119
126
|
- Used for `<enclosure>` in `<item>`.
|
120
127
|
|
121
|
-
### `item_time_selector`
|
128
|
+
### `pages.item_time_selector`
|
122
129
|
|
123
130
|
CSS or XPath selector to find element with datetime information in each item.
|
124
131
|
|
data/lib/weneedfeed/command.rb
CHANGED
@@ -53,9 +53,16 @@ module Weneedfeed
|
|
53
53
|
type: :string
|
54
54
|
)
|
55
55
|
|
56
|
+
method_option(
|
57
|
+
:port,
|
58
|
+
default: '8080',
|
59
|
+
desc: 'TCP port to bind to.',
|
60
|
+
type: :string
|
61
|
+
)
|
62
|
+
|
56
63
|
def server
|
57
64
|
application = Weneedfeed::Application.new(schema_path: options[:schema_path])
|
58
|
-
::Rack::Handler.default.run(application)
|
65
|
+
::Rack::Handler.default.run(application, Port: options[:port])
|
59
66
|
end
|
60
67
|
end
|
61
68
|
end
|
@@ -7,12 +7,12 @@ module Weneedfeed
|
|
7
7
|
response.content_type = 'application/xml; charset=utf-8'
|
8
8
|
response.write(
|
9
9
|
::Weneedfeed::Views::ShowOpml.new(
|
10
|
-
page_schemata: schema.page_schemata.sort_by(&:title),
|
11
10
|
partial_template_path: ::File.expand_path(
|
12
11
|
'templates/show_opml.xml.erb',
|
13
12
|
"#{__dir__}/../../.."
|
14
13
|
),
|
15
|
-
request: request
|
14
|
+
request: request,
|
15
|
+
schema: schema
|
16
16
|
).to_s
|
17
17
|
)
|
18
18
|
end
|
@@ -4,16 +4,15 @@ module Weneedfeed
|
|
4
4
|
module Controllers
|
5
5
|
class ShowTopPage < ::Weneedfeed::Controllers::Base
|
6
6
|
def call
|
7
|
-
page_schemata = schema.page_schemata.sort_by(&:title)
|
8
7
|
response.content_type = 'text/html'
|
9
8
|
response.write(
|
10
9
|
::Weneedfeed::Views::ShowTopPage.new(
|
11
|
-
page_schemata: page_schemata,
|
12
10
|
partial_template_path: ::File.expand_path(
|
13
11
|
'templates/show_top_page.html.erb',
|
14
12
|
"#{__dir__}/../../.."
|
15
13
|
),
|
16
|
-
request: request
|
14
|
+
request: request,
|
15
|
+
schema: schema
|
17
16
|
).to_s
|
18
17
|
)
|
19
18
|
end
|
data/lib/weneedfeed/schema.rb
CHANGED
@@ -4,6 +4,8 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module Weneedfeed
|
6
6
|
class Schema
|
7
|
+
DEFAULT_TITLE = 'Weneedfeed'
|
8
|
+
|
7
9
|
class << self
|
8
10
|
# @param [String] schema_path
|
9
11
|
# @return [Weneedfeed::Schema]
|
@@ -48,5 +50,10 @@ module Weneedfeed
|
|
48
50
|
)
|
49
51
|
end
|
50
52
|
end
|
53
|
+
|
54
|
+
# @return [String]
|
55
|
+
def title
|
56
|
+
@raw['title'] || DEFAULT_TITLE
|
57
|
+
end
|
51
58
|
end
|
52
59
|
end
|
data/lib/weneedfeed/version.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
module Weneedfeed
|
4
4
|
module Views
|
5
5
|
class ShowOpml < Base
|
6
|
-
# @param [
|
7
|
-
def initialize(
|
6
|
+
# @param [Weneedfeed::Schema] schema
|
7
|
+
def initialize(schema:, **argv)
|
8
8
|
super(**argv)
|
9
|
-
@
|
9
|
+
@schema = schema
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -21,6 +21,11 @@ module Weneedfeed
|
|
21
21
|
def feed_path(page_id:)
|
22
22
|
"#{base_path}#{router.path(:feed, page_id: page_id)}"
|
23
23
|
end
|
24
|
+
|
25
|
+
# @return [Array<String>]
|
26
|
+
def page_schemata
|
27
|
+
@schema.page_schemata.sort_by(&:title)
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module Weneedfeed
|
4
4
|
module Views
|
5
5
|
class ShowTopPage < Base
|
6
|
-
# @param [
|
7
|
-
def initialize(
|
6
|
+
# @param [Weneedfeed::Schema] schema
|
7
|
+
def initialize(schema:, **argv)
|
8
8
|
super(**argv)
|
9
|
-
@
|
9
|
+
@schema = schema
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -27,6 +27,11 @@ module Weneedfeed
|
|
27
27
|
"#{base_path}#{router.path(:opml)}"
|
28
28
|
end
|
29
29
|
|
30
|
+
# @return [Array<String>]
|
31
|
+
def page_schemata
|
32
|
+
@schema.page_schemata.sort_by(&:title)
|
33
|
+
end
|
34
|
+
|
30
35
|
# @return [Hanami::Router]
|
31
36
|
def router
|
32
37
|
::Weneedfeed::Application.router
|
data/templates/show_opml.xml.erb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<opml version="1.0">
|
3
3
|
<head>
|
4
|
-
<title
|
4
|
+
<title><%= @schema.title %></title>
|
5
5
|
</head>
|
6
6
|
<body>
|
7
|
-
<outline text="
|
8
|
-
<%
|
7
|
+
<outline text="<%= @schema.title %>" title="<%= @schema.title %>">
|
8
|
+
<% page_schemata.each do |page_schema| %>
|
9
9
|
<outline type="rss" text="<%= page_schema.title %>" title="<%= page_schema.title %>" xmlUrl="<%= "#{request.base_url}#{feed_path(page_id: page_schema.id)}" %>" htmlUrl="<%= page_schema.url %>"/>
|
10
10
|
<% end %>
|
11
11
|
</outline>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8">
|
5
5
|
<meta name="viewport" content="width=device-width">
|
6
|
-
<title
|
6
|
+
<title><%= @schema.title %></title>
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<section>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<h1>Feeds</h1>
|
12
12
|
</header>
|
13
13
|
<ul>
|
14
|
-
<%
|
14
|
+
<% page_schemata.each do |page_schema| %>
|
15
15
|
<li>
|
16
16
|
<a href="<%= feed_path(page_id: page_schema.id) %>"><%= page_schema.title %></a>
|
17
17
|
</li>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weneedfeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|