manveru-mailit 2009.06.08 → 2009.08
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.
- data/AUTHORS +6 -0
- data/CHANGELOG +76 -0
- data/MANIFEST +28 -0
- data/Rakefile +84 -0
- data/lib/mailit.rb +0 -1
- data/lib/mailit/mail.rb +2 -2
- data/lib/mailit/mailer.rb +55 -53
- data/lib/mailit/version.rb +3 -0
- data/lib/version.rb +3 -0
- data/mailit.gemspec +23 -21
- data/tasks/authors.rake +33 -0
- data/tasks/bacon.rake +70 -0
- data/tasks/changelog.rake +18 -0
- data/tasks/copyright.rake +38 -0
- data/tasks/gem.rake +23 -0
- data/tasks/gem_installer.rake +76 -0
- data/tasks/install_dependencies.rake +6 -0
- data/tasks/manifest.rake +4 -0
- data/tasks/rcov.rake +23 -0
- data/tasks/release.rake +52 -0
- data/tasks/reversion.rake +8 -0
- data/tasks/setup.rake +15 -0
- data/tasks/yard.rake +4 -0
- metadata +27 -8
data/AUTHORS
ADDED
data/CHANGELOG
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[78c844d | 2009-08-25 21:40:40 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
2
|
+
|
|
3
|
+
* Another fix
|
|
4
|
+
|
|
5
|
+
[fb25c19 | 2009-08-25 21:40:01 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
6
|
+
|
|
7
|
+
* Version 2009.08
|
|
8
|
+
|
|
9
|
+
[2e6d77a | 2009-08-25 21:38:53 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
10
|
+
|
|
11
|
+
* Fix Rakefile
|
|
12
|
+
|
|
13
|
+
[585554d | 2009-08-25 05:11:42 UTC] Kevin Berry <kevin@opensourcealchemist.com>
|
|
14
|
+
|
|
15
|
+
* Take in Pistos's patch, make my own patch to get running for current project, and add seedling structure.
|
|
16
|
+
|
|
17
|
+
[db73002 | 2009-08-06 06:50:35 UTC] Jake Douglas <jakecdouglas@gmail.com>
|
|
18
|
+
|
|
19
|
+
* NetSMTP and EventMachine version both actually send mail now. Previous configuration didn't override the #send method correctly so the EM methods weren't loaded. The EM module may only be included now, not used with extend.
|
|
20
|
+
|
|
21
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
|
22
|
+
|
|
23
|
+
[9a36e2f | 2009-08-06 05:39:26 UTC] Jake Douglas <jakecdouglas@gmail.com>
|
|
24
|
+
|
|
25
|
+
* get the value of :noop from the options hash in NetSmtp#send
|
|
26
|
+
|
|
27
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
|
28
|
+
|
|
29
|
+
[c6da60b | 2009-06-08 13:52:33 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
30
|
+
|
|
31
|
+
* Release new version
|
|
32
|
+
|
|
33
|
+
[185cf45 | 2009-06-08 13:51:07 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
34
|
+
|
|
35
|
+
* Fix long outstanding issues
|
|
36
|
+
|
|
37
|
+
[e429f3b | 2009-04-12 13:38:16 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
38
|
+
|
|
39
|
+
* Major refactor of Mailer, add support for EventMachine::SmtpClient and remove render_send
|
|
40
|
+
|
|
41
|
+
[341d76a | 2009-04-12 13:23:33 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
42
|
+
|
|
43
|
+
* Make Mail#header_string and Mail#body_string public
|
|
44
|
+
|
|
45
|
+
[5716124 | 2009-03-15 14:26:27 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
46
|
+
|
|
47
|
+
* Add auth_type and username options for Mailer#send, should work on windows now
|
|
48
|
+
|
|
49
|
+
[ff38041 | 2009-03-10 21:02:58 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
50
|
+
|
|
51
|
+
* Add gemspec
|
|
52
|
+
|
|
53
|
+
[07b92d0 | 2009-03-10 20:49:36 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
54
|
+
|
|
55
|
+
* Add Mailit::Mime - detects and uses available mime providers
|
|
56
|
+
|
|
57
|
+
[584398c | 2009-03-10 20:48:49 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
58
|
+
|
|
59
|
+
* Little improvment to style
|
|
60
|
+
|
|
61
|
+
[194c990 | 2009-03-10 20:19:08 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
62
|
+
|
|
63
|
+
* Add warning if no mime-type detection is possible
|
|
64
|
+
|
|
65
|
+
[184b20d | 2009-03-10 20:18:54 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
66
|
+
|
|
67
|
+
* Add Version
|
|
68
|
+
|
|
69
|
+
[74e9ca3 | 2009-03-10 20:18:35 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
70
|
+
|
|
71
|
+
* Add readme
|
|
72
|
+
|
|
73
|
+
[0a4bcad | 2009-03-10 20:02:28 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
74
|
+
|
|
75
|
+
* Initial commit
|
|
76
|
+
|
data/MANIFEST
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
AUTHORS
|
|
2
|
+
CHANGELOG
|
|
3
|
+
MANIFEST
|
|
4
|
+
README.md
|
|
5
|
+
Rakefile
|
|
6
|
+
lib/mailit.rb
|
|
7
|
+
lib/mailit/mail.rb
|
|
8
|
+
lib/mailit/mailer.rb
|
|
9
|
+
lib/mailit/mime.rb
|
|
10
|
+
lib/mailit/version.rb
|
|
11
|
+
lib/version.rb
|
|
12
|
+
mailit.gemspec
|
|
13
|
+
spec/helper.rb
|
|
14
|
+
spec/mailit/mail.rb
|
|
15
|
+
spec/mailit/mailer.rb
|
|
16
|
+
tasks/authors.rake
|
|
17
|
+
tasks/bacon.rake
|
|
18
|
+
tasks/changelog.rake
|
|
19
|
+
tasks/copyright.rake
|
|
20
|
+
tasks/gem.rake
|
|
21
|
+
tasks/gem_installer.rake
|
|
22
|
+
tasks/install_dependencies.rake
|
|
23
|
+
tasks/manifest.rake
|
|
24
|
+
tasks/rcov.rake
|
|
25
|
+
tasks/release.rake
|
|
26
|
+
tasks/reversion.rake
|
|
27
|
+
tasks/setup.rake
|
|
28
|
+
tasks/yard.rake
|
data/Rakefile
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
begin; require 'rubygems'; rescue LoadError; end
|
|
2
|
+
|
|
3
|
+
require 'rake'
|
|
4
|
+
require 'rake/clean'
|
|
5
|
+
require 'rake/gempackagetask'
|
|
6
|
+
require 'time'
|
|
7
|
+
require 'date'
|
|
8
|
+
require './lib/mailit'
|
|
9
|
+
|
|
10
|
+
PROJECT_SPECS = FileList[
|
|
11
|
+
'spec/*/**/*.rb'
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
PROJECT_MODULE = 'Mailit'
|
|
15
|
+
PROJECT_README = 'README'
|
|
16
|
+
#PROJECT_RUBYFORGE_GROUP_ID = 3034
|
|
17
|
+
PROJECT_COPYRIGHT_SUMMARY = [
|
|
18
|
+
"# Copyright (c) 2008-#{Time.now.year} The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>",
|
|
19
|
+
"# Distributed under the terms of the MIT license.",
|
|
20
|
+
"# See the LICENSE file which accompanies this software for the full text",
|
|
21
|
+
"#"
|
|
22
|
+
]
|
|
23
|
+
PROJECT_COPYRIGHT = PROJECT_COPYRIGHT_SUMMARY + [
|
|
24
|
+
"# Permission is hereby granted, free of charge, to any person obtaining a copy",
|
|
25
|
+
'# of this software and associated documentation files (the "Software"), to deal',
|
|
26
|
+
"# in the Software without restriction, including without limitation the rights",
|
|
27
|
+
"# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
|
|
28
|
+
"# copies of the Software, and to permit persons to whom the Software is",
|
|
29
|
+
"# furnished to do so, subject to the following conditions:",
|
|
30
|
+
"#",
|
|
31
|
+
"# The above copyright notice and this permission notice shall be included in",
|
|
32
|
+
"# all copies or substantial portions of the Software.",
|
|
33
|
+
"#",
|
|
34
|
+
'# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR',
|
|
35
|
+
"# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
|
|
36
|
+
"# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
|
|
37
|
+
"# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
|
|
38
|
+
"# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
|
|
39
|
+
"# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN",
|
|
40
|
+
"# THE SOFTWARE."
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
PROJECT_VERSION =
|
|
44
|
+
if version = ENV['PROJECT_VERSION'] || ENV['VERSION']
|
|
45
|
+
version
|
|
46
|
+
else
|
|
47
|
+
::VERSION rescue Date.today.strftime("%Y.%m.%d")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# To release the monthly version do:
|
|
51
|
+
# $ PROJECT_VERSION=2009.03 rake release
|
|
52
|
+
|
|
53
|
+
PROJECT_FILES = FileList[`git ls-files`.split("\n")].exclude('.gitignore')
|
|
54
|
+
|
|
55
|
+
GEMSPEC = Gem::Specification.new{|s|
|
|
56
|
+
s.name = "mailit"
|
|
57
|
+
s.author = "Kevin Berry"
|
|
58
|
+
s.summary = "The Mailit library, by Kevin Berry"
|
|
59
|
+
s.description = "The Mailit library, by Kevin Berry"
|
|
60
|
+
s.email = "kevinberry@nrs.us"
|
|
61
|
+
s.homepage = "http://github.com/manveru/mailit"
|
|
62
|
+
s.platform = Gem::Platform::RUBY
|
|
63
|
+
s.version = PROJECT_VERSION
|
|
64
|
+
s.files = PROJECT_FILES
|
|
65
|
+
s.has_rdoc = true
|
|
66
|
+
s.require_path = "lib"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Dir.glob('tasks/*.rake'){|f| import(f) }
|
|
70
|
+
|
|
71
|
+
task :default => [:bacon]
|
|
72
|
+
|
|
73
|
+
CLEAN.include %w[
|
|
74
|
+
**/.*.sw?
|
|
75
|
+
*.gem
|
|
76
|
+
.config
|
|
77
|
+
**/*~
|
|
78
|
+
**/{data.db,cache.yaml}
|
|
79
|
+
*.yaml
|
|
80
|
+
pkg
|
|
81
|
+
rdoc
|
|
82
|
+
ydoc
|
|
83
|
+
*coverage*
|
|
84
|
+
]
|
data/lib/mailit.rb
CHANGED
data/lib/mailit/mail.rb
CHANGED
|
@@ -139,7 +139,7 @@ BODY
|
|
|
139
139
|
:mimetype => (mimetype || mime_type_for(filename)),
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
add_attachment_common(container,
|
|
142
|
+
add_attachment_common(container, filename, headers)
|
|
143
143
|
end
|
|
144
144
|
alias attach add_attachment
|
|
145
145
|
|
|
@@ -212,7 +212,7 @@ BODY
|
|
|
212
212
|
alias [] get_header
|
|
213
213
|
|
|
214
214
|
def header_string
|
|
215
|
-
headers.join("\r\n") << "\r\n\r\n"
|
|
215
|
+
headers.map{|key,value| "#{key}: #{value}"}.join("\r\n") << "\r\n\r\n"
|
|
216
216
|
end
|
|
217
217
|
|
|
218
218
|
MIME_INDICATOR = "This is a multi-part message in MIME format.\r\n\r\n--%s\r\nContent-Type: multipart/alternative; boundary=%p"
|
data/lib/mailit/mailer.rb
CHANGED
|
@@ -2,7 +2,7 @@ module Mailit
|
|
|
2
2
|
# The Mailer is an abstraction layer for different SMTP clients, it provides
|
|
3
3
|
# #send and #defer_send methods
|
|
4
4
|
#
|
|
5
|
-
# At the time of writing, Net::SMTP and EventMachine::SmtpClient are
|
|
5
|
+
# At the time of writing, Net::SMTP and EventMachine::Protocols::SmtpClient are
|
|
6
6
|
# supported, it should be trivial to add support for any other client.
|
|
7
7
|
#
|
|
8
8
|
# The difference between #send and #defer_send depends on the backend, but
|
|
@@ -24,7 +24,7 @@ module Mailit
|
|
|
24
24
|
# # Send in background thread and continue doing other things
|
|
25
25
|
# Mailit::Mailer.defer_send(mail)
|
|
26
26
|
#
|
|
27
|
-
# The default Mailer backend is
|
|
27
|
+
# The default Mailer backend is Net::SMTP, you can change the
|
|
28
28
|
# default by including another module into Mailit::mailer
|
|
29
29
|
#
|
|
30
30
|
# @example Using Mailt::Mailer::EventMachine by inclusion
|
|
@@ -33,13 +33,6 @@ module Mailit
|
|
|
33
33
|
# include Mailit::Mailer::EventMachine
|
|
34
34
|
# end
|
|
35
35
|
#
|
|
36
|
-
# Another way is to extend an instance of Mailer with the backend you want to
|
|
37
|
-
# use, which will not affect other instances.
|
|
38
|
-
#
|
|
39
|
-
# @example Using Mailit::mailer::EventMachine by extension
|
|
40
|
-
#
|
|
41
|
-
# mailer = Mailit::Mailer.new
|
|
42
|
-
# mailer.extend(Mailit::Mailer::EventMachine)
|
|
43
36
|
class Mailer
|
|
44
37
|
OPTIONS = {
|
|
45
38
|
:server => 'smtp.localhost',
|
|
@@ -60,44 +53,37 @@ module Mailit
|
|
|
60
53
|
new.defer_send(mail, options)
|
|
61
54
|
end
|
|
62
55
|
|
|
63
|
-
undef :send
|
|
64
|
-
|
|
65
56
|
attr_reader :options
|
|
66
57
|
|
|
67
58
|
def initialize(options = {})
|
|
68
59
|
@options = OPTIONS.merge(options)
|
|
69
|
-
extend NetSmtp unless respond_to?(:send)
|
|
70
60
|
end
|
|
71
61
|
|
|
72
|
-
|
|
62
|
+
def send(mail, override = {})
|
|
63
|
+
require 'net/smtp'
|
|
73
64
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
end
|
|
65
|
+
server, port, domain, username, password, auth_type, noop =
|
|
66
|
+
settings(override, :server, :port, :domain, :username, :password, :auth_type, :noop)
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
::Net::SMTP.start(server, port, domain, username, password, auth_type) do |smtp|
|
|
69
|
+
return if noop
|
|
70
|
+
smtp.send_message(mail.to_s, mail.from, mail.to)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
def defer_send(mail, override = {})
|
|
75
|
+
Thread.new{ send(mail, override) }
|
|
76
|
+
end
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
return if noop
|
|
87
|
-
smtp.send_message(mail.to_s, mail.from, mail.to)
|
|
88
|
-
end
|
|
89
|
-
end
|
|
78
|
+
private
|
|
90
79
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
end
|
|
80
|
+
def settings(override, *keys)
|
|
81
|
+
options.merge(override).values_at(*keys)
|
|
94
82
|
end
|
|
95
83
|
|
|
96
|
-
# Allows you to comfortably use the EventMachine::SmtpClient.
|
|
97
|
-
# In order to use it, you have to first include this module into
|
|
98
|
-
# Mailit::Mailer or extend the Mailit::Mailer instance with it.
|
|
84
|
+
# Allows you to comfortably use the EventMachine::Protocols::SmtpClient.
|
|
85
|
+
# In order to use it, you have to first include this module into Mailit::Mailer
|
|
99
86
|
module EventMachine
|
|
100
|
-
|
|
101
87
|
# This assumes that EventMachine was required and we are inside the
|
|
102
88
|
# EventMachine::run block.
|
|
103
89
|
#
|
|
@@ -105,25 +91,41 @@ module Mailit
|
|
|
105
91
|
# deconstruct our mail a bit.
|
|
106
92
|
# On the upside, it seems like it supports STARTTLS (without certificate
|
|
107
93
|
# options though)
|
|
108
|
-
def
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
94
|
+
def self.included(base)
|
|
95
|
+
require 'em/protocols/smtpclient'
|
|
96
|
+
base.module_eval do
|
|
97
|
+
def send(mail, override = {})
|
|
98
|
+
server, port, domain, username, password, auth_type =
|
|
99
|
+
settings(override, :server, :port, :domain, :username, :password, :auth_type)
|
|
100
|
+
|
|
101
|
+
mail.construct # prepare headers and body
|
|
102
|
+
|
|
103
|
+
em_options = { :port => port, :host => server, :domain => domain,
|
|
104
|
+
:from => mail.from, :to => mail.to, :header => mail.header_string,
|
|
105
|
+
:body => mail.body_string }
|
|
106
|
+
|
|
107
|
+
if auth_type
|
|
108
|
+
em_options[:auth] = {
|
|
109
|
+
:type => auth_type, :username => username, :password => password }
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
email = EM::Protocols::SmtpClient.send(em_options)
|
|
113
|
+
email.callback &@callback if @callback
|
|
114
|
+
email.errback &@errback if @errback
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def callback(proc=nil, &blk)
|
|
118
|
+
@callback = proc || blk
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def errback(proc=nil, &blk)
|
|
122
|
+
@errback = proc || blk
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
alias defer_send send
|
|
121
126
|
end
|
|
122
|
-
|
|
123
|
-
::EventMachine::SmtpClient.send(em_options)
|
|
127
|
+
|
|
124
128
|
end
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
end
|
|
129
|
-
end
|
|
129
|
+
end # module EventMachine
|
|
130
|
+
end # class Mailer
|
|
131
|
+
end # module Mailit
|
data/lib/version.rb
ADDED
data/mailit.gemspec
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
1
3
|
Gem::Specification.new do |s|
|
|
2
|
-
s.name =
|
|
3
|
-
s.version = "2009.
|
|
4
|
+
s.name = %q{mailit}
|
|
5
|
+
s.version = "2009.08"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Kevin Berry"]
|
|
9
|
+
s.date = %q{2009-08-26}
|
|
10
|
+
s.description = %q{The Mailit library, by Kevin Berry}
|
|
11
|
+
s.email = %q{kevinberry@nrs.us}
|
|
12
|
+
s.files = ["AUTHORS", "CHANGELOG", "MANIFEST", "README.md", "Rakefile", "lib/mailit.rb", "lib/mailit/mail.rb", "lib/mailit/mailer.rb", "lib/mailit/mime.rb", "lib/mailit/version.rb", "lib/version.rb", "mailit.gemspec", "spec/helper.rb", "spec/mailit/mail.rb", "spec/mailit/mailer.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/copyright.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/yard.rake"]
|
|
13
|
+
s.homepage = %q{http://github.com/manveru/mailit}
|
|
14
|
+
s.require_paths = ["lib"]
|
|
15
|
+
s.rubygems_version = %q{1.3.4}
|
|
16
|
+
s.summary = %q{The Mailit library, by Kevin Berry}
|
|
4
17
|
|
|
5
|
-
s.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
s.has_rdoc = true
|
|
9
|
-
s.author = "Michael 'manveru' Fellinger"
|
|
10
|
-
s.email = "m.fellinger@gmail.com"
|
|
11
|
-
s.homepage = "http://github.com/manveru/mailit"
|
|
12
|
-
s.require_path = "lib"
|
|
18
|
+
if s.respond_to? :specification_version then
|
|
19
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
20
|
+
s.specification_version = 3
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"lib/mailit/mime.rb",
|
|
20
|
-
"mailit.gemspec",
|
|
21
|
-
"spec/helper.rb",
|
|
22
|
-
"spec/mailit/mail.rb",
|
|
23
|
-
"spec/mailit/mailer.rb",
|
|
24
|
-
]
|
|
22
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
23
|
+
else
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
end
|
|
25
27
|
end
|
data/tasks/authors.rake
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Once git has a fix for the glibc in handling .mailmap and another fix for
|
|
2
|
+
# allowing empty mail address to be mapped in .mailmap we won't have to handle
|
|
3
|
+
# them manually.
|
|
4
|
+
|
|
5
|
+
desc 'Update AUTHORS'
|
|
6
|
+
task :authors do
|
|
7
|
+
authors = Hash.new(0)
|
|
8
|
+
|
|
9
|
+
`git shortlog -nse`.scan(/(\d+)\s(.+)\s<(.*)>$/) do |count, name, email|
|
|
10
|
+
# Examples of mappping, replace with your own or comment this out/delete it
|
|
11
|
+
case name
|
|
12
|
+
when /^(?:bougyman$|TJ Vanderpoel)/
|
|
13
|
+
name, email = "TJ Vanderpoel", "tj@rubyists.com"
|
|
14
|
+
when /^(?:manveru$|Michael Fellinger)/
|
|
15
|
+
name, email = "Michael Fellinger", "mf@rubyists.com"
|
|
16
|
+
when /^(?:deathsyn$|Kevin Berry)/
|
|
17
|
+
name, email = "Kevin Berry", "kb@rubyists.com"
|
|
18
|
+
when /^(?:(?:jayson|thedonvaughn|jvaughn)$|Jayson Vaughn)/
|
|
19
|
+
name, email = "Jayson Vaughn", "jv@rubyists.com"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
authors[[name, email]] += count.to_i
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
File.open('AUTHORS', 'w+') do |io|
|
|
26
|
+
io.puts "Following persons have contributed to #{GEMSPEC.name}."
|
|
27
|
+
io.puts '(Sorted by number of submitted patches, then alphabetically)'
|
|
28
|
+
io.puts ''
|
|
29
|
+
authors.sort_by{|(n,e),c| [-c, n.downcase] }.each do |(name, email), count|
|
|
30
|
+
io.puts("%6d %s <%s>" % [count, name, email])
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/tasks/bacon.rake
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
desc 'Run all bacon specs with pretty output'
|
|
2
|
+
task :bacon => :install_dependencies do
|
|
3
|
+
require 'open3'
|
|
4
|
+
require 'scanf'
|
|
5
|
+
require 'matrix'
|
|
6
|
+
|
|
7
|
+
specs = PROJECT_SPECS
|
|
8
|
+
|
|
9
|
+
some_failed = false
|
|
10
|
+
specs_size = specs.size
|
|
11
|
+
if specs.size == 0
|
|
12
|
+
$stderr.puts "You have no specs! Put a spec in spec/ before running this task"
|
|
13
|
+
exit 1
|
|
14
|
+
end
|
|
15
|
+
len = specs.map{|s| s.size }.sort.last
|
|
16
|
+
total_tests = total_assertions = total_failures = total_errors = 0
|
|
17
|
+
totals = Vector[0, 0, 0, 0]
|
|
18
|
+
|
|
19
|
+
red, yellow, green = "\e[31m%s\e[0m", "\e[33m%s\e[0m", "\e[32m%s\e[0m"
|
|
20
|
+
left_format = "%4d/%d: %-#{len + 11}s"
|
|
21
|
+
spec_format = "%d specifications (%d requirements), %d failures, %d errors"
|
|
22
|
+
|
|
23
|
+
specs.each_with_index do |spec, idx|
|
|
24
|
+
print(left_format % [idx + 1, specs_size, spec])
|
|
25
|
+
|
|
26
|
+
Open3.popen3(RUBY, spec) do |sin, sout, serr|
|
|
27
|
+
out = sout.read.strip
|
|
28
|
+
err = serr.read.strip
|
|
29
|
+
|
|
30
|
+
# this is conventional, see spec/innate/state/fiber.rb for usage
|
|
31
|
+
if out =~ /^Bacon::Error: (needed .*)/
|
|
32
|
+
puts(yellow % ("%6s %s" % ['', $1]))
|
|
33
|
+
else
|
|
34
|
+
total = nil
|
|
35
|
+
|
|
36
|
+
out.each_line do |line|
|
|
37
|
+
scanned = line.scanf(spec_format)
|
|
38
|
+
|
|
39
|
+
next unless scanned.size == 4
|
|
40
|
+
|
|
41
|
+
total = Vector[*scanned]
|
|
42
|
+
break
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if total
|
|
46
|
+
totals += total
|
|
47
|
+
tests, assertions, failures, errors = total_array = total.to_a
|
|
48
|
+
|
|
49
|
+
if tests > 0 && failures + errors == 0
|
|
50
|
+
puts((green % "%6d passed") % tests)
|
|
51
|
+
else
|
|
52
|
+
some_failed = true
|
|
53
|
+
puts(red % " failed")
|
|
54
|
+
puts out unless out.empty?
|
|
55
|
+
puts err unless err.empty?
|
|
56
|
+
end
|
|
57
|
+
else
|
|
58
|
+
some_failed = true
|
|
59
|
+
puts(red % " failed")
|
|
60
|
+
puts out unless out.empty?
|
|
61
|
+
puts err unless err.empty?
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
total_color = some_failed ? red : green
|
|
68
|
+
puts(total_color % (spec_format % totals.to_a))
|
|
69
|
+
exit 1 if some_failed
|
|
70
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
desc 'update changelog'
|
|
2
|
+
task :changelog do
|
|
3
|
+
File.open('CHANGELOG', 'w+') do |changelog|
|
|
4
|
+
`git log -z --abbrev-commit`.split("\0").each do |commit|
|
|
5
|
+
next if commit =~ /^Merge: \d*/
|
|
6
|
+
ref, author, time, _, title, _, message = commit.split("\n", 7)
|
|
7
|
+
ref = ref[/commit ([0-9a-f]+)/, 1]
|
|
8
|
+
author = author[/Author: (.*)/, 1].strip
|
|
9
|
+
time = Time.parse(time[/Date: (.*)/, 1]).utc
|
|
10
|
+
title.strip!
|
|
11
|
+
|
|
12
|
+
changelog.puts "[#{ref} | #{time}] #{author}"
|
|
13
|
+
changelog.puts '', " * #{title}"
|
|
14
|
+
changelog.puts '', message.rstrip if message
|
|
15
|
+
changelog.puts
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
|
|
2
|
+
# Distributed under the terms of the MIT license.
|
|
3
|
+
# See the LICENSE file that accompanied this software for the full MIT License text
|
|
4
|
+
#
|
|
5
|
+
require "pathname"
|
|
6
|
+
task :legal do
|
|
7
|
+
license = Pathname("LICENSE")
|
|
8
|
+
license.open("w+") do |f|
|
|
9
|
+
f.puts PROJECT_COPYRIGHT
|
|
10
|
+
end unless license.file? and license.read == PROJECT_COPYRIGHT
|
|
11
|
+
doc = Pathname("doc/LEGAL")
|
|
12
|
+
doc.open("w+") do |f|
|
|
13
|
+
f.puts "LICENSE"
|
|
14
|
+
end unless doc.file?
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc "add copyright summary to all .rb files in the distribution"
|
|
18
|
+
task :copyright => [:legal] do
|
|
19
|
+
doc = Pathname("doc/LEGAL")
|
|
20
|
+
ignore = doc.readlines.
|
|
21
|
+
select { |line| line.strip!; Pathname(line).file? }.
|
|
22
|
+
map { |file| Pathname(file).expand_path }
|
|
23
|
+
|
|
24
|
+
puts "adding copyright summary to files that don't have it currently"
|
|
25
|
+
puts PROJECT_COPYRIGHT_SUMMARY
|
|
26
|
+
puts
|
|
27
|
+
|
|
28
|
+
(Pathname.glob('{controller,model,app,lib,test,spec}/**/*{.rb}') +
|
|
29
|
+
Pathname.glob("tasks/*.rake") +
|
|
30
|
+
Pathname.glob("Rakefile")).each do |file|
|
|
31
|
+
next if ignore.include? file.expand_path
|
|
32
|
+
lines = file.readlines.map{ |l| l.chomp }
|
|
33
|
+
unless lines.first(PROJECT_COPYRIGHT_SUMMARY.size) == PROJECT_COPYRIGHT_SUMMARY
|
|
34
|
+
oldlines = file.readlines
|
|
35
|
+
file.open("w+") { |f| f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/tasks/gem.rake
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'rake/gempackagetask'
|
|
2
|
+
|
|
3
|
+
desc "make a gemspec"
|
|
4
|
+
task :gemspec => [:manifest, :changelog, :authors] do
|
|
5
|
+
gemspec_file = "#{GEMSPEC.name}.gemspec"
|
|
6
|
+
File.open(gemspec_file, 'w+'){|gs| gs.puts(GEMSPEC.to_ruby) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
desc "package and install from gemspec"
|
|
10
|
+
task :install => [:gemspec] do
|
|
11
|
+
sh "gem build #{GEMSPEC.name}.gemspec"
|
|
12
|
+
sh "gem install #{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc "uninstall the gem"
|
|
16
|
+
task :uninstall => [:clean] do
|
|
17
|
+
sh %{gem uninstall -x #{GEMSPEC.name}}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Rake::GemPackageTask.new(GEMSPEC) do |p|
|
|
21
|
+
p.need_tar = true
|
|
22
|
+
p.need_zip = true
|
|
23
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
task :gem_installer do
|
|
2
|
+
class GemInstaller
|
|
3
|
+
def initialize(options = {}, &block)
|
|
4
|
+
@gems = []
|
|
5
|
+
@options = options
|
|
6
|
+
|
|
7
|
+
run(&block)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def run(&block)
|
|
11
|
+
instance_eval(&block) if block_given?
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def gem(name, version = nil, options = {})
|
|
15
|
+
if version.respond_to?(:merge!)
|
|
16
|
+
options = version
|
|
17
|
+
else
|
|
18
|
+
options[:version] = version
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@gems << [name, options]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def setup_gemspec(gemspec)
|
|
25
|
+
gemspec.dependencies.each do |dependency|
|
|
26
|
+
dependency.version_requirements.as_list.each do |version|
|
|
27
|
+
gem(dependency.name, version)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
setup
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def setup
|
|
35
|
+
require 'rubygems'
|
|
36
|
+
require 'rubygems/dependency_installer'
|
|
37
|
+
|
|
38
|
+
@gems.each do |name, options|
|
|
39
|
+
setup_gem(name, options)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def setup_gem(name, options, try_install = true)
|
|
44
|
+
print "activating #{name} ... "
|
|
45
|
+
Gem.activate(name, *[options[:version]].compact)
|
|
46
|
+
require(options[:lib] || name)
|
|
47
|
+
puts "success."
|
|
48
|
+
rescue LoadError => error
|
|
49
|
+
puts error
|
|
50
|
+
install_gem(name, options) if try_install
|
|
51
|
+
setup_gem(name, options, try_install = false)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def install_gem(name, options)
|
|
55
|
+
installer = Gem::DependencyInstaller.new(options)
|
|
56
|
+
|
|
57
|
+
temp_argv(options[:extconf]) do
|
|
58
|
+
print "Installing #{name} ... "
|
|
59
|
+
installer.install(name, options[:version])
|
|
60
|
+
puts "done."
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def temp_argv(extconf)
|
|
65
|
+
if extconf ||= @options[:extconf]
|
|
66
|
+
old_argv = ARGV.clone
|
|
67
|
+
ARGV.replace(extconf.split(' '))
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
yield
|
|
71
|
+
|
|
72
|
+
ensure
|
|
73
|
+
ARGV.replace(old_argv) if extconf
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/tasks/manifest.rake
ADDED
data/tasks/rcov.rake
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
desc 'code coverage'
|
|
2
|
+
task :rcov => :clean do
|
|
3
|
+
specs = PROJECT_SPECS
|
|
4
|
+
|
|
5
|
+
ignore = %w[ gem rack bacon innate hpricot nagoro/lib/nagoro ]
|
|
6
|
+
|
|
7
|
+
if RUBY_VERSION >= '1.8.7'
|
|
8
|
+
ignore << 'begin_with' << 'end_with'
|
|
9
|
+
end
|
|
10
|
+
if RUBY_VERSION < '1.9'
|
|
11
|
+
ignore << 'fiber'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
ignored = ignore.join(',')
|
|
15
|
+
|
|
16
|
+
cmd = "rcov --aggregate coverage.data --sort coverage -t --%s -x '#{ignored}' %s"
|
|
17
|
+
|
|
18
|
+
while spec = specs.shift
|
|
19
|
+
puts '', "Gather coverage for #{spec} ..."
|
|
20
|
+
html = specs.empty? ? 'html' : 'no-html'
|
|
21
|
+
sh(cmd % [html, spec])
|
|
22
|
+
end
|
|
23
|
+
end
|
data/tasks/release.rake
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
namespace :release do
|
|
2
|
+
task :all => [:release_github, :release_rubyforge]
|
|
3
|
+
|
|
4
|
+
desc 'Display instructions to release on github'
|
|
5
|
+
task :github => [:reversion, :gemspec] do
|
|
6
|
+
name, version = GEMSPEC.name, GEMSPEC.version
|
|
7
|
+
|
|
8
|
+
puts <<INSTRUCTIONS
|
|
9
|
+
First add the relevant files:
|
|
10
|
+
|
|
11
|
+
git add AUTHORS MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb
|
|
12
|
+
|
|
13
|
+
Then commit them, tag the commit, and push:
|
|
14
|
+
|
|
15
|
+
git commit -m 'Version #{version}'
|
|
16
|
+
git tag -a -m '#{version}' '#{version}'
|
|
17
|
+
git push
|
|
18
|
+
|
|
19
|
+
INSTRUCTIONS
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# TODO: Not tested
|
|
24
|
+
desc 'Display instructions to release on rubyforge'
|
|
25
|
+
task :rubyforge => [:reversion, :gemspec, :package] do
|
|
26
|
+
name, version = GEMSPEC.name, GEMSPEC.version.to_s
|
|
27
|
+
|
|
28
|
+
puts <<INSTRUCTIONS
|
|
29
|
+
To publish to rubyforge do following:
|
|
30
|
+
|
|
31
|
+
rubyforge login
|
|
32
|
+
rubyforge add_release #{name} #{name} #{version.dump} pkg/#{name}-#{version}.gem
|
|
33
|
+
|
|
34
|
+
After you have done these steps, see:
|
|
35
|
+
|
|
36
|
+
VERSION=#{version.dump} rake release:rubyforge_archives
|
|
37
|
+
|
|
38
|
+
INSTRUCTIONS
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc 'Display instructions to add archives after release:rubyforge'
|
|
42
|
+
task :rubyforge_archives do
|
|
43
|
+
name, version = GEMSPEC.name, GEMSPEC.version.to_s
|
|
44
|
+
puts "Adding archives for distro packagers is:", ""
|
|
45
|
+
|
|
46
|
+
Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
|
|
47
|
+
puts "rubyforge add_file %s %s %p %p" % [name, name, version, file]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
puts
|
|
51
|
+
end
|
|
52
|
+
end
|
data/tasks/setup.rake
ADDED
data/tasks/yard.rake
ADDED
metadata
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: manveru-mailit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2009.
|
|
4
|
+
version: "2009.08"
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Kevin Berry
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-08-26 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
16
|
-
description:
|
|
17
|
-
email:
|
|
16
|
+
description: The Mailit library, by Kevin Berry
|
|
17
|
+
email: kevinberry@nrs.us
|
|
18
18
|
executables: []
|
|
19
19
|
|
|
20
20
|
extensions: []
|
|
@@ -22,16 +22,35 @@ extensions: []
|
|
|
22
22
|
extra_rdoc_files: []
|
|
23
23
|
|
|
24
24
|
files:
|
|
25
|
+
- AUTHORS
|
|
26
|
+
- CHANGELOG
|
|
27
|
+
- MANIFEST
|
|
25
28
|
- README.md
|
|
29
|
+
- Rakefile
|
|
26
30
|
- lib/mailit.rb
|
|
27
31
|
- lib/mailit/mail.rb
|
|
28
32
|
- lib/mailit/mailer.rb
|
|
29
33
|
- lib/mailit/mime.rb
|
|
34
|
+
- lib/mailit/version.rb
|
|
35
|
+
- lib/version.rb
|
|
30
36
|
- mailit.gemspec
|
|
31
37
|
- spec/helper.rb
|
|
32
38
|
- spec/mailit/mail.rb
|
|
33
39
|
- spec/mailit/mailer.rb
|
|
34
|
-
|
|
40
|
+
- tasks/authors.rake
|
|
41
|
+
- tasks/bacon.rake
|
|
42
|
+
- tasks/changelog.rake
|
|
43
|
+
- tasks/copyright.rake
|
|
44
|
+
- tasks/gem.rake
|
|
45
|
+
- tasks/gem_installer.rake
|
|
46
|
+
- tasks/install_dependencies.rake
|
|
47
|
+
- tasks/manifest.rake
|
|
48
|
+
- tasks/rcov.rake
|
|
49
|
+
- tasks/release.rake
|
|
50
|
+
- tasks/reversion.rake
|
|
51
|
+
- tasks/setup.rake
|
|
52
|
+
- tasks/yard.rake
|
|
53
|
+
has_rdoc: false
|
|
35
54
|
homepage: http://github.com/manveru/mailit
|
|
36
55
|
post_install_message:
|
|
37
56
|
rdoc_options: []
|
|
@@ -55,7 +74,7 @@ requirements: []
|
|
|
55
74
|
rubyforge_project:
|
|
56
75
|
rubygems_version: 1.2.0
|
|
57
76
|
signing_key:
|
|
58
|
-
specification_version:
|
|
59
|
-
summary:
|
|
77
|
+
specification_version: 3
|
|
78
|
+
summary: The Mailit library, by Kevin Berry
|
|
60
79
|
test_files: []
|
|
61
80
|
|