waiting-for-dev / front_matter_parser

Ruby library to parse files or strings with a front matter. It has automatic syntax detection.
MIT License
105 stars 12 forks source link

Ruby 2.5 compatibility #12

Closed pablobm closed 3 years ago

pablobm commented 3 years ago

The recent change at https://github.com/waiting-for-dev/front_matter_parser/pull/11 unfortunately broke this library for Ruby 2.5 and prior. We had some momentary CI issues over at Administrate (eg: https://github.com/thoughtbot/administrate/pull/2023) due to this, showing the following error:

Failure/Error: YAML.safe_load(string, permitted_classes: allowlist_classes)

ArgumentError:
  unknown keyword: permitted_classes
# ./lib/front_matter_parser/loader/yaml.rb:22:in `call'
# ./lib/front_matter_parser/parser.rb:67:in `call'

Having said that... Ruby 2.5 is now End-of-Life, so perhaps you don't wish to support it any more and prefer to close this PR.

But! :-) although we at Administrate may drop Ruby 2.5 soon, we haven't done it just yet. Other libraries that may depend on this gem may be in a similar situation, so perhaps this you'd consider this change as a stopgap measure while everyone adapts.

Either decision would probably be correct!

waiting-for-dev commented 3 years ago

Hi @pablobm, thanks for your contribution!

Having said that... Ruby 2.5 is now End-of-Life

Yeah, it was my reasoning. Supporting the same versions that Ruby does is probably the most sensible approach when balancing maintainability and backward-compatibility support.

On top of that, besides a renaming, this library has been stable since 2018, with no new features added. At this point, I'm neither planning to add anything new, as I think it does what it is supposed to do and nothing more. For these reasons, it's reasonably safe to fix your dependency to 1.0.0 as a temporary workaround until you deprecate 2.5.

Having said that, I won't have any problem if, at some point, it becomes a blocker for your project. So, I'm going to close it for now, but if at some point you do need it to be merged, please, ping me!

pablobm commented 3 years ago

Sounds good! Thank you for your thoughts.