Module: MJML
- Defined in:
- lib/mjml.rb,
lib/mjml/parser.rb
Overview
Defined Under Namespace
Modules: Config
Classes: BinaryNotFound, Parser
Constant Summary
collapse
- MIME_TYPE =
'text/mjml'.freeze
- EXTENSION =
'.mjml'.freeze
- VERSION_4_REGEX =
/^mjml-cli: (\d+\.\d+\.\d+)/i
Class Method Summary
collapse
Class Method Details
.executable_version ⇒ Object
32
33
34
|
# File 'lib/mjml.rb', line 32
def self.executable_version
@executable_version ||=
end
|
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/mjml.rb', line 36
def self.
ver, _status = Open3.capture2(Config.bin_path, '--version')
match = ver.match(VERSION_4_REGEX)
match.nil? ? nil : match[1]
rescue Errno::ENOENT => _e
raise BinaryNotFound, "mjml binary not found for path '#{Config.bin_path}'"
end
|
.find_executable ⇒ Object
26
27
28
29
30
|
# File 'lib/mjml.rb', line 26
def self.find_executable
local_path = File.expand_path('node_modules/.bin/mjml', Dir.pwd)
return local_path if File.file?(local_path)
`/usr/bin/env which mjml`.strip
end
|
.setup! ⇒ Object
20
21
22
23
24
|
# File 'lib/mjml.rb', line 20
def self.setup!
Config.bin_path = find_executable
Config.minify_output = false
end
|