sighmon / mjml-rails

MJML + ERb/Haml/Slim view template
https://mjml.io
Other
295 stars 64 forks source link

Add fonts config option #112

Closed clairezed closed 4 months ago

clairezed commented 10 months ago

@sighmon actually this is my first ever contribution to an existing gem and I don't really know how it works ! I feel like a noob, as there are some basic steps I didn't even manage to accomplish.

How to launch the test suite ? rake test (and any other commands I tried) throws an error : undefined methoddeprecator' for ActiveSupport:Module`.

I could write a basic "How to contribute ?" part in READ.me in exchange of a bit of your time to help me through this PR, if you want.

close #111

sighmon commented 9 months ago

@clairezed Sorry about your first contribution being a little difficult! Looks like something has been deprecated since the last update, so let's solve that problem on another branch/PR, and keep yours focused on fonts. But yes, rake test should run all of the tests locally.

I'd love help with a How to contribute section and a PR template. Happy for that to be in this PR or another one too - up to you.

I'm moving house at the moment so don't have a bunch of time, so you're welcome to try and solve the deprecation errors before I get to them.

clairezed commented 9 months ago

I don't get why tests don't pass (When I run them locally, it works). Is there a way to run tests as CI does, so that I can try to fix them ?

sighmon commented 9 months ago

@clairezed I'm seeing the same errors locally on my Intel mac running 14.1.1.

My MJML version:

$ mjml --version

mjml-core: 4.14.1
mjml-cli: 4.14.1

Error:

Error:
NotifierMailerTest#test_Invalid_template_gets_compiled_with_validation_level_soft:
ActionView::Template::Error: 
Command line error:
Too many input arguments received
(process status: pid 18791 exit 1)
    /Users/x/code/mjml-rails/lib/mjml/parser.rb:51:in `block in run'
    /Users/x/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tempfile.rb:407:in `create'
    /Users/x/code/mjml-rails/lib/mjml/parser.rb:42:in `run'
    /Users/x/code/mjml-rails/lib/mjml/parser.rb:26:in `render'
    /Users/x/code/mjml-rails/test/views/layouts/default.html.mjml:25:in `___sers_x__ites_heroku_mjml_rails_test_views_layouts_default_html_mjml__4477425824597377788_3520'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/base.rb:264:in `public_send'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/base.rb:264:in `_run'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/template.rb:254:in `block in render'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/activesupport-7.1.1/lib/active_support/notifications.rb:208:in `instrument'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/template.rb:535:in `instrument_render_template'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/template.rb:248:in `render'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/renderer/template_renderer.rb:77:in `block in render_with_layout'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/activesupport-7.1.1/lib/active_support/notifications.rb:206:in `block in instrument'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/activesupport-7.1.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/activesupport-7.1.1/lib/active_support/notifications.rb:206:in `instrument'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/renderer/template_renderer.rb:75:in `render_with_layout'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/renderer/template_renderer.rb:59:in `render_template'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/renderer/template_renderer.rb:11:in `render'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/renderer/renderer.rb:63:in `render_template_to_object'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/renderer/renderer.rb:31:in `render_to_object'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/rendering.rb:135:in `block in _render_template'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/base.rb:291:in `in_rendering_context'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/rendering.rb:134:in `_render_template'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/rendering.rb:121:in `render_to_body'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionpack-7.1.1/lib/abstract_controller/rendering.rb:27:in `render'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/base.rb:985:in `block in collect_responses_from_block'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/collector.rb:28:in `custom'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionpack-7.1.1/lib/abstract_controller/collector.rb:11:in `html'
    /Users/x/code/mjml-rails/test/mjml_test.rb:23:in `block in invalid_template'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/base.rb:986:in `collect_responses_from_block'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/base.rb:975:in `collect_responses'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/base.rb:887:in `mail'
    /Users/x/code/mjml-rails/test/mjml_test.rb:22:in `invalid_template'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionpack-7.1.1/lib/abstract_controller/base.rb:224:in `process_action'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionpack-7.1.1/lib/abstract_controller/callbacks.rb:259:in `block in process_action'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/activesupport-7.1.1/lib/active_support/callbacks.rb:101:in `run_callbacks'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionpack-7.1.1/lib/abstract_controller/callbacks.rb:258:in `process_action'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionpack-7.1.1/lib/abstract_controller/base.rb:160:in `process'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/rescuable.rb:29:in `block in process'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/rescuable.rb:21:in `handle_exceptions'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/rescuable.rb:28:in `process'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionview-7.1.1/lib/action_view/rendering.rb:40:in `process'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/base.rb:658:in `block in process'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/activesupport-7.1.1/lib/active_support/notifications.rb:208:in `instrument'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/base.rb:657:in `process'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/message_delivery.rb:136:in `block in processed_mailer'
    <internal:kernel>:90:in `tap'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/message_delivery.rb:135:in `processed_mailer'
    /Users/x/.rvm/gems/ruby-3.2.2/gems/actionmailer-7.1.1/lib/action_mailer/message_delivery.rb:32:in `__getobj__'
    /Users/x/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/delegate.rb:84:in `method_missing'
    /Users/x/code/mjml-rails/test/mjml_test.rb:82:in `block (2 levels) in <class:NotifierMailerTest>'
    /Users/x/code/mjml-rails/test/test_helper.rb:36:in `with_settings'
    /Users/x/code/mjml-rails/test/mjml_test.rb:80:in `block in <class:NotifierMailerTest>'
sighmon commented 4 months ago

@clairezed Thanks so much! That's all merged and released as v4.11.0