feed2imap 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/feed2imap/config.rb +1 -1
- data/lib/feed2imap/feed2imap.rb +8 -0
- data/lib/feed2imap/itemtomail.rb +0 -1
- data/lib/feed2imap/version.rb +1 -1
- data/test/tc_itemtomail.rb +41 -0
- metadata +9 -9
- data/setup.rb +0 -1586
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a8d75ff963e56a991f8180012db653147c9e2b4520565916c94083ad160f3b6
|
4
|
+
data.tar.gz: 68992f2ae03c5f3c29763c4fd2becb2912e94c8d47d607230b0ec21b40c9b136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676f9c559b6ff084c3da469a8df713677b65399702c32e8e995f14f0b5f5de818ca50b54c1814034aa9b07722c130e48357d012f2110b154913d0742c085a45c
|
7
|
+
data.tar.gz: 38dcbc31f225873dbf22907682edbd7e7114e10a95ffb30bdf335f459849910e34052326202181e1b37a740c801b1dc7c1ca05d614df34ca71a55b7a61103fc6
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ task :default => [:test]
|
|
9
9
|
|
10
10
|
PKG_NAME = 'feed2imap'
|
11
11
|
PKG_VERSION = Feed2Imap::VERSION
|
12
|
-
PKG_FILES = [ 'ChangeLog', 'README', 'COPYING', '
|
12
|
+
PKG_FILES = [ 'ChangeLog', 'README', 'COPYING', 'Rakefile']
|
13
13
|
Find.find('bin/', 'lib/', 'test/', 'data/') do |f|
|
14
14
|
if FileTest.directory?(f) and f =~ /\.svn/
|
15
15
|
Find.prune
|
data/lib/feed2imap/config.rb
CHANGED
@@ -40,7 +40,7 @@ class F2IConfig
|
|
40
40
|
# Load the configuration from the IO stream
|
41
41
|
# TODO should do some sanity check on the data read.
|
42
42
|
def initialize(io)
|
43
|
-
@conf = YAML::load(io)
|
43
|
+
@conf = YAML::load(io, aliases: true)
|
44
44
|
@cache = @conf['cache'] || DEFCACHE
|
45
45
|
@dumpdir = @conf['dumpdir'] || nil
|
46
46
|
@conf['feeds'] ||= []
|
data/lib/feed2imap/feed2imap.rb
CHANGED
@@ -153,8 +153,16 @@ class Feed2Imap
|
|
153
153
|
outh = Thread::new do
|
154
154
|
output = stdout.read
|
155
155
|
end
|
156
|
+
err = nil
|
157
|
+
errth = Thread::new do
|
158
|
+
err = stderr.read.chomp
|
159
|
+
end
|
156
160
|
inth.join
|
157
161
|
outh.join
|
162
|
+
errth.join
|
163
|
+
err.lines do |e|
|
164
|
+
@logger.warn(e.chomp)
|
165
|
+
end
|
158
166
|
s = output
|
159
167
|
if $? && $?.exitstatus != 0
|
160
168
|
@logger.warn("Filter command for #{feed.name} exited with status #{$?.exitstatus}. Output might be corrupted !")
|
data/lib/feed2imap/itemtomail.rb
CHANGED
@@ -96,7 +96,6 @@ def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images =
|
|
96
96
|
# inline images as attachments
|
97
97
|
imgs = []
|
98
98
|
if inline_images
|
99
|
-
cids = []
|
100
99
|
htmlpart.body.gsub!(/(<img[^>]+)src="(\S+?\/([^\/]+?\.(png|gif|jpe?g)))"([^>]*>)/i) do |match|
|
101
100
|
# $2 contains url, $3 the image name, $4 the image extension
|
102
101
|
begin
|
data/lib/feed2imap/version.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'feed2imap'
|
3
|
+
require 'mocha/test_unit'
|
4
|
+
|
5
|
+
|
6
|
+
class ItemToMailTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def jpg
|
9
|
+
# a 1x1 white pixel
|
10
|
+
"\xFF\xD8\xFF\xE0\u0000\u0010JFIF\u0000\u0001\u0001\u0000\u0000\u0001\u0000\u0001\u0000\u0000\xFF\xDB\u0000C\u0000\u0003\u0002\u0002\u0002\u0002\u0002\u0003\u0002\u0002\u0002\u0003\u0003\u0003\u0003\u0004\u0006\u0004\u0004\u0004\u0004\u0004\b\u0006\u0006\u0005\u0006\t\b\n\n\t\b\t\t\n\f\u000F\f\n\v\u000E\v\t\t\r\u0011\r\u000E\u000F\u0010\u0010\u0011\u0010\n\f\u0012\u0013\u0012\u0010\u0013\u000F\u0010\u0010\u0010\xFF\xC0\u0000\v\b\u0000\u0001\u0000\u0001\u0001\u0001\u0011\u0000\xFF\xC4\u0000\u0014\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\t\xFF\xC4\u0000\u0014\u0010\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\xFF\xDA\u0000\b\u0001\u0001\u0000\u0000?\u0000T\xDF\xFF\xD9"
|
11
|
+
end
|
12
|
+
|
13
|
+
def jpeg_base64
|
14
|
+
# base64 encoding of the image in #jpg above
|
15
|
+
"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQE\nBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/\nwAALCAABAAEBAREA/8QAFAABAAAAAAAAAAAAAAAAAAAACf/EABQQAQAAAAAA\nAAAAAAAAAAAAAAD/2gAIAQEAAD8AVN//2Q==\n"
|
16
|
+
end
|
17
|
+
|
18
|
+
def config
|
19
|
+
F2IConfig.new(StringIO.new("{}"))
|
20
|
+
end
|
21
|
+
|
22
|
+
def new_item
|
23
|
+
feed = FeedParser::Feed.new
|
24
|
+
feed.instance_variable_set("@title", "Some blog")
|
25
|
+
feed.instance_variable_set("@link", "http://www.example.com/")
|
26
|
+
item = FeedParser::FeedItem.new
|
27
|
+
item.instance_variable_set("@feed", feed)
|
28
|
+
item.title = "Some post"
|
29
|
+
item
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_img
|
33
|
+
id = "abcd1234"
|
34
|
+
item = new_item
|
35
|
+
item.content = '<img src="http://www.example.com/pixel.jpg"/>'
|
36
|
+
HTTPFetcher.any_instance.expects(:fetch).with("http://www.example.com/pixel.jpg", anything).returns(jpg)
|
37
|
+
mail = item_to_mail(config, item, id, true, "feed2imap", true, false)
|
38
|
+
assert_match %r{<img src="data:image/jpg;base64,#{jpeg_base64}"/>}, mail.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feed2imap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Nussbaum
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-feedparser
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.4
|
41
41
|
description: RSS/Atom feed aggregator
|
42
|
-
email:
|
42
|
+
email:
|
43
43
|
executables:
|
44
44
|
- feed2imap
|
45
45
|
- feed2imap-cleaner
|
@@ -74,7 +74,6 @@ files:
|
|
74
74
|
- lib/feed2imap/rexml_settings.rb
|
75
75
|
- lib/feed2imap/sgml-parser.rb
|
76
76
|
- lib/feed2imap/version.rb
|
77
|
-
- setup.rb
|
78
77
|
- test/maildir/cur/1376317520.15784_1.debian:2,S
|
79
78
|
- test/maildir/cur/1376317520.15789_1.debian:2,S
|
80
79
|
- test/maildir/cur/1376319137.17850_1.debian:2,
|
@@ -83,11 +82,12 @@ files:
|
|
83
82
|
- test/tc_cache.rb
|
84
83
|
- test/tc_config.rb
|
85
84
|
- test/tc_httpfetcher.rb
|
85
|
+
- test/tc_itemtomail.rb
|
86
86
|
- test/tc_maildir.rb
|
87
|
-
homepage:
|
87
|
+
homepage:
|
88
88
|
licenses: []
|
89
89
|
metadata: {}
|
90
|
-
post_install_message:
|
90
|
+
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.3.
|
106
|
-
signing_key:
|
105
|
+
rubygems_version: 3.3.15
|
106
|
+
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: RSS/Atom feed aggregator
|
109
109
|
test_files: []
|