mjml 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: bdbd311dcdbb6f67e265500eedc079f45afa5fa1
4
- data.tar.gz: 5c939a2cb0dca35b5295e4882b7d61a9931bf940
3
+ metadata.gz: c4e404ee11c541a4ca416be392afdfa18c7a6ed3
4
+ data.tar.gz: 0e3af45b2819bd146da93cb927665d415d751c91
5
5
  SHA512:
6
- metadata.gz: 2770a3a305f069dc9a48f99856d451d813b88990afb2e072a95c95c457f6b8203494b93851b17cb197916438a472423cfecb56d8b83de4552f6a5004d1ac5da4
7
- data.tar.gz: e9b35edea80721cf74f3b67e491bbcc5126f0bf493ce51ee85861d9db62b27ae1459be8edb59209a15030d43cf0bbbb2a75e0a610beda099f0cae2adfd3350ee
6
+ metadata.gz: 059a3ca00efde34979de2a76b981eb40dbaaa381f56cf2f06cf340c8afc91ff7bf3676bea3e96128e7a4d87dd0c3e405d7c042e956c8c57cc5051bc6f7eaab85
7
+ data.tar.gz: 454d35748fa6018d4f8a7d5163b5938c03d11a3917d41cac723a6db2ed639bd5b843b5f116f7b1938c037d24e4110718557729c2cf449b5298ae951ac97306dd
@@ -15,9 +15,13 @@ module Mjml
15
15
  end
16
16
 
17
17
  def self.template(template_mjml)
18
+ retries ||= 0
18
19
  mjml_path = "#{Dir.pwd}/tmp/template-#{SecureRandom.uuid}.mjml"
19
20
  File.write(mjml_path, template_mjml)
20
21
  render(mjml_path)
22
+ rescue Errno::ENOENT
23
+ Dir.mkdir "#{Dir.pwd}/tmp"
24
+ retry if (retries += 1) < 3
21
25
  end
22
26
 
23
27
  def self.configure
@@ -28,7 +28,7 @@ module Mjml
28
28
 
29
29
  def mjml_content(headers, scope)
30
30
  content =
31
- if _layout
31
+ if self.class._layout
32
32
  mjml_layout_content(headers, scope)
33
33
  else
34
34
  mjml_template_content(headers, scope)
@@ -38,7 +38,7 @@ module Mjml
38
38
  end
39
39
 
40
40
  def mjml_layout_content(headers, scope)
41
- erb_layout = Tilt::ERBTemplate.new("#{Dir.pwd}/app/views/layouts/#{_layout}.mjml")
41
+ erb_layout = Tilt::ERBTemplate.new("#{Dir.pwd}/app/views/layouts/#{self.class._layout}.mjml")
42
42
  erb_template = Tilt::ERBTemplate.new("#{headers[:template_path]}/#{headers[:template_name]}.mjml")
43
43
  erb_layout.render(scope) { erb_template.render(scope) }
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Mjml
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - MQuy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2017-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler