Maintaining a weekly planner using the weekly_planner gem

Here's the ResultX document which helps define what I want the gem to do:

feature: The weekly-planner.txt file will be kept up-to-date by the system
  To help remind me of important events
  As the project maintainer
  The weekly planner gem will help maintain and update the weekly-planner.txt file

scenario: Creating a new weekly planner
result: The weekly-planner.txt file is created
conditions: the weekly-planner.txt file doesn't exist

scenario: The weekly planner is archived
result: The archive directory including the archive file is created
conditions: The user adds an appointment to the weekly-planner.txt file

scenario: Refreshing the weekly planner to the current date
result: The 1st entry in the weekly planner is today
conditions: The system is accessed the following day

scenario: Updating the weekly planner from the archive
result: The new appointment appears in the weekly-planner.txt file
conditions: An appointment is added to the archived file directly

Creating a new weekly-planner.txt file

require 'weekly_planner'

wp = WeeklyPlanner.new 'weekly-planner.txt', path: '/tmp'
wp.save

Output:

There are 2 files output from the above example, those are weekly-planner.txt and weekly-planner.xml as shown below:

weekly-planner.txt
==================

Thursday, 10th Dec
------------------

Fri
---

Sat
---

Sun
---

Mon
---

Tue
---

Wed
---

<?xml version='1.0' encoding='UTF-8'?>
<sections>
  <summary>
    <title>Weekly Planner (10-Dec-2015)</title>
    <recordx_type>dynarex</recordx_type>
    <format_mask>[!x]</format_mask>
    <schema>sections[title]/section(x)</schema>
    <default_key>x</default_key>
  </summary>
  <records>
    <section id='20151210' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 10-Dec-2015
</x>
    </section>
    <section id='20151211' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 11-Dec-2015
</x>
    </section>
    <section id='20151212' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 12-Dec-2015
</x>
    </section>
    <section id='20151213' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 13-Dec-2015
</x>
    </section>
    <section id='20151214' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 14-Dec-2015
</x>
    </section>
    <section id='20151215' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 15-Dec-2015
</x>
    </section>
    <section id='20151216' created='2015-12-10 19:59:53 +0000' last_modified=''>
      <x># 16-Dec-2015
</x>
    </section>
  </records>
</sections>

In addition to that there's an archive directory created for the current year, and it contains the weekly planner files by week.

Updating the weekly planner

To update the weekly planner, using a text editor open the weekly-planner.txt file and add 1 or more entries under a day heading. Then run the code from above again and it will update the archive for you. Also, the weekly-planner.xml file will be updated including the timestamp of when the record for each day was last updated.

A script could be run from a task scheduler or cronjob to run the weekly_planner gem daily to update the weekly-planner.txt to the current day including the week ahead.