mjml-rails 2.1.4.1 → 2.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e59e3e02f10d8a60bec4f24c6fbb0c54e17c97e
4
- data.tar.gz: 2677fddd0a759e3e4ec3e4c2cb8bed1cf125d011
3
+ metadata.gz: 8d53faf3f214713c84ee67803ab0f39edff515e5
4
+ data.tar.gz: fc01ca63c96f2cc3e5213954f6f84ae6bd80c47f
5
5
  SHA512:
6
- metadata.gz: abc6cfe1614a3e7fbdf7f24659d0230dcb1034594a7e45828c234e8ca859afe8f527eccc5b11f34fcc922a2d5754547a40abef34f77424f7f81b81959df06687
7
- data.tar.gz: adf302aa4c460744935d39402734151980135f7bfc486df67f77269070f4c33be499b784e222226c6622c93184b23e49f614d69ca04a593b5bfb5b5b36d2ad41
6
+ metadata.gz: 829127c28ea524654f5fc3be70b923571843f675339a97ad21cd5b6bd6b746ae218b581c097bac61cb09e2db417fe85dab32594f2a507040d4e4749024e7feb0
7
+ data.tar.gz: 3bfd98687210b8185d6458ee40d578b4144414c0c33ebfcb616afff2944173c40bc7425e4800e9b23b0c10eee3461d591138be0ad54c46a55c7d1c12e024248a
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -59,10 +59,10 @@ Run the following command to install it:
59
59
  bundle install
60
60
  ```
61
61
 
62
- Install the MJML parser
62
+ Install the MJML parser (optional -g to install it globally):
63
63
 
64
64
  ```console
65
- npm install -g mjml@2.1.4
65
+ npm install -g mjml@^2.0
66
66
  ```
67
67
 
68
68
  ### How to guides
@@ -98,7 +98,7 @@ Next you'll need to setup a `package.json` file in the root, something like this
98
98
  "test": "test"
99
99
  },
100
100
  "dependencies": {
101
- "mjml": "2.1.4"
101
+ "mjml": "^2.0"
102
102
  },
103
103
  "repository": {
104
104
  "type": "git",
@@ -2,8 +2,32 @@ require "action_view"
2
2
  require "action_view/template"
3
3
  require "mjml/mjmltemplate"
4
4
  require "mjml/railtie"
5
+ require "rubygems"
5
6
 
6
7
  module Mjml
8
+
9
+ def self.check_version(bin)
10
+ begin
11
+ Gem::Dependency.new('','~> 2.0').match?('',`#{bin} --version`)
12
+ rescue
13
+ false
14
+ end
15
+ end
16
+
17
+ def self.discover_mjml_bin
18
+ # Check for a global install of MJML binary
19
+ mjml_bin = 'mjml'
20
+ return mjml_bin if check_version(mjml_bin)
21
+
22
+ # Check for a local install of MJML binary
23
+ mjml_bin = File.join(`npm bin`.chomp, 'mjml')
24
+ return mjml_bin if check_version(mjml_bin)
25
+
26
+ raise RuntimeError, "Couldn't find the MJML binary.. have you run $ npm install mjml?"
27
+ end
28
+
29
+ BIN = discover_mjml_bin
30
+
7
31
  class Handler
8
32
  def erb_handler
9
33
  @erb_handler ||= ActionView::Template.registered_template_handler(:erb)
@@ -75,7 +75,7 @@ module Mjml
75
75
  #
76
76
  # @return [String]
77
77
  def mjml_bin
78
- `/usr/bin/which mjml`.chomp
78
+ Mjml::BIN
79
79
  end
80
80
  end
81
81
  end
@@ -4,8 +4,8 @@ module Mjml
4
4
  config.app_generators.mailer :template_engine => :mjml
5
5
 
6
6
  initializer "mjml-rails.register_template_handler" do
7
- ActionView::Template.register_template_handler :mjml, Mjml::Handler.new
8
- Mime::Type.register "text/html", :mjml
7
+ ActionView::Template.register_template_handler :mjml, Mjml::Handler.new
8
+ Mime::Type.register "text/html", :mjml
9
9
  end
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
1
  module Mjml
2
2
  # Version number matches MJML.io version
3
- VERSION = "2.1.4.1"
3
+ VERSION = "2.2.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Loffler
@@ -30,7 +30,7 @@ cert_chain:
30
30
  5hPZOkUdP3egZ1xAHeFIOhTIaOJezjUEDQVattPkgwl25+Q2EXJ+5ehDU86v+lxH
31
31
  E9hMwkxwQntg0fKVFbnVMOg2itaj8fJ7
32
32
  -----END CERTIFICATE-----
33
- date: 2016-06-08 00:00:00.000000000 Z
33
+ date: 2016-06-09 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description: Render MJML + ERb template views in Rails
36
36
  email: sighmon@sighmon.com
metadata.gz.sig CHANGED
Binary file