holidays / holidays

A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove incorrect comments from generated definitions

ppeble opened this issue Β· comments

I'm finding all sorts of stuff as I work on #251! πŸ˜„

When we generate the final ruby class definitions we are including incorrect information in the comments that are added. Specifically, these lines:

Here is what it says (using :ar as an example):

  # To use the definitions in this file, load it right after you load the
  # Holiday gem:
  #
  #   require 'holidays'
  #   require 'generated_definitions/ar'

This is simply not true anymore. We should remove it from the source generator. Relevant lines: https://github.com/holidays/holidays/blob/master/lib/holidays/definition/context/generator.rb#L238-L243

I would do this myself but I want to limit the changes I am making for #251 if possible. And this is good for beginners looking for a way into OSS. πŸ˜„

Do you just want those lines removed? are there other files affected by this?

Really the only thing you need to do is remove the lines from the 'generator' that I linked. What we do is read the definitions (which are yaml files, found here: https://github.com/holidays/definitions) and we generate the final Ruby classes. Then we package those up in the gem and use those. This way we don't have to parse and process YAML on the fly.

So in this case just removing the lines from the generator I linked will do it! When I release the gem next I will regenerate the ruby classes and the offending lines will be gone.

I'm not even sure if any tests will fail because this is one of the last places that doesn't have good test coverage. πŸ˜„

Thanks for taking any interest! We appreciate it.

One last bit, hopefully this makes it clearer: the Rakefile has lines that call the generator. It produces a bunch of text that the Rakefile then writes out to the final files. This is how we end up with /lib/generated_definitions. It's run manually by maintainers when we want to release.

Hope this makes sense! Let me know if you have any questions or want to learn more.

@ppeble Thanks for the explanation. This is pretty cool and I think it may have solved an unrelated question I had as well!!! πŸ₯‡

I sent a PR with the removed lines.

This was addressed by #272, closing this issue.