pony 1.8 → 1.9
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/README.rdoc +8 -0
- data/lib/pony.rb +38 -15
- data/pony.gemspec +1 -1
- data/spec/pony_spec.rb +8 -4
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e71b53cc0803fe9e1f8648ae097a633aeb0b371
|
4
|
+
data.tar.gz: 43f71c33f354a576a53c420fe857084c5aeea1ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289cc47015308df12027fe7df67297002a2e888a0dbfc00b9b6300e6dfb9ac25094f96184bec2f411233061f8ec327a1074f8eb21796dcacf7b9ef757a6dce50
|
7
|
+
data.tar.gz: df00f49c87634ed310c1a5d36e36d3c537c2030d5258c8b54c1e31c04f359effa663fbd9fe9f888a120a6af3cbe1f0e86cb600d2ca82a81f9ea104c6c465e214
|
data/README.rdoc
CHANGED
@@ -97,7 +97,12 @@ Also you can add additional options for html part of latter, e.g.:
|
|
97
97
|
|
98
98
|
== List Of Options
|
99
99
|
|
100
|
+
You can get a list of options from Pony directly:
|
101
|
+
|
102
|
+
Pony.permissable_options
|
103
|
+
|
100
104
|
Options passed pretty much directly to Mail
|
105
|
+
|
101
106
|
to
|
102
107
|
cc
|
103
108
|
bcc
|
@@ -168,6 +173,9 @@ mailing list: ponyrb@googlegroups.com
|
|
168
173
|
|
169
174
|
|
170
175
|
== Releases
|
176
|
+
1.9
|
177
|
+
* Allow options to be queried from the gem
|
178
|
+
|
171
179
|
1.8
|
172
180
|
* Add additional options for headers in each part of letter
|
173
181
|
|
data/lib/pony.rb
CHANGED
@@ -106,6 +106,8 @@ module Pony
|
|
106
106
|
|
107
107
|
@@options = {}
|
108
108
|
|
109
|
+
|
110
|
+
|
109
111
|
# Default options can be set so that they don't have to be repeated.
|
110
112
|
#
|
111
113
|
# Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
|
@@ -137,6 +139,10 @@ module Pony
|
|
137
139
|
deliver build_mail(options)
|
138
140
|
end
|
139
141
|
|
142
|
+
def self.permissable_options
|
143
|
+
standard_options + non_standard_options
|
144
|
+
end
|
145
|
+
|
140
146
|
private
|
141
147
|
|
142
148
|
def self.deliver(mail)
|
@@ -147,28 +153,45 @@ module Pony
|
|
147
153
|
File.executable?(sendmail_binary) ? :sendmail : :smtp
|
148
154
|
end
|
149
155
|
|
156
|
+
def self.standard_options
|
157
|
+
[
|
158
|
+
:to,
|
159
|
+
:cc,
|
160
|
+
:bcc,
|
161
|
+
:from,
|
162
|
+
:subject,
|
163
|
+
:content_type,
|
164
|
+
:message_id,
|
165
|
+
:sender,
|
166
|
+
:reply_to,
|
167
|
+
:smtp_envelope_to
|
168
|
+
]
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.non_standard_options
|
172
|
+
[
|
173
|
+
:attachments,
|
174
|
+
:body,
|
175
|
+
:charset,
|
176
|
+
:enable_starttls_auto,
|
177
|
+
:headers,
|
178
|
+
:html_body,
|
179
|
+
:text_part_charset,
|
180
|
+
:via,
|
181
|
+
:via_options,
|
182
|
+
:body_part_header,
|
183
|
+
:html_body_part_header
|
184
|
+
]
|
185
|
+
end
|
186
|
+
|
150
187
|
def self.build_mail(options)
|
151
188
|
mail = Mail.new do |m|
|
152
189
|
options[:date] ||= Time.now
|
153
190
|
options[:from] ||= 'pony@unknown'
|
154
191
|
options[:via_options] ||= {}
|
155
192
|
|
156
|
-
non_standard_options = [
|
157
|
-
:attachments,
|
158
|
-
:body,
|
159
|
-
:charset,
|
160
|
-
:enable_starttls_auto,
|
161
|
-
:headers,
|
162
|
-
:html_body,
|
163
|
-
:text_part_charset,
|
164
|
-
:via,
|
165
|
-
:via_options,
|
166
|
-
:body_part_header,
|
167
|
-
:html_body_part_header
|
168
|
-
]
|
169
|
-
|
170
193
|
options.each do |k, v|
|
171
|
-
next if non_standard_options.include?(k)
|
194
|
+
next if Pony.non_standard_options.include?(k)
|
172
195
|
m.send(k, v)
|
173
196
|
end
|
174
197
|
|
data/pony.gemspec
CHANGED
data/spec/pony_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/base'
|
|
4
4
|
describe Pony do
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
Pony.
|
7
|
+
allow(Pony).to receive(:deliver)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "sends mail" do
|
@@ -25,6 +25,10 @@ describe Pony do
|
|
25
25
|
expect{ Pony.mail(:to => 'joe@example.com') }.to_not raise_error
|
26
26
|
end
|
27
27
|
|
28
|
+
it 'can list its available options' do
|
29
|
+
expect( Pony.permissable_options ).to include(:to, :body)
|
30
|
+
end
|
31
|
+
|
28
32
|
describe "builds a Mail object with field:" do
|
29
33
|
it "to" do
|
30
34
|
expect(Pony.build_mail(:to => 'joe@example.com').to).to eq [ 'joe@example.com' ]
|
@@ -159,13 +163,13 @@ describe Pony do
|
|
159
163
|
|
160
164
|
describe "transport" do
|
161
165
|
it "transports via smtp if no sendmail binary" do
|
162
|
-
Pony.
|
166
|
+
allow(Pony).to receive(:sendmail_binary).and_return('/does/not/exist')
|
163
167
|
expect(Pony).to receive(:build_mail).with(hash_including(:via => :smtp))
|
164
168
|
Pony.mail(:to => 'foo@bar')
|
165
169
|
end
|
166
170
|
|
167
171
|
it "defaults to sendmail if no via is specified and sendmail exists" do
|
168
|
-
File.
|
172
|
+
allow(File).to receive(:executable?).and_return(true)
|
169
173
|
expect(Pony).to receive(:build_mail).with(hash_including(:via => :sendmail))
|
170
174
|
Pony.mail(:to => 'foo@bar')
|
171
175
|
end
|
@@ -199,7 +203,7 @@ describe Pony do
|
|
199
203
|
|
200
204
|
describe "sendmail binary location" do
|
201
205
|
it "should default to /usr/sbin/sendmail if not in path" do
|
202
|
-
Pony.
|
206
|
+
allow(Pony).to receive(:'`').and_return('')
|
203
207
|
expect(Pony.sendmail_binary).to eq '/usr/sbin/sendmail'
|
204
208
|
end
|
205
209
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wiggins
|
@@ -9,34 +9,34 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mail
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '2.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.14'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.14'
|
42
42
|
description: 'Send email in one command: Pony.mail(:to => ''someone@example.com'',
|
@@ -48,8 +48,8 @@ extra_rdoc_files: []
|
|
48
48
|
files:
|
49
49
|
- README.rdoc
|
50
50
|
- Rakefile
|
51
|
-
- pony.gemspec
|
52
51
|
- lib/pony.rb
|
52
|
+
- pony.gemspec
|
53
53
|
- spec/base.rb
|
54
54
|
- spec/pony_spec.rb
|
55
55
|
homepage: http://github.com/benprew/pony
|
@@ -58,23 +58,23 @@ licenses:
|
|
58
58
|
metadata: {}
|
59
59
|
post_install_message:
|
60
60
|
rdoc_options:
|
61
|
-
- --inline-source
|
62
|
-
- --charset=UTF-8
|
61
|
+
- "--inline-source"
|
62
|
+
- "--charset=UTF-8"
|
63
63
|
require_paths:
|
64
64
|
- lib
|
65
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.2.2
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: 'Send email in one command: Pony.mail(:to => ''someone@example.com'', :body
|