Module: Plansheet

Defined in:
lib/plansheet.rb,
lib/plansheet/pool.rb,
lib/plansheet/time.rb,
lib/plansheet/project.rb,
lib/plansheet/version.rb,
lib/plansheet/sheet/daily.rb,
lib/plansheet/sheet/latex.rb,
lib/plansheet/project/yaml.rb,
lib/plansheet/sheet/weekly.rb,
lib/plansheet/sheet/monthly.rb,
lib/plansheet/project/stringify.rb,
lib/plansheet/sheet/latex_utils.rb

Defined Under Namespace

Modules: LaTeXMixins, PlansheetArray, TimeUtils Classes: DailyLaTeXSheet, Error, LaTeXSheet, MonthlyLaTeXSheet, Pool, Project, ProjectYAMLFile, WeeklyLaTeXSheet

Constant Summary collapse

PROJECT_STATUS_PRIORITY =
{
  "wip" => 1,
  "ready" => 2,
  "blocked" => 3,
  "waiting" => 4,
  "planning" => 5,
  "idea" => 6,
  "paused" => 7,
  "dropped" => 8,
  "done" => 9
}.freeze
NEXT_DOW =

Pre-compute the next days-of-week

0.upto(6).to_h do |x|
  d = Date.today + x
  [d.strftime("%A"), d]
end.freeze
VERSION =
"0.34.1"
YAML_TIME_REGEX =

Once there’s some stability in plansheet and dc-kwalify, will pre-load this to save the later YAML.load

"/\\d+[mh] ?\d*m?/"
YAML_DATE_REGEX =

TODO: regex is bad, adjust for better handling of pretty time

"/\\d+[dw]/"
PROJECT_YAML_SCHEMA =
<<~YAML
  desc: dc-tasks project schema
  type: seq
  sequence:
    - type: map
      mapping:
        "project":
          desc: Project name
          type: str
          unique: true
        "namespace":
          desc: Project name
          type: str
        "priority":
          desc: Project priority
          type: str
          enum:
            - high
            - medium
            - low
        "status":
          desc: The current status of the project
          type: str
          enum:
            - wip # project is a work-in-progress
            - ready # project has tasks, ready to go
            - waiting # project in waiting on some external person/event
            - blocked # project is blocked by another project, but otherwise ready/wip
            - planning # project in planning phase (set manually)
            - idea # project is little more than an idea
            - paused # project shouldn't be archived, but should be excluded from
                     # generated output unless paused projects are requested
            - dropped # project has been explicitly dropped, but
                      # want to keep around for reference, etc
            - done # project is finished, but want to keep around
                   # for reference, etc.
        "location":
          desc: Location
          type: str
        "notes":
          desc: Free-form notes string
          type: str
        "time_estimate":
          desc: The estimated amount of time before a project is completed
          type: str
          pattern: #{YAML_TIME_REGEX}
        "daily_time_roi":
          desc: The estimated amount of time saved daily by completing this project
          type: str
          pattern: #{YAML_TIME_REGEX}
        "weekly_time_roi":
          desc: The estimated amount of time saved daily by completing this project
          type: str
          pattern: #{YAML_TIME_REGEX}
        "yearly_time_roi":
          desc: The estimated amount of time saved daily by completing this project
          type: str
          pattern: #{YAML_TIME_REGEX}
        "day_of_week":
          desc: recurring day of week project
          type: str
          enum:
            - Sunday
            - Monday
            - Tuesday
            - Wednesday
            - Thursday
            - Friday
            - Saturday
        "frequency":
          desc: The amount of time before a recurring project moves to ready status again from when it was last done, with a set due date (eg. a bill becomes due)
          type: str
          pattern: #{YAML_DATE_REGEX}
        "last_for":
          desc: "The amount of time before a recurring project moves to ready status again from when it was last done, with a set defer date (eg. inflating a bike tire). If your project 'can't wait' a day or two, you should use frequency."
          type: str
          pattern: #{YAML_DATE_REGEX}
        "lead_time":
          desc: The amount of time before a recurring project is "due" moved to ready where the project (sort of a deferral mechanism) (WIP)
          type: str
          pattern: #{YAML_DATE_REGEX}
        "due":
          desc: Due date of the task
          type: date
        "defer":
          desc: Defer task until this day
          type: date
        "completed_on":
          desc: When the (non-recurring) project was completed
          type: date
        "dropped_on":
          desc: When the project was dropped
          type: date
        "paused_on":
          desc: When the project was paused
          type: date
        "created_on":
          desc: When the project was created
          type: date
        "starts_on":
          desc: For ICS (WIP)
          type: date
        "last_reviewed":
          desc: When the project was last reviewed (WIP)
          type: date
        "last_done":
          desc: When the recurring project was last completed (WIP)
          type: date
        "dependencies":
          desc: The names of projects that need to be completed before this project can be started/completed
          type: seq
          sequence:
            - type: str
        "externals":
          desc: List of external commitments, ie who else cares about project completion?
          type: seq
          sequence:
            - type: str
        "urls":
          desc: List of URLs that may be pertinent
          type: seq
          sequence:
            - type: str
        "tasks":
          desc: List of tasks to do
          type: seq
          sequence:
            - type: str
        "setup_tasks":
          desc: List of tasks needed before main project work begins
          type: seq
          sequence:
            - type: str
        "cleanup_tasks":
          desc: List of tasks needed before main project work begins
          type: seq
          sequence:
            - type: str
        "done":
          desc: List of tasks which have been completed
          type: seq
          sequence:
            - type: str
        "tags":
          desc: List of tags (WIP)
          type: seq
          sequence:
            - type: str
YAML
PROJECT_SCHEMA =
YAML.safe_load(PROJECT_YAML_SCHEMA)

Class Method Summary collapse

Class Method Details

.load_configObject

TODO: config schema validation



11
12
13
14
15
# File 'lib/plansheet.rb', line 11

def self.load_config
  YAML.load_file "#{Dir.home}/.plansheet.yml"
rescue StandardError
  abort "unable to load plansheet config file"
end