Introducing the reminders_txt gem
The reminders_txt gem makes it convenient to store reminders in a plain text file called reminders.txt. It can read reminder dates to sort reminders in reverse chronological order, as well as remove expired reminders, and set new dates for recurring reminders.
require 'reminders_txt'
filepath = '/home/james/jamesrobertson.eu/reminders/reminders.txt'
rt = RemindersTxt.new(filepath)
puts rt.to_s
file: reminders.txt
reminders.txt ============= Hamster's birthday 2nd Nov * Meeting in room 3 5th Nov Meeting in room 5 14th Nov green bin out every 2nd Monday (starting 7th Nov 2016) mother's day 14th April * Networking X meeting 26th Feb Valentine's Day 14th Feb *
output:
reminders.txt ============= Meeting in room 5 14th Nov green bin out every 2nd Monday (starting 21st Nov 2016) Valentine's Day 14th Feb * Networking X meeting 26th Feb mother's day 14th April * Hamster's birthday 2nd Nov *
The reminders.xml file shown below maintains a working copy of the most recent reminders and makes it convient to query a reminder by title, date, etc.
file: reminders.xml
<?xml version='1.0' encoding='UTF-8'?> <reminders> <summary> <recordx_type>dynarex</recordx_type> <format_mask>[!input] [!title] [!recurring] [!date] [!end_date]</format_mask> <schema>reminders/reminder(input, title, recurring, date, end_date)</schema> <default_key>input</default_key> </summary> <records> <reminder id='1' created='2016-11-11 12:24:27 +0000' last_modified=''> <input>Meeting in room 5 14th Nov</input> <title>Meeting in room 5</title> <recurring/> <date>2016-11-14 12:00:00 +0000</date> <end_date/> </reminder> <reminder id='2' created='2016-11-11 12:24:27 +0000' last_modified=''> <input>green bin out every 2nd Monday (starting 21st Nov 2016)</input> <title>green bin out </title> <recurring>every 2nd Monday</recurring> <date>2016-11-21 12:00:00 +0000</date> <end_date/> </reminder> <reminder id='3' created='2016-11-11 12:24:27 +0000' last_modified=''> <input>Valentine's Day 14th Feb *</input> <title>Valentine's Day</title> <recurring/> <date>2017-02-14 12:00:00 +0000</date> <end_date/> </reminder> <reminder id='4' created='2016-11-11 12:24:27 +0000' last_modified=''> <input>Networking X meeting 26th Feb</input> <title>Networking X meeting</title> <recurring/> <date>2017-02-26 12:00:00 +0000</date> <end_date/> </reminder> <reminder id='5' created='2016-11-11 12:24:27 +0000' last_modified=''> <input>mother's day 14th April *</input> <title>mother's day</title> <recurring/> <date>2017-04-14 12:00:00 +0100</date> <end_date/> </reminder> <reminder id='6' created='2016-11-11 12:24:27 +0000' last_modified=''> <input>Hamster's birthday 2nd Nov *</input> <title>Hamster's birthday</title> <recurring/> <date>2017-11-02 12:00:00 +0000</date> <end_date/> </reminder> </records> </reminders>
Resources
- reminders_txt https://rubygems.org/gems/reminders_txt
reminders gem reminderstxt reminders_txt events