Module: Mjml
- Defined in:
- lib/mjml.rb,
lib/mjml/parser.rb,
lib/mjml/railtie.rb,
lib/mjml/version.rb,
lib/mjml/mjmltemplate.rb,
lib/generators/mjml/mailer/mailer_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Handler, Mjmltemplate, Parser, Railtie
Constant Summary
collapse
- BIN =
discover_mjml_bin
- VERSION =
Version number no longer matches MJML.io version
"2.4.3"
- @@template_language =
:erb
- @@processing_options =
{}
Class Method Summary
collapse
Class Method Details
.check_version(bin) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/mjml.rb', line 12
def self.check_version(bin)
version = IO.popen("#{bin} --version").read.chomp
Gem::Dependency.new('', '~> 3.0').match?('', version)
rescue
false
end
|
.discover_mjml_bin ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/mjml.rb', line 19
def self.discover_mjml_bin
mjml_bin = 'mjml'
return mjml_bin if check_version(mjml_bin)
installer_path = (`npm bin` || `yarn bin`).chomp
mjml_bin = File.join(installer_path, 'mjml')
return mjml_bin if check_version(mjml_bin)
puts "Couldn't find the MJML binary.. have you run $ npm install mjml?"
nil
end
|
.setup {|_self| ... } ⇒ Object
50
51
52
|
# File 'lib/mjml.rb', line 50
def self.setup
yield self if block_given?
end
|