maily 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f06e028da95662c194a3714e8d361b2f363129b19c6dae7b82536dba1e6ac091
4
- data.tar.gz: 533183c7173c565719c192b988233658b0017c72c0ef833e4023566a4e3fc005
3
+ metadata.gz: 1089b608a601adb322f549ed2801017a2b1c3d3431cc384353080a5a92c39d02
4
+ data.tar.gz: b2764ddefc33668fe33bf416189ee4768e96e9df9037d8819be8e81b19bef292
5
5
  SHA512:
6
- metadata.gz: 468adf0b8e2b693ab70c3d4e80c1397c10acc5da903c62506f95013ec39e6eb7695eb87026b97b94b752fc4d68f65fcfde754adcde808f2869b0a50dc91463bc
7
- data.tar.gz: 159e31df9bac091205373c86fe0cafebf7f7c0fb50b7243ce6941b580c3e63a7c92dc62c59f65ed8206fe9acdc3d9b75c12289ee5f1fd474b9da251d6a914500
6
+ metadata.gz: ef3ecb6e741c94fd348926b49cb7a2c30452ff9e21280f560dcdbfacb5bae03a4ac087e08f38663bac28a41c9fba81541d4d5b37d6ea3396d6df86a4814969b3
7
+ data.tar.gz: eb66fdba4c9f5cc8c4d3aa2c5e0a717074cf021e9d980da5c16c3e162f18a81fef92220d5cc9719ce3374c2de5ba65c7b3957161d82f9a8e6b5cf0c6842d71e3
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.12.0]
6
+
7
+ - Support inline attachments (#30)
8
+
5
9
  ## [0.11.0]
6
10
 
7
11
  - Support arrays in hooks (#42)
@@ -123,6 +127,7 @@ All notable changes to this project will be documented in this file.
123
127
 
124
128
  - First real usable release :tada:
125
129
 
130
+ [0.12.0]: https://github.com/markets/maily/compare/v0.11.0...v0.12.0
126
131
  [0.11.0]: https://github.com/markets/maily/compare/v0.10.1...v0.11.0
127
132
  [0.10.1]: https://github.com/markets/maily/compare/v0.10.0...v0.10.1
128
133
  [0.10.0]: https://github.com/markets/maily/compare/v0.9.1...v0.10.0
@@ -1,4 +1,4 @@
1
- Copyright 2013-2019 Marc Anguera Insa
1
+ Copyright 2013-2020 Marc Anguera Insa
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -25,6 +25,7 @@ module Maily
25
25
 
26
26
  content = content.raw_source
27
27
  content = view_context.simple_format(content) if @email.sub_type == 'plain' || params[:part] == 'text'
28
+ content = prepare_inline_attachments(@email, content)
28
29
 
29
30
  render html: content.html_safe, layout: false
30
31
  end
@@ -79,5 +80,19 @@ module Maily
79
80
  yield
80
81
  end
81
82
  end
83
+
84
+ def prepare_inline_attachments(email, content)
85
+ content.gsub(/src=(?:"cid:[^"]+"|'cid:[^']+')/i) do |match|
86
+ if part = find_part(email, match[9..-2])
87
+ %[src="data:#{part.mime_type};base64,#{Base64.encode64(part.body.raw_source)}"]
88
+ else
89
+ match
90
+ end
91
+ end
92
+ end
93
+
94
+ def find_part(email, cid)
95
+ email.all_parts.find { |p| p.attachment? && p.cid == cid }
96
+ end
82
97
  end
83
98
  end
@@ -30,9 +30,7 @@ module Maily
30
30
  [argument, value].join(' = ')
31
31
  end.join("\n")
32
32
 
33
- hooks = hooks.join("\n")
34
-
35
- fixtures + "\n" + hooks + "\n"
33
+ fixtures + "\n" + hooks.join("\n") + "\n"
36
34
  end
37
35
  end
38
36
  end
@@ -1,3 +1,3 @@
1
1
  module Maily
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-09 00:00:00.000000000 Z
11
+ date: 2020-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.0
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sassc-rails
29
29
  requirement: !ruby/object:Gem::Requirement