mandrillamelo 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/mandrillamelo +15 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f9e70b0aff976b220e27829d38e7045f1baffba
4
- data.tar.gz: f49aecee1139a5bb3afd29d7572955b8986bb235
3
+ metadata.gz: 4f5485e59a35a6174ee5ab42ed04e3f5cc30bd98
4
+ data.tar.gz: 3a872346625826590decb12360db98cc0259cb50
5
5
  SHA512:
6
- metadata.gz: 7b52d091b81d5bdee3c8211ef0273dd42b9b06dc945afe7a05cd87094625fcf7a120a0a1c99d896c13678adb47f88a5e99ae304288e394075e4a4dc5136d95f5
7
- data.tar.gz: 4596c834b20e79af8369eab7411859a60e5e59d88cc2f0d203c6928c07b7d5234a18868f984a9b4fe28a07b91f6513cc66d163dbe74effe49004a7d301f7992b
6
+ metadata.gz: bce3526b962a114c4188e893bb1c02a5dca94f91f4da0a87951bb076bf8d881b3561c34d200369e40f896ce2a7ac08eee8ea7a2b1b3b4c9fd538a358e3ac3769
7
+ data.tar.gz: eaa6aa2989fc9237ff1d8423b3ad1b95d38d7710ba23aebf60f93ae05392d2b77fb92e60fb1b1b2f2485b37ce62485bc9853ef1b8677e8e12703ef8796d8cbce
data/mandrillamelo CHANGED
@@ -7,28 +7,26 @@ parser = Vandamme::Parser.new(changelog: changelog, version_header_exp: '(\d\.\d
7
7
 
8
8
  last_release = parser.to_html.keys[0]
9
9
 
10
- def send_mail(release, html_changelog)
10
+ def send_mail(app_name, release, html_changelog, to, from, api_key, headers = {})
11
11
  begin
12
- to = ENV['RECIPIENTS'].split(',').map{ |mail| {'email'=>mail} }
13
- mandrill = Mandrill::API.new(ENV['MANDRILL_KEY'])
12
+ mandrill = Mandrill::API.new(api_key)
14
13
  message = {
15
14
  "tags"=>["changelog"],
16
15
  "to"=> to,
17
16
  "track_opens"=>nil,
18
- "headers"=>{"Reply-To"=>"dev@chorally.com"},
17
+ "headers"=>headers,
19
18
  "view_content_link"=>nil,
20
19
  "auto_text"=>nil,
21
20
  "track_clicks"=>nil,
22
21
  "from_name"=>"Changelog",
23
- "subject"=>"[CHANGELOG] Chorally #{release}",
24
- "html"=>"<h1>Chorally Changelog</h1><h2>#{release}</h2>#{html_changelog}",
25
- "from_email"=>"no-reply@chorally.com",
22
+ "subject"=>"[CHANGELOG] #{app_name} #{release}",
23
+ "html"=>"<h1>#{app_name} Changelog</h1><h2>#{release}</h2>#{html_changelog}",
24
+ "from_email"=>from,
26
25
  "preserve_recipients"=>true,
27
26
  "auto_html"=>nil,
28
27
  "important"=>false}
29
28
  async = false
30
- ip_pool = "Main Pool"
31
- result = mandrill.messages.send message, async, ip_pool #, send_at
29
+ result = mandrill.messages.send(message, async)
32
30
 
33
31
 
34
32
  rescue Mandrill::Error => e
@@ -39,4 +37,11 @@ def send_mail(release, html_changelog)
39
37
  end
40
38
  end
41
39
 
42
- puts send_mail(last_release, parser.to_html[last_release])
40
+ to = ENV['RECIPIENTS'].split(',').map{ |mail| {'email'=>mail} }
41
+ api_key = ENV['MANDRILL_KEY']
42
+ headers = {"Reply-To"=>ENV['CHANGELOG_REPLY_TO']}
43
+ from = ENV['CHANGELOG_FROM']
44
+ app_name = ENV['CHANGELOG_APP_NAME']
45
+
46
+ puts send_mail(app_name, last_release, parser.to_html[last_release],
47
+ to, from, api_key, headers)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandrillamelo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessio Caiazza
8
8
  autorequire:
9
9
  bindir: "."
10
10
  cert_chain: []
11
- date: 2016-10-26 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler