rubysl-mail 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +0 -1
- data/.travis.yml +8 -0
- data/README.md +2 -2
- data/Rakefile +0 -1
- data/lib/mailread.rb +1 -0
- data/lib/rubysl/mail.rb +2 -0
- data/lib/rubysl/mail/mailread.rb +62 -0
- data/lib/{rubysl-mail → rubysl/mail}/version.rb +1 -1
- data/rubysl-mail.gemspec +19 -18
- metadata +79 -86
- data/lib/rubysl-mail.rb +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 54f28e718de6afd67bf347f6df20d1ba1a55b260
|
4
|
+
data.tar.gz: 708d862510e39f1371316412b3d4538c00f54974
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 65377acc3214b9d7831f32d5b01c00c566e9288e5bd619498c03c2d924697dc775179ea5064e791becb0b24991ff44a14fb5ee996e15806ad7dfde44b27bed1f
|
7
|
+
data.tar.gz: 463ed071c567dabd5d21c88913cd74b03a47117c6b96b58780607cd32068bce2c5c89d4410d66de3abf9dba5eaccbd5fc816ec46260834befe8bb2e6a05576d4
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Rubysl::Mail
|
2
2
|
|
3
3
|
TODO: Write a gem description
|
4
4
|
|
@@ -24,6 +24,6 @@ TODO: Write usage instructions here
|
|
24
24
|
|
25
25
|
1. Fork it
|
26
26
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am '
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
28
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
29
|
5. Create new Pull Request
|
data/Rakefile
CHANGED
data/lib/mailread.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "rubysl/mailread"
|
data/lib/rubysl/mail.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# The Mail class represents an internet mail message (as per RFC822, RFC2822)
|
2
|
+
# with headers and a body.
|
3
|
+
class Mail
|
4
|
+
|
5
|
+
# Create a new Mail where +f+ is either a stream which responds to gets(),
|
6
|
+
# or a path to a file. If +f+ is a path it will be opened.
|
7
|
+
#
|
8
|
+
# The whole message is read so it can be made available through the #header,
|
9
|
+
# #[] and #body methods.
|
10
|
+
#
|
11
|
+
# The "From " line is ignored if the mail is in mbox format.
|
12
|
+
def initialize(f)
|
13
|
+
unless defined? f.gets
|
14
|
+
f = open(f, "r")
|
15
|
+
opened = true
|
16
|
+
end
|
17
|
+
|
18
|
+
@header = {}
|
19
|
+
@body = []
|
20
|
+
begin
|
21
|
+
while line = f.gets()
|
22
|
+
line.chop!
|
23
|
+
next if /^From /=~line # skip From-line
|
24
|
+
break if /^$/=~line # end of header
|
25
|
+
|
26
|
+
if /^(\S+?):\s*(.*)/=~line
|
27
|
+
(attr = $1).capitalize!
|
28
|
+
@header[attr] = $2
|
29
|
+
elsif attr
|
30
|
+
line.sub!(/^\s*/, '')
|
31
|
+
@header[attr] += "\n" + line
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
return unless line
|
36
|
+
|
37
|
+
while line = f.gets()
|
38
|
+
break if /^From /=~line
|
39
|
+
@body.push(line)
|
40
|
+
end
|
41
|
+
ensure
|
42
|
+
f.close if opened
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Return the headers as a Hash.
|
47
|
+
def header
|
48
|
+
return @header
|
49
|
+
end
|
50
|
+
|
51
|
+
# Return the message body as an Array of lines
|
52
|
+
def body
|
53
|
+
return @body
|
54
|
+
end
|
55
|
+
|
56
|
+
# Return the header corresponding to +field+.
|
57
|
+
#
|
58
|
+
# Matching is case-insensitive.
|
59
|
+
def [](field)
|
60
|
+
@header[field.capitalize]
|
61
|
+
end
|
62
|
+
end
|
data/rubysl-mail.gemspec
CHANGED
@@ -1,22 +1,23 @@
|
|
1
|
-
#
|
2
|
-
require
|
1
|
+
# coding: utf-8
|
2
|
+
require './lib/rubysl/mail/version'
|
3
3
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "rubysl-mail"
|
6
|
+
spec.version = RubySL::Mail::VERSION
|
7
|
+
spec.authors = ["Brian Shirai"]
|
8
|
+
spec.email = ["brixen@gmail.com"]
|
9
|
+
spec.description = %q{Ruby standard library mail.}
|
10
|
+
spec.summary = %q{Ruby standard library mail.}
|
11
|
+
spec.homepage = "https://github.com/rubysl/rubysl-mail"
|
12
|
+
spec.license = "BSD"
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
gem.require_paths = ["lib"]
|
16
|
-
gem.version = RubySL::Mail::VERSION
|
14
|
+
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
spec.add_development_dependency "mspec", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rubysl-prettyprint", "~> 1.0"
|
22
23
|
end
|
metadata
CHANGED
@@ -1,118 +1,111 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-mail
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Brian Shirai
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
22
21
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
26
24
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
version: "1.0"
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
36
28
|
name: rake
|
37
|
-
|
38
|
-
|
39
|
-
none: false
|
40
|
-
requirements:
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
41
31
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 10
|
46
|
-
- 0
|
47
|
-
version: "10.0"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
48
34
|
type: :development
|
49
|
-
|
50
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
51
42
|
name: mspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
52
49
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubysl-prettyprint
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
56
59
|
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 1
|
61
|
-
- 5
|
62
|
-
version: "1.5"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
63
62
|
type: :development
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
description: Ruby standard library mail.
|
70
|
+
email:
|
67
71
|
- brixen@gmail.com
|
68
72
|
executables: []
|
69
|
-
|
70
73
|
extensions: []
|
71
|
-
|
72
74
|
extra_rdoc_files: []
|
73
|
-
|
74
|
-
files:
|
75
|
+
files:
|
75
76
|
- .gitignore
|
77
|
+
- .travis.yml
|
76
78
|
- Gemfile
|
77
79
|
- LICENSE
|
78
80
|
- README.md
|
79
81
|
- Rakefile
|
80
|
-
- lib/
|
81
|
-
- lib/rubysl
|
82
|
+
- lib/mailread.rb
|
83
|
+
- lib/rubysl/mail.rb
|
84
|
+
- lib/rubysl/mail/mailread.rb
|
85
|
+
- lib/rubysl/mail/version.rb
|
82
86
|
- rubysl-mail.gemspec
|
83
|
-
homepage:
|
84
|
-
licenses:
|
85
|
-
|
87
|
+
homepage: https://github.com/rubysl/rubysl-mail
|
88
|
+
licenses:
|
89
|
+
- BSD
|
90
|
+
metadata: {}
|
86
91
|
post_install_message:
|
87
92
|
rdoc_options: []
|
88
|
-
|
89
|
-
require_paths:
|
93
|
+
require_paths:
|
90
94
|
- lib
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
none: false
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
hash: 2002549777813010636
|
106
|
-
segments:
|
107
|
-
- 0
|
108
|
-
version: "0"
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
109
105
|
requirements: []
|
110
|
-
|
111
106
|
rubyforge_project:
|
112
|
-
rubygems_version:
|
107
|
+
rubygems_version: 2.0.7
|
113
108
|
signing_key:
|
114
|
-
specification_version:
|
115
|
-
summary: Ruby
|
109
|
+
specification_version: 4
|
110
|
+
summary: Ruby standard library mail.
|
116
111
|
test_files: []
|
117
|
-
|
118
|
-
has_rdoc:
|