Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ci for Ruby 3.1 * Don't start SimpleCov more than once In Ruby >= 3.1 it is an error to call `SimpleCov.start` more than once (see simplecov-ruby/simplecov#1003). This commit changes the shared configuration files to call `SimpleCov.configure` instead of `SimpleCov.start`, to work around this issue. * Fix issue with dates in YAML config with Ruby >= 3.1 This commit fixes a issue #2614. In middleman <= 4.4.3, if your YAML config file has something that looks like an date (in ISO format), then you get the error YAML Exception ...: Tried to load unspecified class: Date Including a properly formatted date in the frontmatter is a fairly common use-case. This happens Ruby 3.1 upgraded the included YAML library [Psych] to the 4.x branch, which changes `YAML.load` to call `Psych.safe_load` instead of `Psych.unsafe_load`. This means it no longer parses dates unless it's provided with `permitted_classes: [Date, ...]`. The currently released versions of middleman (4.4.3 and 5.0.0-rc1) call `YAML.load`, so the behavour depends on your ruby version. This commit fixes things by using `YAML.safe_load` instead of `YAML.load`, and allowing dates. Note that we have to do some introspection of the arguments to YAML.safe_load to name the keyword argument correctly, because in older versions of Ruby this argument had a different name or wasn't a keyword argument [[1]], and we want to retain support for those old versions. [Psych]: https://github.com/ruby/psych [1]: ruby/psych@682abf2
- Loading branch information