diff --git a/Gemfile b/Gemfile index d42b4de..48030da 100644 --- a/Gemfile +++ b/Gemfile @@ -17,8 +17,7 @@ group :test do gem "dry-inflector" gem "erbse", "~> 0.1.4" gem "erubi" - gem "hamlit" - gem "hamlit-block" + gem "hamlit", ">= 3.0" gem "dry-files", github: "dry-rb/dry-files" gem "hanami-cli", github: "hanami/cli", branch: "main" gem "hanami", github: "hanami/hanami", branch: "main" diff --git a/lib/hanami/view/tilt/haml.rb b/lib/hanami/view/tilt/haml.rb index a8d7c29..4f1c309 100644 --- a/lib/hanami/view/tilt/haml.rb +++ b/lib/hanami/view/tilt/haml.rb @@ -5,8 +5,8 @@ module Hanami module Tilt module Haml def self.requirements - ["hamlit/block", <<~ERROR] - hanami-view requires hamlit-block for full compatibility when rendering .haml templates (e.g. implicitly capturing block content when yielding) + ["hamlit", <<~ERROR] + hanami-view requires hamlit (3.0 or greater) for full compatibility when rendering .haml templates (e.g. implicitly capturing block content when yielding) To ignore this and use another engine for .haml templates, dereigster this adapter before calling your views: @@ -15,7 +15,7 @@ module Hanami end def self.activate - # Requiring hamlit/block will register the engine with Tilt + # Requiring hamlit will register the engine with Tilt self end end diff --git a/spec/fixtures/integration/template_engines/hamlit/method_with_yield.html.haml b/spec/fixtures/integration/template_engines/hamlit/method_with_yield.html.haml index e16de33..f1c3c36 100644 --- a/spec/fixtures/integration/template_engines/hamlit/method_with_yield.html.haml +++ b/spec/fixtures/integration/template_engines/hamlit/method_with_yield.html.haml @@ -1,3 +1,2 @@ -= wrapper do +!= wrapper do = "Yielded" - diff --git a/spec/fixtures/integration/template_engines/hamlit/render_and_yield.html.haml b/spec/fixtures/integration/template_engines/hamlit/render_and_yield.html.haml index d029058..6806fb4 100644 --- a/spec/fixtures/integration/template_engines/hamlit/render_and_yield.html.haml +++ b/spec/fixtures/integration/template_engines/hamlit/render_and_yield.html.haml @@ -1,2 +1,2 @@ -= render(:wrapper) do +!= render(:wrapper) do = "Yielded" diff --git a/spec/integration/template_engines/hamlit_spec.rb b/spec/integration/template_engines/hamlit_spec.rb index 26a082a..227879f 100644 --- a/spec/integration/template_engines/hamlit_spec.rb +++ b/spec/integration/template_engines/hamlit_spec.rb @@ -35,13 +35,13 @@ RSpec.describe "Template engines / haml (using hamlit-block as default engine)" end end - context "with hamlit-block not available" do + context "with hamlit not available" do before do @load_path = $LOAD_PATH.dup @loaded_features = $LOADED_FEATURES.dup - $LOAD_PATH.reject! { |path| path =~ /hamlit-block/ } - $LOADED_FEATURES.reject! { |path| path =~ /hamlit-block/ } + $LOAD_PATH.reject! { |path| path =~ /hamlit/ } + $LOADED_FEATURES.reject! { |path| path =~ /hamlit/ } Hanami::View::Tilt.cache.clear Hanami::View::Renderer.cache.clear @@ -52,12 +52,12 @@ RSpec.describe "Template engines / haml (using hamlit-block as default engine)" $LOADED_FEATURES.replace @loaded_features end - it "raises an error explaining the hamlit-block requirement" do + it "raises an error explaining the hamlit requirement" do view = Class.new(base_view) do config.template = "render_and_yield" end.new - expect { view.() }.to raise_error(LoadError, /hanami-view requires hamlit-block/m) + expect { view.() }.to raise_error(LoadError, /hanami-view requires hamlit/m) end end end