Hello wonderful community!
Today we're happy to announce v1.3.0.beta1 release π , with the stable release (v1.3.0) scheduled for October 2018.
Release π»
The 1.3 series is a preparatory work for 2.0.
We care a lot about Semantic Versioning and to make the upgrade as smooth as possible for the next major release. This is why we took the change to focus only on stability and to introduce enhancements to ease the upgrade.
RSpec is the new default testing framework π
Back in the days, when I started Hanami (which used to be known as Lotus), the choice about the default testing framework fell on Minitest because it's lightweight and feels more rubyish (if this is a thing). I used a lot Minitest at that time, especially for gems.
But I recognized that I rarely used it for web apps. For this kind of Ruby code, the completeness of RSpec makes my life easier.
Because Hanami is an opinionated software, because we want to offer what we thing it's the best experience, we decided to promote RSpec as the default testing framework.
Since now on the following command will generate a new project with RSpec:
$ hanami new bookshelf
For those who want to use Minitest:
$ hanami new bookshelf --test=minitest
Deprecations π
Types π¦
We deprecated Hanami::Utils::String and Hanami::Utils::Hash as Ruby objects to be instantiated.
Since 2.0 it won't be possible to do Hanami::Utils::String.new("foo").underscore anymore.
Please use the corresponding class method: Hanami::Utils::String.underscore("foo").
From 2.0 these two classes will be turned into modules.
Inflector π
We deprecated Hanami::Utils::Inflector, Hanami::Utils::String.pluralize, and .singularize.
From future versions, Hanami will use dry-inflector.
Body parsers π
We deprecated body_parsers as setting in Hanami apps.
# apps/web/application.rb
module Web
class Application < Hanami::Application
configure do
# ...
body_parsers :json
end
end
end
Please use the new middleware:
# config/environment.rb
require "hanami/middleware/body_parser"
Hanami.configure do
# ...
middleware.use Hanami::Middleware::BodyParser, :json
end
Force SSL πͺ
We deprecated force_ssl as setting in Hanami apps.
# apps/web/application.rb
module Web
class Application < Hanami::Application
configure do
# ...
force_ssl true
end
end
end
Please the corresponding webserver (eg. Nginx) feature, a Rack middleware (eg. rack-ssl), or another strategy to force HTTPS connection.
Action's parsed_body π«
We deprecated Hanami::Action#parsed_body, and it will be removed in future releases of Hanami.
Minor Enhancements π
- Preserve directory structure of assets at the precompile time
- Generate actions/views/mailers with nested module/class definition
- CLI: Introduce array type for arguments (
foo exec test spec/bookshelf/entities spec/bookshelf/repositories) - CLI: Introduce array type for options (
foo generate config --apps=web,api) - CLI: Introduce variadic arguments (
foo run ruby:latest -- ruby -v)
Bug Fixes π
- Make possible to pass extra settings for custom logger instances (eg.
logger SemanticLogger.new, :foo, :bar) - Ensure
hanami generate appto work withoutrequire_relativeentries inconfig/enviroment.rb - Fixed regression for
hanami new .that used to generate a broken project - Don't use thread unsafe
Dir.chdirto serve static assets - Ensure that if
If-None-MatchorIf-Modified-Sinceresponse HTTP headers are missing,EtagorLast-Modifiedheaders will be in response HTTP headers. - Don't show flash message for the request after a HTTP redirect.
- Ensure
Hanami::Action::Flash#each,#map, and#empty?to not reference stale flash data. - Ensure to set
:disable_escapeoption only forslimand don't lettiltto emit a warning for other template engines - Ensure partial rendering to respect
formatoverriding - Print informative message when unknown or wrong option is passed to CLI commands
Released Gems π
hanami-1.3.0.beta1hanami-model-1.3.0.beta1hanami-assets-1.3.0.beta1hanami-cli-0.3.0.beta1hanami-mailer-1.3.0.beta1hanami-helpers-1.3.0.beta1hanami-view-1.3.0.beta1hamami-controller-1.3.0.beta1hanami-router-1.3.0.beta1hanami-validations-1.3.0.beta1hanami-utils-1.3.0.beta1
How to try it β¨οΈ
gem install hanami --pre
hanami new bookshelf
What's next? β°
We'll release new beta versions, with enhancements, and bug fixes. The stable release is expected on October 2018, in the meantime, please try this beta and report issues.
Happy coding! πΈ