New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for cron schedules to be expressed using fugit natural language parsing #441
Allow for cron schedules to be expressed using fugit natural language parsing #441
Conversation
This allows using something like [fugit natual language parsing](https://github.com/floraison/fugit#fugitnat)
@bensheldon I did two iterations on this: the first that assumed the user would supply the ^ That's the reason for the 2 commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! I like the version that still takes a string, but with a broader syntax. I left one comment about surfacing the ArgumentError earlier in execution.
Let me know your thoughts on that and I'll merge this 🙌🏻
lib/good_job/cron_entry.rb
Outdated
@fugit ||= begin | ||
parsed_cron = Fugit.parse(cron) | ||
|
||
raise ArgumentError, "Invalid cron format: '#{cron}'" unless parsed_cron.instance_of?(Fugit::Cron) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this ArgumentError would be clearer if placed in #initialize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree :) Updated. And fixed linting errors.
afe75c2
to
21d63fd
Compare
@bensheldon something like this? Please feel free to nitpick!
Closes #439