mail2frontmatter 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +17 -6
- data/Rakefile +2 -0
- data/bin/mail2frontmatter +9 -0
- data/lib/mail2frontmatter/parser.rb +2 -1
- data/lib/mail2frontmatter/version.rb +1 -1
- data/mail2frontmatter.gemspec +1 -1
- data/spec/parser_spec.rb +0 -1
- data/spec/preprocessor_spec.rb +0 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2060ebb3af9ea3b6792caa4423b414ed610649b
|
4
|
+
data.tar.gz: e081455cbb6870923e7edb88b5c532ab1abd5ac1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1a99d909e3146c48cfd094eb10f25cbaf203e317573bc5471df5bd255b2369a4f46bae17af1b7a67e3414513b4348e1ccd1119c1fa70883a54622f0b86a514
|
7
|
+
data.tar.gz: 89d9ebc85b8cdee3fa1413f407310e35a05176fbe312a8aeb692bff12a55c404f6f091002e6e3e9f4d27fe0223dbfc78b21512dd0f8646fd6b4c702edb97e74e
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://travis-ci.org/whistlerbrk/Mail2FrontMatter)
|
2
|
+
|
1
3
|
# Mail2FrontMatter
|
2
4
|
|
3
5
|
Email-to-blog parser which creates YAML FrontMatter and saves your attachments.
|
@@ -24,11 +26,11 @@ And then execute:
|
|
24
26
|
|
25
27
|
To run in the foreground:
|
26
28
|
|
27
|
-
$ mail2frontmatter
|
29
|
+
$ bundle exec mail2frontmatter
|
28
30
|
|
29
31
|
To detach the process pass the ```-d``` option:
|
30
32
|
|
31
|
-
$ mail2frontmatter -d
|
33
|
+
$ bundle exec mail2frontmatter -d
|
32
34
|
|
33
35
|
```mail2frontmatter``` assumes a configuration file will be present at ```./data/mail2frontmatter.yml```
|
34
36
|
|
@@ -97,11 +99,19 @@ Instantiate ```Mail2FrontMatter::Watcher``` and pass it a configuration hash (or
|
|
97
99
|
watcher.run
|
98
100
|
```
|
99
101
|
|
100
|
-
###
|
102
|
+
### Plugins
|
103
|
+
|
104
|
+
If you've released a plugin of your own and would like to add it to this list, please send me a pull request.
|
105
|
+
|
106
|
+
[AutoTagSubject](https://github.com/whistlerbrk/m2fm-autotag-subject) - extracts tags from your subject line
|
101
107
|
|
102
|
-
|
108
|
+
[AutomaticEmbeds](https://github.com/whistlerbrk/m2fm-automatic-embeds) - automatically converts links into embeds (e.g. youtube, soundcloud, vimeo, gist)
|
109
|
+
|
110
|
+
[AutomaticClowncar](https://github.com/whistlerbrk/m2fm-automatic-clowncar) - makes your incoming image attachments automatic-clowncar compatible (requires Middleman)
|
111
|
+
|
112
|
+
### Extending It
|
103
113
|
|
104
|
-
|
114
|
+
Finally you can extend Mail2FrontMatter to further process incoming emails by subclassing ```Mail2FrontMatter::PreProcessor``` and registering it. The plugins above all implement the pattern shown.
|
105
115
|
|
106
116
|
```ruby
|
107
117
|
module Mail2FrontMatter
|
@@ -128,6 +138,7 @@ You should always always return metadata and body as shown since this will be pa
|
|
128
138
|
|
129
139
|
### TODO
|
130
140
|
|
131
|
-
* White list sanitization
|
141
|
+
* White list sanitization by default
|
142
|
+
* Full Jekyll support - PLEASE send pull requests, I want to support Jekyll as well, hence the general project name
|
132
143
|
* Mail2FrontMatter::Watcher handles both configuration for the whole shebang as well as Mailman. Should be split
|
133
144
|
* Some options intended to be configurable (media directory, etc) are not yet and essentially mean you can only run this from a middleman directory installation atm.
|
data/Rakefile
CHANGED
data/bin/mail2frontmatter
CHANGED
@@ -41,6 +41,11 @@ OptionParser.new do |opts|
|
|
41
41
|
puts opts
|
42
42
|
exit
|
43
43
|
end
|
44
|
+
|
45
|
+
opts.on_tail("-v", "--version", "Prints version") do
|
46
|
+
puts Mail2FrontMatter::VERSION
|
47
|
+
exit
|
48
|
+
end
|
44
49
|
end.parse!
|
45
50
|
|
46
51
|
# TRY TO KILL
|
@@ -67,6 +72,10 @@ if stop
|
|
67
72
|
rescue Errno::ESRCH
|
68
73
|
puts "stale pidfile... cleaning"
|
69
74
|
|
75
|
+
# also exit here! but don't move exit 0 to ensure block
|
76
|
+
# because "in the future" we may intelligently intercept pkill above
|
77
|
+
exit 0
|
78
|
+
|
70
79
|
# ALWAYS DELETE PID FILE
|
71
80
|
ensure
|
72
81
|
File.delete(options[:pid_file])
|
@@ -15,7 +15,8 @@ module Mail2FrontMatter
|
|
15
15
|
|
16
16
|
def initialize(message)
|
17
17
|
@message = message
|
18
|
-
raw_parsed_html = Nokogiri::HTML.parse(@message.html_part.
|
18
|
+
raw_parsed_html = Nokogiri::HTML.parse(@message.html_part.decoded.strip)
|
19
|
+
|
19
20
|
@body = raw_parsed_html.at("body")
|
20
21
|
|
21
22
|
# remove extraneous nesting
|
data/mail2frontmatter.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "activesupport"
|
24
24
|
|
25
25
|
spec.add_development_dependency "rspec"
|
26
|
-
spec.add_development_dependency "byebug"
|
26
|
+
spec.add_development_dependency "byebug" unless RUBY_VERSION =~ /1.9/
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.7"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
end
|
data/spec/parser_spec.rb
CHANGED
data/spec/preprocessor_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail2frontmatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kunal Shah
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mailman
|
@@ -118,6 +118,7 @@ extensions: []
|
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
120
|
- ".gitignore"
|
121
|
+
- ".travis.yml"
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE.txt
|
123
124
|
- README.md
|