changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / emacs/lib/scrum.el

changeset 642: f58f3b88c49e
parent: 6c0e4a44c082
child: af486e0a40c9
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 08 Sep 2024 21:14:30 -0400
permissions: -rw-r--r--
description: move project-info to scrum
1 ;;; scrum.el --- Scrum-like Planning and Roadmaps in Org -*- lexical-binding: t; -*-
2 
3 ;; Copyright (C) 2024 Richard Westhaver
4 
5 ;; Author: Richard Westhaver <richard.westhaver@gmail.com>
6 ;; Keywords: maint
7 
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
12 
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17 
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20 
21 ;;; Commentary:
22 
23 ;; The point of this package is to enable an Emacs-native scrum
24 ;; workflow. Many years ago I used to use the org-jira package and
25 ;; mirror an external scrum/agile system (Jira).
26 
27 ;; Mind you, I wouldn't dare take a shot at Jira. As far as Products
28 ;; go, when you need to work with hundreds of humans on software and
29 ;; are given a short list you must choose from, it's often the best of
30 ;; the worst.
31 
32 ;; The problem is however, that we don't need Products. What we need,
33 ;; is a plan. How we achieve that end should be via the best and most
34 ;; powerful tools possible.
35 
36 ;; In my opinion, Emacs Org Mode is the most powerful tool
37 ;; available. It is not quite the best tool for the job, but this
38 ;; isn't a problem because it is not a Product. We are given the
39 ;; opportunity to make it the best tool possible, in the only way
40 ;; possible - by doing it ourselves.
41 
42 ;; And yes, the aura of NIH syndrome may be strong here. Most of the
43 ;; time you need to work with lots of folks who don't have the need or
44 ;; patience to learn Org-mode. This package isn't for them. It's for
45 ;; small groups of like-minded Lispers :).
46 
47 ;; ref: https://www.scrum.org/resources/what-scrum-module
48 
49 ;; roadmap: https://compiler.company/plan/roadmap.html
50 
51 ;; tasks: https://compiler.company/plan/tasks
52 
53 ;;; Code:
54 (require 'ulang)
55 (require 'uml-mode)
56 
57 (defgroup scrum nil
58  "CC Scrum Framework.")
59 
60 (defvar scrum-properties '("SPRINT" "EPIC" "RELEASE" "TASKID" "PROJECT" "COMMIT" "GOAL"))
61 
62 (defvar scrum-tags '("demo" "mvp" "release" "major-release" "ua" "qa"))
63 
64 (defun org-dblock-write:scrumboard ()
65  "Generate a 'scrumboard'.")
66 
67 ;; TODO 2024-09-06: eplot
68 (defun org-dblock-write:burndown ()
69  "Generate a 'burndown' chart in the current buffer.")
70 
71 ;;; Projects
72 ;; defining 'project' machinery here because we don't have a better
73 ;; place to put it. These functions are intended to map projects
74 ;; from 'skel' and 'project.el' into our task-based org system.
75 
76 ;; Projects can contain many subprojects, which are identified by org
77 ;; headings with a 'PROJECT' todo keyword. Projects and sub-projects
78 ;; all have a 'VERSION' property assigned which can't be
79 ;; inherited. The 'PROJECT' property itself can be inherited.
80 
81 ;; project-info
82 (defcustom org-project-info-order '(details status tasks churn log files)
83  "Order in which sections of the 'project-info' dblock will appear."
84  :type 'list
85  :group 'scrum)
86 
87 (defun org-dblock-write:project-info (params)
88  "Generate a project-info section.
89 
90 The following keyword parameters can be passed to the info dynamic block:
91 
92 :location Set or override the project location which is inferred by
93  checking for a LOCATION property in the current tree, followed
94  by the value of the `project-current' function.
95 
96 :branch Set or override the project branch to display info for. Default
97  branch name is 'default'.
98 
99 :files When nil don't include the files table.
100 :churn When nil don't include the vc churn report.
101 :log when nil don't include the vc log.
102 :status when nil don't include vc status.
103 :details When nil don't include the project details section."
104  (let ((location (or (when-let ((param (plist-get params :location)))
105  (cl-coerce param 'string))
106  (org-entry-get (point) "LOCATION")
107  (when-let ((kw (org-collect-keywords '("LOCATION"))))
108  (cadar kw))
109  (project-root (project-current))))
110  (point (point))
111  (files (if-let ((val (plist-member params :files)))
112  (cadr val)
113  t))
114  (churn (if-let ((val (plist-member params :churn)))
115  (cadr val)
116  t))
117  (status (if-let ((val (plist-member params :log)))
118  (cadr val)
119  t))
120  (log (if-let ((val (plist-member params :status)))
121  (cadr val)
122  t))
123  (tasks (if-let ((val (plist-member params :tasks)))
124  (cadr val)
125  t))
126  (details (if-let ((val (plist-member params :details)))
127  (cadr val)
128  t)))
129  (message "Generating info for project: %s" location)
130  (let* ((project (project-current nil location))
131  (project-name (project-name project))
132  (project-root (project-root project)))
133  (dolist (i org-project-info-order)
134  (pcase i
135  ('details (when details
136  (message "building project details...")
137  (insert "#+CALL: project-details() :dir " project-root "\n")
138  (org-babel-execute-maybe)
139  (org-table-align)))
140  ('status (when status
141  (message "building project status...")
142  (insert "#+CALL: hg-status() :dir " project-root "\n")))
143  ('tasks (when tasks
144  (message "building project tasks...")
145  (insert "#+CALL: project-tasks() :dir " project-root "\n")))
146  ('churn (when churn
147  (message "building project vc churn...")
148  (insert "#+CALL: hg-churn() :dir " project-root "\n")))
149  ('log (when log
150  (message "building project vc log...")))
151  ('files (when files
152  (message "building project file table...")
153  (insert "#+CALL: project-files() :dir " project-root "\n")))))
154  (org-babel-execute-region point (point)))))
155 
156 (defun org-project-info ()
157  "Insert or update a project-info dblock."
158  (interactive)
159  (if (re-search-forward (rx bol "#+BEGIN:" (+ space) "project-info") nil t)
160  (progn
161  (if (fboundp 'org-fold-show-entry)
162  (org-fold-show-entry)
163  (with-no-warnings (org-show-entry)))
164  (beginning-of-line))
165  (org-create-dblock (list :name "project-info")))
166  (org-update-dblock))
167 
168 (provide 'scrum)
169 ;;; scrum.el ends here