mail-gpg 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.6 2014-05-30
2
+
3
+ * preserve names in mail headers (i.e. Jane Doe <user@host.com>)
4
+
1
5
  == 0.1.5 2014-05-28
2
6
 
3
7
  * signing refactoring so the signed part only contains the necessary headers
data/lib/mail/gpg.rb CHANGED
@@ -95,8 +95,8 @@ module Mail
95
95
  false
96
96
  end
97
97
 
98
- STANDARD_HEADERS = %w(from to cc bcc subject reply_to in_reply_to return_path message_id)
99
- CUSTOM_HEADERS = %w(Auto-Submitted)
98
+ STANDARD_HEADERS = %w(from to cc bcc reply_to subject in_reply_to return_path message_id)
99
+ MORE_HEADERS = %w(Auto-Submitted)
100
100
 
101
101
  private
102
102
 
@@ -104,10 +104,12 @@ module Mail
104
104
  Mail.new do
105
105
  self.perform_deliveries = cleartext_mail.perform_deliveries
106
106
  STANDARD_HEADERS.each do |field|
107
- send field, cleartext_mail.send(field)
107
+ if h = cleartext_mail.header[field]
108
+ self.header[field] = h.value
109
+ end
108
110
  end
109
111
  cleartext_mail.header.fields.each do |field|
110
- if CUSTOM_HEADERS.include?(field.name) or field.name =~ /^X-/
112
+ if MORE_HEADERS.include?(field.name) or field.name =~ /^X-/
111
113
  header[field.name] = field.value
112
114
  end
113
115
  end
@@ -1,5 +1,5 @@
1
1
  module Mail
2
2
  module Gpg
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
data/mail-gpg.gemspec CHANGED
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "mail", "~> 2.5.3"
22
- spec.add_dependency "gpgme", "~> 2.0.2"
21
+ spec.add_dependency "mail", "~> 2.5", ">= 2.5.3"
22
+ spec.add_dependency "gpgme", "~> 2.0", ">= 2.0.2"
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "minitest", "~> 4.0"
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "actionmailer", ">= 3.2.0"
27
27
  spec.add_development_dependency "pry-nav"
28
- spec.add_development_dependency "shoulda-context"
28
+ spec.add_development_dependency "shoulda-context", '~> 1.1'
29
29
  end
data/test/gpg_test.rb CHANGED
@@ -52,8 +52,13 @@ class GpgTest < Test::Unit::TestCase
52
52
 
53
53
  def check_headers_signed(mail = @mail, signed = @signed)
54
54
  assert_equal mail.to, signed.to
55
- assert_equal mail.cc, signed.cc
56
- assert_equal mail.bcc, signed.bcc
55
+ if mail.cc
56
+ assert_equal mail.cc, signed.cc
57
+ end
58
+ if mail.bcc
59
+ assert_equal mail.bcc, signed.bcc
60
+ end
61
+
57
62
  assert_equal mail.subject, signed.subject
58
63
  assert_equal mail.return_path, signed.return_path
59
64
  end
@@ -76,7 +81,7 @@ class GpgTest < Test::Unit::TestCase
76
81
  setup do
77
82
  @mail = Mail.new do
78
83
  to 'joe@foo.bar'
79
- from 'jane@foo.bar'
84
+ from '<Jane Doe> jane@foo.bar'
80
85
  subject 'test test'
81
86
  body 'sign me!'
82
87
  content_type 'text/plain; charset=UTF-8'
@@ -88,6 +93,10 @@ class GpgTest < Test::Unit::TestCase
88
93
  @signed = Mail::Gpg.sign(@mail, password: 'abc')
89
94
  end
90
95
 
96
+ should 'preserve from name' do
97
+ assert_equal '<Jane Doe> jane@foo.bar', @signed.header['from'].value
98
+ end
99
+
91
100
  should 'have same recipients and subject' do
92
101
  check_headers_signed
93
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail-gpg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-28 00:00:00.000000000 Z
12
+ date: 2014-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail
@@ -17,6 +17,9 @@ dependencies:
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.5'
22
+ - - ! '>='
20
23
  - !ruby/object:Gem::Version
21
24
  version: 2.5.3
22
25
  type: :runtime
@@ -25,6 +28,9 @@ dependencies:
25
28
  none: false
26
29
  requirements:
27
30
  - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '2.5'
33
+ - - ! '>='
28
34
  - !ruby/object:Gem::Version
29
35
  version: 2.5.3
30
36
  - !ruby/object:Gem::Dependency
@@ -33,6 +39,9 @@ dependencies:
33
39
  none: false
34
40
  requirements:
35
41
  - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.0'
44
+ - - ! '>='
36
45
  - !ruby/object:Gem::Version
37
46
  version: 2.0.2
38
47
  type: :runtime
@@ -41,6 +50,9 @@ dependencies:
41
50
  none: false
42
51
  requirements:
43
52
  - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - - ! '>='
44
56
  - !ruby/object:Gem::Version
45
57
  version: 2.0.2
46
58
  - !ruby/object:Gem::Dependency
@@ -128,17 +140,17 @@ dependencies:
128
140
  requirement: !ruby/object:Gem::Requirement
129
141
  none: false
130
142
  requirements:
131
- - - ! '>='
143
+ - - ~>
132
144
  - !ruby/object:Gem::Version
133
- version: '0'
145
+ version: '1.1'
134
146
  type: :development
135
147
  prerelease: false
136
148
  version_requirements: !ruby/object:Gem::Requirement
137
149
  none: false
138
150
  requirements:
139
- - - ! '>='
151
+ - - ~>
140
152
  - !ruby/object:Gem::Version
141
- version: '0'
153
+ version: '1.1'
142
154
  description: ! 'GPG/MIME encryption plugin for the Ruby Mail Library
143
155
 
144
156
  This tiny gem adds GPG capabilities to Mail::Message and ActionMailer::Base. Because