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.
@@ -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
@@ -15,4 +15,3 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- .rbx
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem update --system
4
+ - gem --version
5
+ - gem install rubysl-bundler
6
+ script: bundle exec mspec spec
7
+ rvm:
8
+ - rbx-nightly-18mode
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RubySL::Mail
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 'Added some feature'`)
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
@@ -1,2 +1 @@
1
- #!/usr/bin/env rake
2
1
  require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ require "rubysl/mailread"
@@ -0,0 +1,2 @@
1
+ require "rubysl/mail/mailread"
2
+ require "rubysl/mail/version"
@@ -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
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Mail
3
- VERSION = "0.0.1"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -1,22 +1,23 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/rubysl-mail/version', __FILE__)
1
+ # coding: utf-8
2
+ require './lib/rubysl/mail/version'
3
3
 
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Brian Shirai"]
6
- gem.email = ["brixen@gmail.com"]
7
- gem.description = %q{Ruby Standard Library - mail}
8
- gem.summary = %q{Ruby Standard Library - mail}
9
- gem.homepage = ""
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
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "rubysl-mail"
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
- gem.add_runtime_dependency "redcard", "~> 1.0"
19
-
20
- gem.add_development_dependency "rake", "~> 10.0"
21
- gem.add_development_dependency "mspec", "~> 1.5"
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
- hash: 856480538658449761
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
- date: 2013-04-15 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: redcard
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
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
26
24
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 4428665182548103036
29
- segments:
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
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
41
31
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 1510892033553700768
44
- segments:
45
- - 10
46
- - 0
47
- version: "10.0"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
48
34
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
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
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
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
- hash: 1660815245844205030
59
- segments:
60
- - 1
61
- - 5
62
- version: "1.5"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
63
62
  type: :development
64
- version_requirements: *id003
65
- description: Ruby Standard Library - mail
66
- email:
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/rubysl-mail.rb
81
- - lib/rubysl-mail/version.rb
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
- none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 2002549777813010636
97
- segments:
98
- - 0
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
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: 1.8.25
107
+ rubygems_version: 2.0.7
113
108
  signing_key:
114
- specification_version: 3
115
- summary: Ruby Standard Library - mail
109
+ specification_version: 4
110
+ summary: Ruby standard library mail.
116
111
  test_files: []
117
-
118
- has_rdoc:
@@ -1,7 +0,0 @@
1
- require "rubysl-mail/version"
2
-
3
- module RubySL
4
- module Mail
5
- # Your code goes here...
6
- end
7
- end