m2fm-automatic-embed 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +7 -0
- data/fixtures/no-links.eml +61 -0
- data/fixtures/soundcloud-link.eml +60 -0
- data/fixtures/youtube-link.eml +60 -0
- data/lib/mail2frontmatter/automatic-embeds.rb +36 -0
- data/m2fm-automatic-embeds.gemspec +27 -0
- data/spec/automatic_embed_spec.rb +26 -0
- data/spec/spec_helper.rb +1 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aaf87e4c1a4c933967340bdc50e26ae32870c421
|
4
|
+
data.tar.gz: 7c691c2bc155c4998b79ff901867d32ad4d5a2e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e432c799da46aea2c9e753647d0420ff19a9913abd40149af34f9aac7c0dc775466f3467b7cb8822626305a6e7880578d481af7f386e2bbdada2c5c8f81a6961
|
7
|
+
data.tar.gz: 47744656485bed1600d4cf5f3e1953bade0dc23accd7a150b82d3f23f279d83610901a722bd4d97c62ea4f37ce2ec3b7f98bb9f041c8c5eb52ab9fcc0deff9a0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Kunal Shah
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Mail2FrontMatter::AutomaticEmbed
|
2
|
+
|
3
|
+
AutomaticEmbed is a [Mail2FrontMatter](https://github.com/whistlerbrk/mail2frontmatter) plugin which generates embed codes for links. This is a thin layer around the [auto_html](https://github.com/whistlerbrk/auto_html) project to generate the necessary HTML.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'm2fm-automatic-embed', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
## Configuration
|
18
|
+
|
19
|
+
In your Mail2FrontMatter YAML configuration enable the plugin by adding it to your preprocessors:
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
protocol: imap
|
23
|
+
receiver: yourblogemail@yourdomain.com
|
24
|
+
senders: yourpersonal@yourdomain.com
|
25
|
+
|
26
|
+
preprocessors:
|
27
|
+
- key: 'automatic-embed'
|
28
|
+
|
29
|
+
mailman:
|
30
|
+
server: imap.gmail.com
|
31
|
+
port: 993
|
32
|
+
ssl: true
|
33
|
+
username: yourblogemail@yourdomain.com
|
34
|
+
password: yourpassword
|
35
|
+
```
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
That's it! Now incoming links from a number of [content providers](https://github.com/dejan/auto_html/tree/master/lib/auto_html/filters) will be embedded automatically.
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it ( https://github.com/whistlerbrk/m2fm-automatic-embed/fork )
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
Delivered-To: stream@kunalashah.com
|
3
|
+
Received: by 10.216.42.73 with SMTP id i51csp1200401web;
|
4
|
+
Mon, 12 Jan 2015 19:39:33 -0800 (PST)
|
5
|
+
X-Received: by 10.236.41.202 with SMTP id h50mr21052293yhb.140.1421120372875;
|
6
|
+
Mon, 12 Jan 2015 19:39:32 -0800 (PST)
|
7
|
+
Return-Path: <me@kunalashah.com>
|
8
|
+
Received: from mail-yh0-x232.google.com (mail-yh0-x232.google.com. [2607:f8b0:4002:c01::232])
|
9
|
+
by mx.google.com with ESMTPS id 79si10236396ykt.36.2015.01.12.19.39.32
|
10
|
+
for <stream@kunalashah.com>
|
11
|
+
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
|
12
|
+
Mon, 12 Jan 2015 19:39:32 -0800 (PST)
|
13
|
+
Received-SPF: none (google.com: me@kunalashah.com does not designate permitted sender hosts) client-ip=2607:f8b0:4002:c01::232;
|
14
|
+
Authentication-Results: mx.google.com;
|
15
|
+
spf=none (google.com: me@kunalashah.com does not designate permitted sender hosts) smtp.mail=me@kunalashah.com;
|
16
|
+
dkim=pass header.i=@kunalashah.com
|
17
|
+
Received: by mail-yh0-f50.google.com with SMTP id b6so356245yha.9
|
18
|
+
for <stream@kunalashah.com>; Mon, 12 Jan 2015 19:39:31 -0800 (PST)
|
19
|
+
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
20
|
+
d=kunalashah.com; s=google;
|
21
|
+
h=mime-version:date:message-id:subject:from:to:content-type;
|
22
|
+
bh=xvqejrLOBkvtZ/LV00B3w07XE6B1WPIeFwV0y5FOk48=;
|
23
|
+
b=Y310Cno+tXMfIFuHEFvEGd/U+K8EuUQQ+TUFCvla9JZ2m4Agh9Oog5PAETy4RAUXCw
|
24
|
+
OSgzTTYgEpVneeWNu/uXwTucwrTHzSEW2MeLLr/beQsEWLKeW1pg7IcO8o16WrI76nd1
|
25
|
+
xGqh4v/7YVHNK/Lyrrm0/7ANFVrdWu5b37t58=
|
26
|
+
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
27
|
+
d=1e100.net; s=20130820;
|
28
|
+
h=x-gm-message-state:mime-version:date:message-id:subject:from:to
|
29
|
+
:content-type;
|
30
|
+
bh=xvqejrLOBkvtZ/LV00B3w07XE6B1WPIeFwV0y5FOk48=;
|
31
|
+
b=LMSU/hDJIcMdBAId5WcNCGsT6zMUwCSBZXkHry3Ez19XT3tsHF/1V9nthO39yLzJTc
|
32
|
+
lKIIU6TVDOnRtj/6SSsSLLxOFjXu+hiNZsJNR32AzjzBwTZBV4YKFdlemn4tTDQG0Wpb
|
33
|
+
DDjUvzvNHOTT9h8wRQVZIrng1liJXO8Z20msNwdgsS1dB5EK4jCleU21l6KI10eenTHu
|
34
|
+
gbqwOqV2teAZ3gu3J6mR6BkyiRDc5qZuhSasdT+HRzgCRszbv49eaXPBz/Kax4aadhFU
|
35
|
+
zOLWEswjgpC+Rxj5i4WGvf7hIRyAf/9oLVZQW1DSavnOG6frEESyiAU7VJ457XTZw0uK
|
36
|
+
4H4Q==
|
37
|
+
X-Gm-Message-State: ALoCoQnXibjhC9yUZfwNU1j0v/wXuMTj5PBzoZXIMnGz+pWYPziFyExdgJVpO1fjHvGE/gcr3R9/
|
38
|
+
MIME-Version: 1.0
|
39
|
+
X-Received: by 10.170.49.6 with SMTP id 6mr28189061ykr.118.1421120371787; Mon,
|
40
|
+
12 Jan 2015 19:39:31 -0800 (PST)
|
41
|
+
Received: by 10.170.205.16 with HTTP; Mon, 12 Jan 2015 19:39:31 -0800 (PST)
|
42
|
+
X-Originating-IP: [66.108.230.254]
|
43
|
+
Date: Mon, 12 Jan 2015 22:39:31 -0500
|
44
|
+
Message-ID: <CAN-VoWm1nRXKLZk-g368U05SE7_Z9aHV9abL+PEbf-kn=0HDFw@mail.gmail.com>
|
45
|
+
Subject: the earth is the best manufacturer we have
|
46
|
+
From: Kunal Shah <me@kunalashah.com>
|
47
|
+
To: "stream@kunalashah.com" <stream@kunalashah.com>
|
48
|
+
Content-Type: multipart/alternative; boundary=001a11394e8ef1a379050c805e70
|
49
|
+
|
50
|
+
--001a11394e8ef1a379050c805e70
|
51
|
+
Content-Type: text/plain; charset=UTF-8
|
52
|
+
|
53
|
+
- vv
|
54
|
+
|
55
|
+
--001a11394e8ef1a379050c805e70
|
56
|
+
Content-Type: text/html; charset=UTF-8
|
57
|
+
|
58
|
+
<div dir="ltr">- vv
|
59
|
+
</div>
|
60
|
+
|
61
|
+
--001a11394e8ef1a379050c805e70--
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
Delivered-To: stream@kunalashah.com
|
3
|
+
Received: by 10.216.42.73 with SMTP id i51csp1200401web;
|
4
|
+
Mon, 12 Jan 2015 19:39:33 -0800 (PST)
|
5
|
+
X-Received: by 10.236.41.202 with SMTP id h50mr21052293yhb.140.1421120372875;
|
6
|
+
Mon, 12 Jan 2015 19:39:32 -0800 (PST)
|
7
|
+
Return-Path: <me@kunalashah.com>
|
8
|
+
Received: from mail-yh0-x232.google.com (mail-yh0-x232.google.com. [2607:f8b0:4002:c01::232])
|
9
|
+
by mx.google.com with ESMTPS id 79si10236396ykt.36.2015.01.12.19.39.32
|
10
|
+
for <stream@kunalashah.com>
|
11
|
+
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
|
12
|
+
Mon, 12 Jan 2015 19:39:32 -0800 (PST)
|
13
|
+
Received-SPF: none (google.com: me@kunalashah.com does not designate permitted sender hosts) client-ip=2607:f8b0:4002:c01::232;
|
14
|
+
Authentication-Results: mx.google.com;
|
15
|
+
spf=none (google.com: me@kunalashah.com does not designate permitted sender hosts) smtp.mail=me@kunalashah.com;
|
16
|
+
dkim=pass header.i=@kunalashah.com
|
17
|
+
Received: by mail-yh0-f50.google.com with SMTP id b6so356245yha.9
|
18
|
+
for <stream@kunalashah.com>; Mon, 12 Jan 2015 19:39:31 -0800 (PST)
|
19
|
+
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
20
|
+
d=kunalashah.com; s=google;
|
21
|
+
h=mime-version:date:message-id:subject:from:to:content-type;
|
22
|
+
bh=xvqejrLOBkvtZ/LV00B3w07XE6B1WPIeFwV0y5FOk48=;
|
23
|
+
b=Y310Cno+tXMfIFuHEFvEGd/U+K8EuUQQ+TUFCvla9JZ2m4Agh9Oog5PAETy4RAUXCw
|
24
|
+
OSgzTTYgEpVneeWNu/uXwTucwrTHzSEW2MeLLr/beQsEWLKeW1pg7IcO8o16WrI76nd1
|
25
|
+
xGqh4v/7YVHNK/Lyrrm0/7ANFVrdWu5b37t58=
|
26
|
+
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
27
|
+
d=1e100.net; s=20130820;
|
28
|
+
h=x-gm-message-state:mime-version:date:message-id:subject:from:to
|
29
|
+
:content-type;
|
30
|
+
bh=xvqejrLOBkvtZ/LV00B3w07XE6B1WPIeFwV0y5FOk48=;
|
31
|
+
b=LMSU/hDJIcMdBAId5WcNCGsT6zMUwCSBZXkHry3Ez19XT3tsHF/1V9nthO39yLzJTc
|
32
|
+
lKIIU6TVDOnRtj/6SSsSLLxOFjXu+hiNZsJNR32AzjzBwTZBV4YKFdlemn4tTDQG0Wpb
|
33
|
+
DDjUvzvNHOTT9h8wRQVZIrng1liJXO8Z20msNwdgsS1dB5EK4jCleU21l6KI10eenTHu
|
34
|
+
gbqwOqV2teAZ3gu3J6mR6BkyiRDc5qZuhSasdT+HRzgCRszbv49eaXPBz/Kax4aadhFU
|
35
|
+
zOLWEswjgpC+Rxj5i4WGvf7hIRyAf/9oLVZQW1DSavnOG6frEESyiAU7VJ457XTZw0uK
|
36
|
+
4H4Q==
|
37
|
+
X-Gm-Message-State: ALoCoQnXibjhC9yUZfwNU1j0v/wXuMTj5PBzoZXIMnGz+pWYPziFyExdgJVpO1fjHvGE/gcr3R9/
|
38
|
+
MIME-Version: 1.0
|
39
|
+
X-Received: by 10.170.49.6 with SMTP id 6mr28189061ykr.118.1421120371787; Mon,
|
40
|
+
12 Jan 2015 19:39:31 -0800 (PST)
|
41
|
+
Received: by 10.170.205.16 with HTTP; Mon, 12 Jan 2015 19:39:31 -0800 (PST)
|
42
|
+
X-Originating-IP: [66.108.230.254]
|
43
|
+
Date: Mon, 12 Jan 2015 22:39:31 -0500
|
44
|
+
Message-ID: <CAN-VoWm1nRXKLZk-g368U05SE7_Z9aHV9abL+PEbf-kn=0HDFw@mail.gmail.com>
|
45
|
+
Subject: Dan's Soundcloud
|
46
|
+
From: Kunal Shah <me@kunalashah.com>
|
47
|
+
To: "stream@kunalashah.com" <stream@kunalashah.com>
|
48
|
+
Content-Type: multipart/alternative; boundary=001a11394e8ef1a379050c805e70
|
49
|
+
|
50
|
+
--001a11394e8ef1a379050c805e70
|
51
|
+
Content-Type: text/plain; charset=UTF-8
|
52
|
+
|
53
|
+
My buddy Dan's track with his bro. https://soundcloud.com/danielamorse/pinball-1
|
54
|
+
|
55
|
+
--001a11394e8ef1a379050c805e70
|
56
|
+
Content-Type: text/html; charset=UTF-8
|
57
|
+
|
58
|
+
<div dir="ltr">My buddy Dan's track with his bro. https://soundcloud.com/danielamorse/pinball-1</div>
|
59
|
+
|
60
|
+
--001a11394e8ef1a379050c805e70--
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
Delivered-To: stream@kunalashah.com
|
3
|
+
Received: by 10.216.42.73 with SMTP id i51csp1200401web;
|
4
|
+
Mon, 12 Jan 2015 19:39:33 -0800 (PST)
|
5
|
+
X-Received: by 10.236.41.202 with SMTP id h50mr21052293yhb.140.1421120372875;
|
6
|
+
Mon, 12 Jan 2015 19:39:32 -0800 (PST)
|
7
|
+
Return-Path: <me@kunalashah.com>
|
8
|
+
Received: from mail-yh0-x232.google.com (mail-yh0-x232.google.com. [2607:f8b0:4002:c01::232])
|
9
|
+
by mx.google.com with ESMTPS id 79si10236396ykt.36.2015.01.12.19.39.32
|
10
|
+
for <stream@kunalashah.com>
|
11
|
+
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
|
12
|
+
Mon, 12 Jan 2015 19:39:32 -0800 (PST)
|
13
|
+
Received-SPF: none (google.com: me@kunalashah.com does not designate permitted sender hosts) client-ip=2607:f8b0:4002:c01::232;
|
14
|
+
Authentication-Results: mx.google.com;
|
15
|
+
spf=none (google.com: me@kunalashah.com does not designate permitted sender hosts) smtp.mail=me@kunalashah.com;
|
16
|
+
dkim=pass header.i=@kunalashah.com
|
17
|
+
Received: by mail-yh0-f50.google.com with SMTP id b6so356245yha.9
|
18
|
+
for <stream@kunalashah.com>; Mon, 12 Jan 2015 19:39:31 -0800 (PST)
|
19
|
+
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
20
|
+
d=kunalashah.com; s=google;
|
21
|
+
h=mime-version:date:message-id:subject:from:to:content-type;
|
22
|
+
bh=xvqejrLOBkvtZ/LV00B3w07XE6B1WPIeFwV0y5FOk48=;
|
23
|
+
b=Y310Cno+tXMfIFuHEFvEGd/U+K8EuUQQ+TUFCvla9JZ2m4Agh9Oog5PAETy4RAUXCw
|
24
|
+
OSgzTTYgEpVneeWNu/uXwTucwrTHzSEW2MeLLr/beQsEWLKeW1pg7IcO8o16WrI76nd1
|
25
|
+
xGqh4v/7YVHNK/Lyrrm0/7ANFVrdWu5b37t58=
|
26
|
+
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
27
|
+
d=1e100.net; s=20130820;
|
28
|
+
h=x-gm-message-state:mime-version:date:message-id:subject:from:to
|
29
|
+
:content-type;
|
30
|
+
bh=xvqejrLOBkvtZ/LV00B3w07XE6B1WPIeFwV0y5FOk48=;
|
31
|
+
b=LMSU/hDJIcMdBAId5WcNCGsT6zMUwCSBZXkHry3Ez19XT3tsHF/1V9nthO39yLzJTc
|
32
|
+
lKIIU6TVDOnRtj/6SSsSLLxOFjXu+hiNZsJNR32AzjzBwTZBV4YKFdlemn4tTDQG0Wpb
|
33
|
+
DDjUvzvNHOTT9h8wRQVZIrng1liJXO8Z20msNwdgsS1dB5EK4jCleU21l6KI10eenTHu
|
34
|
+
gbqwOqV2teAZ3gu3J6mR6BkyiRDc5qZuhSasdT+HRzgCRszbv49eaXPBz/Kax4aadhFU
|
35
|
+
zOLWEswjgpC+Rxj5i4WGvf7hIRyAf/9oLVZQW1DSavnOG6frEESyiAU7VJ457XTZw0uK
|
36
|
+
4H4Q==
|
37
|
+
X-Gm-Message-State: ALoCoQnXibjhC9yUZfwNU1j0v/wXuMTj5PBzoZXIMnGz+pWYPziFyExdgJVpO1fjHvGE/gcr3R9/
|
38
|
+
MIME-Version: 1.0
|
39
|
+
X-Received: by 10.170.49.6 with SMTP id 6mr28189061ykr.118.1421120371787; Mon,
|
40
|
+
12 Jan 2015 19:39:31 -0800 (PST)
|
41
|
+
Received: by 10.170.205.16 with HTTP; Mon, 12 Jan 2015 19:39:31 -0800 (PST)
|
42
|
+
X-Originating-IP: [66.108.230.254]
|
43
|
+
Date: Mon, 12 Jan 2015 22:39:31 -0500
|
44
|
+
Message-ID: <CAN-VoWm1nRXKLZk-g368U05SE7_Z9aHV9abL+PEbf-kn=0HDFw@mail.gmail.com>
|
45
|
+
Subject: Interstellar OST
|
46
|
+
From: Kunal Shah <me@kunalashah.com>
|
47
|
+
To: "stream@kunalashah.com" <stream@kunalashah.com>
|
48
|
+
Content-Type: multipart/alternative; boundary=001a11394e8ef1a379050c805e70
|
49
|
+
|
50
|
+
--001a11394e8ef1a379050c805e70
|
51
|
+
Content-Type: text/plain; charset=UTF-8
|
52
|
+
|
53
|
+
I think B Colony made the wormhole. https://www.youtube.com/watch?v=jo5m5GXF9Ec
|
54
|
+
|
55
|
+
--001a11394e8ef1a379050c805e70
|
56
|
+
Content-Type: text/html; charset=UTF-8
|
57
|
+
|
58
|
+
<div dir="ltr">I think B Colony made the wormhole. https://www.youtube.com/watch?v=jo5m5GXF9Ec</div>
|
59
|
+
|
60
|
+
--001a11394e8ef1a379050c805e70--
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'mail2frontmatter'
|
2
|
+
require 'auto_html'
|
3
|
+
require 'byebug'
|
4
|
+
|
5
|
+
module Mail2FrontMatter
|
6
|
+
class AutomaticEmbed < PreProcessor
|
7
|
+
extend AutoHtml
|
8
|
+
|
9
|
+
@all_filters = [:youtube, :soundcloud, :link, :ted, :twitter, :vimeo, :google_map, :gist, :flickr]
|
10
|
+
|
11
|
+
def self.run(metadata, body)
|
12
|
+
# I *could* introspect on auto_html here but I haven't vetted them all yet
|
13
|
+
|
14
|
+
if @options[:white_list]
|
15
|
+
filters = @options[:white_list]
|
16
|
+
elsif @options[:black_list]
|
17
|
+
filters = @all_filters - @options[:black_list]
|
18
|
+
else
|
19
|
+
filters = @all_filters
|
20
|
+
end
|
21
|
+
|
22
|
+
body = auto_html(body, { filters: filters, options: @options[:filters] }) {
|
23
|
+
# use options passed to us...
|
24
|
+
@options[:filters].each do |filter|
|
25
|
+
options_for_filter = @options[:options] ? (@options[:options][filter.to_sym] || {}) : {}
|
26
|
+
self.send(filter.to_sym, options_for_filter)
|
27
|
+
end
|
28
|
+
|
29
|
+
# be sure to return @text here
|
30
|
+
@text
|
31
|
+
}
|
32
|
+
|
33
|
+
return metadata, body
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'm2fm-automatic-embed'
|
7
|
+
spec.version = '0.0.1'
|
8
|
+
spec.authors = ['Kunal Shah']
|
9
|
+
spec.email = ['me@kunalashah.com']
|
10
|
+
spec.summary = %q{mail2frontmatter plugin to transform links into embed code automatically}
|
11
|
+
spec.description = spec.summary
|
12
|
+
spec.homepage = 'https://github.com/whistlerbrk/m2fm-automatic-embed'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'mail2frontmatter', '>= 0.0.4'
|
21
|
+
spec.add_dependency 'auto_html-whistlerbrk', '2.0.0.pre'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'byebug'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'byebug'
|
3
|
+
|
4
|
+
describe Mail2FrontMatter::Parser, "parsing" do
|
5
|
+
|
6
|
+
let(:soundcloud) {
|
7
|
+
Mail::Message.new(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'soundcloud-link.eml')))
|
8
|
+
}
|
9
|
+
let(:youtube) {
|
10
|
+
Mail::Message.new(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'youtube-link.eml')))
|
11
|
+
}
|
12
|
+
let(:control) {
|
13
|
+
Mail::Message.new(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'no-links.eml')))
|
14
|
+
}
|
15
|
+
|
16
|
+
it "should identify and transform youtube link" do
|
17
|
+
Mail2FrontMatter::AutomaticEmbed.register
|
18
|
+
|
19
|
+
parser = Mail2FrontMatter::Parser.new(youtube)
|
20
|
+
metadata, body = Mail2FrontMatter::PreProcessor.process(parser.metadata, parser.body)
|
21
|
+
|
22
|
+
body.should match(/embed/)
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'mail2frontmatter', 'automatic-embeds'))
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: m2fm-automatic-embed
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kunal Shah
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mail2frontmatter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: auto_html-whistlerbrk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0.pre
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0.pre
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: mail2frontmatter plugin to transform links into embed code automatically
|
98
|
+
email:
|
99
|
+
- me@kunalashah.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- fixtures/no-links.eml
|
110
|
+
- fixtures/soundcloud-link.eml
|
111
|
+
- fixtures/youtube-link.eml
|
112
|
+
- lib/mail2frontmatter/automatic-embeds.rb
|
113
|
+
- m2fm-automatic-embeds.gemspec
|
114
|
+
- spec/automatic_embed_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
homepage: https://github.com/whistlerbrk/m2fm-automatic-embed
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.4.5
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: mail2frontmatter plugin to transform links into embed code automatically
|
140
|
+
test_files:
|
141
|
+
- spec/automatic_embed_spec.rb
|
142
|
+
- spec/spec_helper.rb
|