Shard Detail

todo_or_cry v0.1.0

Write TODOs in code that you actually have to fix

Install & Use

Add the following code to your project's shard.yml under:

dependencies to use in production
- OR -
development_dependencies to use in development


todo_or_cry:
  github: citizen428/todo_or_cry

Readme

TODO Or Cry! Build Status

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

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      todo_or_cry:
        github: your-github-user/todo_or_cry
    
  2. Run shards install

Usage

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!

Contributing

  1. Fork it (https://github.com/citizen428/todo_or_cry/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors