Closed MITSUBOSHI closed 4 years ago
@MITSUBOSHI Thanks for this pull request. I'm taking care of this right now. You'll hear soon from me when I'll release a new version of hanami-view
.
@MITSUBOSHI would you please rebase master
with this branch? In this way flaky specs and Travis CI problems won't affect the build of this PR. Thanks.
@jodosha I rebased it and CI passed :)
Problems
It's impossible to run
hanami server
when using ruby 2.7.0 (the reasons are below)Causes
gsub!
here. It works as long as@name
as String is not frozen.Module#name
method as arugument. And it will be assigned to@name
inRendering::TemplateName#initialize
.Module#name
has been changed since Ruby 2.7.0. *ref(Foo = Module.new).name.frozen? #=> false
(Foo = Module.new).name.frozen? #=> true
Execution Environment
Steps to reproduce the problem
2.7.0
hanami new bookshelf
&bundle install
bundle exec hanami server
-> then, the issued problem occursothers
error log
```log Boot Error Something went wrong while loading /Users/mitsubosh/Practice/043_hanami/bookshelf/config.ru FrozenError: can't modify frozen String: "Web::Views::ApplicationLayout" /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:45:in `gsub!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:45:in `replace!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:30:in `block in compile!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:38:in `block in tokens' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:37:in `each' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:37:in `tokens' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:30:in `compile!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/template_name.rb:17:in `initialize' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/dsl.rb:208:in `new' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/dsl.rb:208:in `template' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/layout.rb:82:in `template' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/templates_finder.rb:103:in `template_name' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/templates_finder.rb:86:in `_find' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/templates_finder.rb:72:in `find' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/layout_registry.rb:58:in `templates' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/layout_registry.rb:49:in `prepare!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/rendering/layout_registry.rb:24:in `initialize' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/layout.rb:62:in `new' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/layout.rb:62:in `registry' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/layout.rb:114:in `load_registry!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/layout.rb:105:in `load!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/configuration.rb:422:in `block in load!' /Users/mitsubosh/.rbenv/versions/2.7.0/lib/ruby/2.7.0/set.rb:328:in `each_key' /Users/mitsubosh/.rbenv/versions/2.7.0/lib/ruby/2.7.0/set.rb:328:in `each' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view/configuration.rb:422:in `load!' /Users/mitsubosh/Practice/043_hanami/bookshelf/vendor/bundle/ruby/2.7.0/gems/hanami-view-1.3.2/lib/hanami/view.rb:264:in `load!' (eval):1:in `block (2 levels) in