Skip to content
Edouard Chin edited this page Nov 25, 2019 · 8 revisions

ℹ️Events are what makes your TODO to expire and be reminded about it.

Here is the list of built-in events SmartTodo provide:

🕐date

date will expire your TODO on a specific date and time. This event expects one String argument and needs to be a correctly formatted date (parsable by Time.parse).

Example
# TODO(on: date('2019-08-07'), to: '...')
# TODO(on: date('2019/08/02'), to: '...')
# TODO(on: date('2019-08-02 16:54:00', to: '...')
# TODO(on: date('2019-08-02 16:54:00 +0000', to: '...')

:octocat: pull_request_close

pull_request_close will expire your TODO when a GitHub Pull Request is closed. This event expects three arguments. In order: The organisation name, the repository name, the PR number.

⚠️ If the repository is private, you'll need to expose a GitHub token in the environment with the repo scope. The token needs to be exposed in the SMART_TODO_GITHUB_TOKEN environment variable.

Example
# TODO(on: pull_request_close('rails', 'rails', 5431), to: '...')
# TODO(on: pull_request_close('rails', 'sprockets', 2233), to: '...')

:octocat: issue_close

issue_close will expire your TODO when a GitHub issue is closed. This event expects the exact same arguments as the pull_request_close above.

⚠️ Please see warning from the pull_request_close event above.

Example
# TODO(on: issue_close('rails', 'rails', 33521), to: '...')
# TODO(on: issue_close('rails', 'sprockets', 45678), to: '...')

💎gem_release

gem_release will expire your TODO when a gem is released on RubyGem to a specific version. This event expects the name of the gem and the version(s) specifiers. The version specifier syntax are the exact same as what you are used to from the Gemfile.

Example
# Expire your TODO when Rails 6.0 is released
# TODO(on: gem_release('rails', '6.0'), to: '...')  

# Expire your TODO when Rails get a new release in the 5.x.x series
# TODO(on: gem_release('rails', '> 5.2', '< 6'), to: '...')

# See the explanation of `~>` https://guides.rubygems.org/patterns/#pessimistic-version-constraint
# TODO(on: gem_release('rails', '~> 6.1'), to: '...')

💎gem_bump

gem_bump will expire your TODO when a gem inside your Gemfile.lock snapshot gets updated to a specific version. This event expects the name of the gem and the version(s) specifiers. The version specifier syntax are the exact same as what you are used to from the Gemfile.

Example
# Expire your TODO when Rails 6.0 is released
# TODO(on: gem_bump('rails', '6.0'), to: '...')  

# Expire your TODO when Rails get a new release in the 5.x.x series
# TODO(on: gem_bump('rails', '> 5.2', '< 6'), to: '...')

# See the explanation of `~>` https://guides.rubygems.org/patterns/#pessimistic-version-constraint
# TODO(on: gem_bump('rails', '~> 6.1'), to: '...')

More built-in event will be added as this gem mature and support for writing your own events will be added soon

Clone this wiki locally