release_party 0.0.2 → 0.0.3
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.
@@ -8,6 +8,37 @@ module Celebrations
|
|
8
8
|
class Mailer < Celebration
|
9
9
|
include Announce
|
10
10
|
|
11
|
+
class MailEnvironment
|
12
|
+
attr :attachments
|
13
|
+
|
14
|
+
def initialize(environment, mail)
|
15
|
+
@environment = environment
|
16
|
+
@mail = mail
|
17
|
+
@attachments = []
|
18
|
+
end
|
19
|
+
|
20
|
+
def options_to_tag_attrs(options)
|
21
|
+
options.inject([]) do |memo, (key, value)|
|
22
|
+
memo << %{#{key}="#{value}"}
|
23
|
+
end.join(' ')
|
24
|
+
end
|
25
|
+
|
26
|
+
def image_file(filename)
|
27
|
+
path = File.join(File.dirname(@environment.template), filename)
|
28
|
+
@mail.attachments.inline[File.basename(path)] = File.read(path)
|
29
|
+
@attachments << attachment = @mail.attachments.inline[File.basename(path)]
|
30
|
+
attachment.url
|
31
|
+
end
|
32
|
+
|
33
|
+
def image_tag(filename, options = {})
|
34
|
+
%{<img src="#{image_file(filename)}" #{options_to_tag_attrs options}/>}
|
35
|
+
end
|
36
|
+
|
37
|
+
def method_missing(method_id, *args, &block)
|
38
|
+
@environment.method_missing(method_id, *args, &block)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
11
42
|
attr :engine
|
12
43
|
|
13
44
|
def initialize(env)
|
@@ -48,15 +79,38 @@ module Celebrations
|
|
48
79
|
|
49
80
|
private #######################################################################
|
50
81
|
|
82
|
+
def delete_image_part(parts, content_id)
|
83
|
+
return if parts.nil?
|
84
|
+
|
85
|
+
parts.each_with_index do |part, index|
|
86
|
+
|
87
|
+
if part.content_disposition =~ /inline/i &&
|
88
|
+
part.content_type =~ %r{^image/}i &&
|
89
|
+
part.content_id == content_id
|
90
|
+
|
91
|
+
return parts.delete_at(index)
|
92
|
+
|
93
|
+
else
|
94
|
+
delete_image_part(part.parts, content_id)
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
51
101
|
def deliver_notification
|
52
102
|
mail = Mail.new
|
53
103
|
mail.to = environment.email_notification_to
|
54
104
|
mail.from = environment.from_address
|
55
105
|
mail.subject = environment.subject
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
106
|
+
|
107
|
+
mail_env = MailEnvironment.new(environment, mail)
|
108
|
+
html = engine.render mail_env
|
109
|
+
mail.part :content_type => 'multipart/related' do |part|
|
110
|
+
part.part :content_type => 'text/html; charset=UTF-8', :body => html
|
111
|
+
mail_env.attachments.each do |attachment|
|
112
|
+
part.parts << delete_image_part(mail.parts, attachment.content_id)
|
113
|
+
end
|
60
114
|
end
|
61
115
|
|
62
116
|
announce "Delivering deployment notice to #{environment.email_notification_to.inspect}"
|
@@ -39,17 +39,18 @@ class Environment
|
|
39
39
|
:user => `git config user.name`.chomp,
|
40
40
|
:branch => 'master',
|
41
41
|
:stage => 'staging',
|
42
|
-
:domain => '
|
42
|
+
:domain => 'releaseparty.org',
|
43
43
|
:display_name => 'Release Party',
|
44
44
|
:from_address => 'Release Party <releaseparty@noreply.org>',
|
45
45
|
:smtp_address => 'localhost',
|
46
46
|
:smtp_port => 25,
|
47
|
-
:subject => Proc.new {"#{display_name} was released to
|
47
|
+
:subject => Proc.new {"#{display_name} was released to http://#{domain}/"},
|
48
48
|
:finished_stories => [],
|
49
49
|
:known_bugs => [],
|
50
50
|
:send_email => true,
|
51
51
|
:template_engine => :haml,
|
52
52
|
:deliver_stories => false,
|
53
|
+
:template => 'config/release_party/template.text.html.haml',
|
53
54
|
}
|
54
55
|
end
|
55
56
|
|
data/lib/release_party/errors.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: release_party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Barker
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-09 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|