typedown2blog 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +52 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/bin/blog +27 -0
- data/bin/control_typedown2blog_batcher.rb +6 -0
- data/bin/typedown2blog_batcher +40 -0
- data/lib/typedown2blog.rb +5 -0
- data/lib/typedown2blog/blog.rb +41 -0
- data/lib/typedown2blog/parse_mail.rb +74 -0
- data/lib/typedown2blog/spec.rb +35 -0
- data/test/data/mail_0001.eml +48 -0
- data/test/data/mail_0002.eml +1255 -0
- data/test/data/mail_0002.jpg +0 -0
- data/test/data/mail_0003.eml +47 -0
- data/test/helper.rb +10 -0
- data/test/test_typedown2blog.rb +47 -0
- metadata +134 -0
Binary file
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Return-Path: <rune@epubify.com>
|
2
|
+
X-Original-To: posterous@boox.epubify.com
|
3
|
+
Delivered-To: posterous@boox.epubify.com
|
4
|
+
Received: from mail-yw0-f51.google.com (mail-yw0-f51.google.com [209.85.213.51])
|
5
|
+
by boox (Postfix) with ESMTP id 05EE1A8C0D
|
6
|
+
for <posterous@boox.epubify.com>; Mon, 16 Aug 2010 13:35:01 +0000 (UTC)
|
7
|
+
Received: by ywj3 with SMTP id 3so2059161ywj.38
|
8
|
+
for <posterous@boox.epubify.com>; Mon, 16 Aug 2010 06:34:40 -0700 (PDT)
|
9
|
+
MIME-Version: 1.0
|
10
|
+
Received: by 10.150.181.18 with SMTP id d18mr5417508ybf.270.1281965680068;
|
11
|
+
Mon, 16 Aug 2010 06:34:40 -0700 (PDT)
|
12
|
+
Received: by 10.151.101.2 with HTTP; Mon, 16 Aug 2010 06:34:40 -0700 (PDT)
|
13
|
+
X-Originating-IP: [193.91.161.15]
|
14
|
+
Date: Mon, 16 Aug 2010 15:34:40 +0200
|
15
|
+
Message-ID: <AANLkTim_Lvnz-Yvns6BCpW7cEYbqfV-0oqGwFFozVe0e@mail.gmail.com>
|
16
|
+
Subject: En test
|
17
|
+
From: Rune Myrland <rune@epubify.com>
|
18
|
+
To: posterous@boox.epubify.com
|
19
|
+
Content-Type: multipart/alternative; boundary=000e0cd6ad96f98da7048df0e434
|
20
|
+
|
21
|
+
--000e0cd6ad96f98da7048df0e434
|
22
|
+
Content-Type: text/plain; charset=ISO-8859-1
|
23
|
+
Content-Transfer-Encoding: quoted-printable
|
24
|
+
|
25
|
+
! Jeg skriver typedown
|
26
|
+
|
27
|
+
Med br=F8dtekst
|
28
|
+
|
29
|
+
+ Bulletlist
|
30
|
+
+ Mer
|
31
|
+
+ Enda mer
|
32
|
+
|
33
|
+
//* Et avsnitt som er uthevet. Skal vi kalle de en ingress?
|
34
|
+
|
35
|
+
/* Og ett som er skr=E5stilt
|
36
|
+
|
37
|
+
!! En undertittel
|
38
|
+
|
39
|
+
--000e0cd6ad96f98da7048df0e434
|
40
|
+
Content-Type: text/html; charset=ISO-8859-1
|
41
|
+
Content-Transfer-Encoding: quoted-printable
|
42
|
+
|
43
|
+
! Jeg skriver typedown<br><br>Med br=F8dtekst<br><br>+ Bulletlist<br>+ Mer<=
|
44
|
+
br>+ Enda mer<br><br>//* Et avsnitt som er uthevet. Skal vi kalle de en ing=
|
45
|
+
ress?<br><br>/* Og ett som er skr=E5stilt<br><br>!! En undertittel<br>
|
46
|
+
|
47
|
+
--000e0cd6ad96f98da7048df0e434--
|
data/test/helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'typedown2blog'
|
3
|
+
|
4
|
+
include Typedown2Blog
|
5
|
+
|
6
|
+
class TestTypedown2Blog < Test::Unit::TestCase
|
7
|
+
context "Parser" do
|
8
|
+
should "parse test mails without raising exceptions" do
|
9
|
+
assert_nothing_raised do
|
10
|
+
Dir.glob("./test/data/mail_*.eml") do |filename|
|
11
|
+
parse_mail "./test/data/mail_0001.eml"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "Attached image" do
|
18
|
+
setup do
|
19
|
+
@mail = parse_mail "./test/data/mail_0002.eml"
|
20
|
+
end
|
21
|
+
|
22
|
+
teardown do
|
23
|
+
end
|
24
|
+
|
25
|
+
should "be same as original image" do
|
26
|
+
file = File.new("./test/data/mail_0002.jpg", "rb")
|
27
|
+
original_image = file.read()
|
28
|
+
file.close()
|
29
|
+
|
30
|
+
attached_image = @mail.parts[1].body.decoded
|
31
|
+
|
32
|
+
assert(original_image == attached_image)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "Blog" do
|
37
|
+
should "parse mail_0002 without raising exceptions" do
|
38
|
+
assert_nothing_raised do
|
39
|
+
Blog.setup do
|
40
|
+
email "rune@epubify.com"
|
41
|
+
end
|
42
|
+
#Blog.post "./test/data/mail_0002.eml"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: typedown2blog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 0.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Rune Myrland
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-16 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: thoughtbot-shoulda
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: attachments
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 17
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
- 7
|
48
|
+
version: 0.0.7
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: typedown
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 25
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 0
|
63
|
+
- 3
|
64
|
+
version: 0.0.3
|
65
|
+
type: :runtime
|
66
|
+
version_requirements: *id003
|
67
|
+
description: The script will forward to the blog via a Mail2Blog interface.
|
68
|
+
email: rune@epubify.com
|
69
|
+
executables:
|
70
|
+
- typedown2blog_batcher
|
71
|
+
- control_typedown2blog_batcher.rb
|
72
|
+
- blog
|
73
|
+
extensions: []
|
74
|
+
|
75
|
+
extra_rdoc_files:
|
76
|
+
- LICENSE
|
77
|
+
- README.rdoc
|
78
|
+
files:
|
79
|
+
- .document
|
80
|
+
- .gitignore
|
81
|
+
- LICENSE
|
82
|
+
- README.rdoc
|
83
|
+
- Rakefile
|
84
|
+
- VERSION
|
85
|
+
- bin/blog
|
86
|
+
- bin/control_typedown2blog_batcher.rb
|
87
|
+
- bin/typedown2blog_batcher
|
88
|
+
- lib/typedown2blog.rb
|
89
|
+
- lib/typedown2blog/blog.rb
|
90
|
+
- lib/typedown2blog/parse_mail.rb
|
91
|
+
- lib/typedown2blog/spec.rb
|
92
|
+
- test/data/mail_0001.eml
|
93
|
+
- test/data/mail_0002.eml
|
94
|
+
- test/data/mail_0002.jpg
|
95
|
+
- test/data/mail_0003.eml
|
96
|
+
- test/helper.rb
|
97
|
+
- test/test_typedown2blog.rb
|
98
|
+
has_rdoc: true
|
99
|
+
homepage: http://github.com/wrimle/typedown2blog
|
100
|
+
licenses: []
|
101
|
+
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options:
|
104
|
+
- --charset=UTF-8
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
requirements: []
|
126
|
+
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.3.7
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: Email gateway for reformatting typedown documents before forwarding to blog
|
132
|
+
test_files:
|
133
|
+
- test/test_typedown2blog.rb
|
134
|
+
- test/helper.rb
|