Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
Crystal implementation of the TODO Or Die! Ruby gem by Justin Searls. Add TODOs in code that ensure you actually do them:
TodoOrCry["fix this", Time.utc(2019, 1, 1)]
def broken_method; end
# => raises TodoOrCry::OverdueError
Add the dependency to your shard.yml
:
dependencies:
todo_or_cry:
github: your-github-user/todo_or_cry
Run shards install
Require TodoOrCry
like this:
require "todo_or_cry"
Then whenever you have a todo item you want to make sure gets done, add a call to TodoOrCry.[]
:
TodoOrCry["fix this", Time.utc(2019, 1, 1)]
Nothing will happen before the due date, but afterwards a TodoOrCry::OverdueError
will be raised:
Unhandled exception: TODO: "fix this" came due on 2019-01-01. Do it! (TodoOrCry::OverdueError)
from foo.cr:4:3 in '__crystal_main'
The error message can be customized with .error_message=
:
TodoOrCry.error_message = "You have failed to do \"%s\" since %s"
# Raises
Unhandled exception: You have failed to do "fix this" since 2019-01-01 (TodoOrCry::OverdueError)
from foo.cr:4:3 in '__crystal_main'
To restore the standard error message, use .default_error_message!
:
TodoOrCry.default_error_message!
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)