rss2mail 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +1 -1
- data/Rakefile +3 -3
- data/lib/rss2mail/app.rb +16 -9
- data/lib/rss2mail/cli.rb +5 -3
- data/lib/rss2mail/feed.rb +3 -3
- data/lib/rss2mail/util.rb +7 -6
- data/lib/rss2mail/version.rb +1 -1
- metadata +20 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8bedfd16d99cdc944139b587acb2cc62b1967f
|
4
|
+
data.tar.gz: 62fd84a1410ea0601a9c978e00c52f49007c1e16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82d6b18e1909fcbdb57418279a36da537676172400f1ffb036c4aefeba23028dfc58e04272f471cf90abf10ce767c1d7201995db5e13155d02d9b64c30622b6
|
7
|
+
data.tar.gz: 3e4215196b5e62655f360cbbf72aea4f22156a459fd8e96205abd284b99f33f2f87096e34a4825ae5d0459d3bee52e74470fa0b538e9fb33b6602ef3638f4d07
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative 'lib/rss2mail/version'
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'hen'
|
@@ -14,9 +14,9 @@ begin
|
|
14
14
|
homepage: :blackwinter,
|
15
15
|
extra_files: FileList['templates/*'].to_a,
|
16
16
|
dependencies: %w[
|
17
|
-
cyclops nokogiri nuggets
|
17
|
+
cyclops nokogiri nuggets
|
18
18
|
simple-rss sinatra unidecoder
|
19
|
-
],
|
19
|
+
] << ['safe_yaml-store', '~> 0.0'],
|
20
20
|
|
21
21
|
required_ruby_version: '>= 1.9.3'
|
22
22
|
}
|
data/lib/rss2mail/app.rb
CHANGED
@@ -78,20 +78,27 @@ end
|
|
78
78
|
def prepare
|
79
79
|
user = request.env['REMOTE_USER'] or error(400)
|
80
80
|
|
81
|
-
@
|
82
|
-
|
83
|
-
|
81
|
+
@feeds = RSS2Mail::Util.load_feeds(
|
82
|
+
File.join(settings.root, 'feeds.d', "#{user}.yaml"))
|
83
|
+
|
84
|
+
@tos = []
|
85
|
+
|
86
|
+
@feeds.transaction(true) {
|
87
|
+
@targets = @feeds.roots.sort_by(&:to_s).each { |target|
|
88
|
+
@feeds[target].each { |feed| @tos.concat(Array(feed[:to])) } } }
|
89
|
+
|
90
|
+
@tos.uniq!
|
84
91
|
end
|
85
92
|
|
86
93
|
def update(create = false)
|
87
|
-
feeds = @feeds
|
94
|
+
feeds = @feeds.get(@target)
|
88
95
|
|
89
96
|
feed = feeds.find { |f| f[:url] == @feed_url }
|
90
97
|
error(404) unless feed || create
|
91
98
|
|
92
99
|
yield feeds, feed
|
93
100
|
|
94
|
-
RSS2Mail::Util.dump_feeds(@
|
101
|
+
RSS2Mail::Util.dump_feeds(@feeds, @target, feeds)
|
95
102
|
@title, @to = feed.values_at(:title, :to) unless create
|
96
103
|
end
|
97
104
|
|
@@ -157,7 +164,7 @@ __END__
|
|
157
164
|
<br />
|
158
165
|
<input type="text" id="to" name="to" value="<%=h @to %>" size="54" list="tos" />
|
159
166
|
<datalist id="tos">
|
160
|
-
<% for to in @
|
167
|
+
<% for to in @tos.sort %>
|
161
168
|
<option value="<%=h to %>" />
|
162
169
|
<% end %>
|
163
170
|
</datalist>
|
@@ -176,12 +183,12 @@ __END__
|
|
176
183
|
<h2>subscriptions</h2>
|
177
184
|
|
178
185
|
<ul>
|
179
|
-
<% for target in @targets %>
|
186
|
+
<% for target in @targets; feeds = @feeds.get(target) %>
|
180
187
|
<li>
|
181
|
-
<strong><%=h target %></strong> (<%=
|
188
|
+
<strong><%=h target %></strong> (<%= feeds.size %>)
|
182
189
|
|
183
190
|
<ul>
|
184
|
-
<% for feed in
|
191
|
+
<% for feed in feeds.sort_by { |f| f[:title].downcase } %>
|
185
192
|
<li>
|
186
193
|
<form method="post">
|
187
194
|
<input type="hidden" name="target" value="<%=h target %>" />
|
data/lib/rss2mail/cli.rb
CHANGED
@@ -68,12 +68,14 @@ module RSS2Mail
|
|
68
68
|
}
|
69
69
|
|
70
70
|
(options.delete(:files) || default_files).each { |feeds_file|
|
71
|
-
|
71
|
+
unless File.readable?(feeds_file)
|
72
72
|
warn "Feeds file not found: #{feeds_file}"
|
73
73
|
next
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
feeds = Util.load_feeds(feeds_file)
|
77
|
+
|
78
|
+
unless target_feeds = feeds.get(target)
|
77
79
|
warn "Feeds target not found in #{feeds_file}: #{target}"
|
78
80
|
next
|
79
81
|
end
|
@@ -82,7 +84,7 @@ module RSS2Mail
|
|
82
84
|
Feed.new(feed, options).deliver(templates) unless feed[:skip]
|
83
85
|
}
|
84
86
|
|
85
|
-
|
87
|
+
Util.dump_feeds(feeds, target, target_feeds) unless options[:debug]
|
86
88
|
}
|
87
89
|
end
|
88
90
|
|
data/lib/rss2mail/feed.rb
CHANGED
@@ -130,7 +130,7 @@ module RSS2Mail
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
def get(reload = reload)
|
133
|
+
def get(reload = reload())
|
134
134
|
conditions = {}
|
135
135
|
|
136
136
|
if reload
|
@@ -180,7 +180,7 @@ module RSS2Mail
|
|
180
180
|
content
|
181
181
|
end
|
182
182
|
|
183
|
-
def parse(reload = reload)
|
183
|
+
def parse(reload = reload())
|
184
184
|
@rss = nil if reload
|
185
185
|
|
186
186
|
if content
|
@@ -230,7 +230,7 @@ module RSS2Mail
|
|
230
230
|
error err, 'while sending mail', transport
|
231
231
|
end
|
232
232
|
|
233
|
-
def log(msg, verbose = verbose)
|
233
|
+
def log(msg, verbose = verbose())
|
234
234
|
warn "[#{feed[:title]}] #{msg}" if verbose
|
235
235
|
end
|
236
236
|
|
data/lib/rss2mail/util.rb
CHANGED
@@ -24,9 +24,9 @@
|
|
24
24
|
###############################################################################
|
25
25
|
#++
|
26
26
|
|
27
|
+
require 'safe_yaml/store'
|
27
28
|
require 'open-uri'
|
28
29
|
require 'nokogiri'
|
29
|
-
require 'safe_yaml/load'
|
30
30
|
|
31
31
|
require 'rss2mail/version'
|
32
32
|
|
@@ -70,13 +70,14 @@ module RSS2Mail
|
|
70
70
|
open(url, options.merge('User-Agent' => USER_AGENT), &block)
|
71
71
|
end
|
72
72
|
|
73
|
-
def load_feeds(feeds_file)
|
74
|
-
|
75
|
-
|
73
|
+
def load_feeds(feeds_file, options = { deserialize_symbols: true })
|
74
|
+
SafeYAML::Store.new(feeds_file, {}, options).tap { |store|
|
75
|
+
def store.get(key); transaction(true) { self[key] }; end
|
76
|
+
}
|
76
77
|
end
|
77
78
|
|
78
|
-
def dump_feeds(
|
79
|
-
|
79
|
+
def dump_feeds(store, key, value)
|
80
|
+
store.transaction { store[key] = value }
|
80
81
|
end
|
81
82
|
|
82
83
|
end
|
data/lib/rss2mail/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rss2mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cyclops
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: simple-rss
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: sinatra
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: unidecoder
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,33 +95,39 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: safe_yaml-store
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '0.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '0.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: hen
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.8'
|
115
118
|
- - ">="
|
116
119
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
120
|
+
version: 0.8.0
|
118
121
|
type: :development
|
119
122
|
prerelease: false
|
120
123
|
version_requirements: !ruby/object:Gem::Requirement
|
121
124
|
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0.8'
|
122
128
|
- - ">="
|
123
129
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
130
|
+
version: 0.8.0
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
132
|
name: rake
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,7 +176,7 @@ metadata: {}
|
|
170
176
|
post_install_message:
|
171
177
|
rdoc_options:
|
172
178
|
- "--title"
|
173
|
-
- rss2mail Application documentation (v0.4.
|
179
|
+
- rss2mail Application documentation (v0.4.4)
|
174
180
|
- "--charset"
|
175
181
|
- UTF-8
|
176
182
|
- "--line-numbers"
|
@@ -191,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
197
|
version: '0'
|
192
198
|
requirements: []
|
193
199
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.4.
|
200
|
+
rubygems_version: 2.4.4
|
195
201
|
signing_key:
|
196
202
|
specification_version: 4
|
197
203
|
summary: Send RSS feeds as e-mail
|