From c858c74aa09667fbf899f587be816e8ad5e20d55 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 24 May 2026 07:45:14 -0500 Subject: refactor(linear): point config at the renamed pearl package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The linear-emacs package was renamed to pearl (~/code/pearl, feature pearl, all symbols pearl-*). Swapped every linear-emacs-* reference to pearl-* across linear-config.el (the use-package form, :load-path, the 26 :commands, the api-key/default-team-id/org-file-path vars, and the lazy-key advice targets pearl--graphql-request-async and pearl-check-setup), the dashboard launcher, and the two test files. Kept the Linear-domain naming intact, since pearl is just a client for the Linear service: the C-; L prefix, the cj/linear-* wrapper helpers, the "Linear" dashboard label, the api.linear.app authinfo host, and the data/linear.org synced file are unchanged. Verified the wiring in a live daemon — pearl loads, the team id and org-file path apply, and the key advice installs on both entry points. --- tests/test-dashboard-config-launchers.el | 2 +- tests/test-linear-config.el | 52 ++++++++++++++++---------------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'tests') diff --git a/tests/test-dashboard-config-launchers.el b/tests/test-dashboard-config-launchers.el index f6dfb042..cb925075 100644 --- a/tests/test-dashboard-config-launchers.el +++ b/tests/test-dashboard-config-launchers.el @@ -94,7 +94,7 @@ Slack and Linear sharing the last row." ((symbol-function 'cj/erc-switch-to-buffer-with-completion) (lambda (&rest _) (push 'irc calls))) ((symbol-function 'cj/slack-start) (lambda (&rest _) (push 'slack calls))) ((symbol-function 'cj/telega) (lambda (&rest _) (push 'tg calls))) - ((symbol-function 'linear-emacs-list-issues) (lambda (&rest _) (push 'linear calls)))) + ((symbol-function 'pearl-list-issues) (lambda (&rest _) (push 'linear calls)))) (cj/dashboard--bind-launchers map) (dolist (key test-dash--keys) (call-interactively (keymap-lookup map key))) diff --git a/tests/test-linear-config.el b/tests/test-linear-config.el index ece4cefe..97d94bc4 100644 --- a/tests/test-linear-config.el +++ b/tests/test-linear-config.el @@ -1,9 +1,9 @@ ;;; test-linear-config.el --- Tests for linear-config.el -*- lexical-binding: t; -*- ;;; Commentary: -;; Covers the lazy API-key loader and the keybinding wiring. linear-emacs +;; Covers the lazy API-key loader and the keybinding wiring. pearl ;; itself is never loaded here (it's a deferred :load-path package), so -;; `linear-emacs-api-key' is declared special below to make the dynamic +;; `pearl-api-key' is declared special below to make the dynamic ;; let-bindings reach `cj/linear--ensure-api-key'. `cj/auth-source-secret-value' ;; is stubbed — no authinfo.gpg / GPG access in the tests. @@ -13,74 +13,74 @@ (require 'cl-lib) (require 'linear-config) -;; linear-config declares this with a bare (defvar linear-emacs-api-key), which +;; linear-config declares this with a bare (defvar pearl-api-key), which ;; is only file-local; declare it special here so the let-bindings are dynamic. -(defvar linear-emacs-api-key nil) +(defvar pearl-api-key nil) (ert-deftest test-linear-ensure-api-key-loads-when-unset () "Normal: an unset key is loaded from auth-source." - (let ((linear-emacs-api-key nil)) + (let ((pearl-api-key nil)) (cl-letf (((symbol-function 'cj/auth-source-secret-value) (lambda (&rest _) "lin_api_test"))) (cj/linear--ensure-api-key) - (should (equal linear-emacs-api-key "lin_api_test"))))) + (should (equal pearl-api-key "lin_api_test"))))) (ert-deftest test-linear-ensure-api-key-keeps-existing () "Boundary: an already-set key is neither overwritten nor re-fetched." - (let ((linear-emacs-api-key "already-set") (fetched nil)) + (let ((pearl-api-key "already-set") (fetched nil)) (cl-letf (((symbol-function 'cj/auth-source-secret-value) (lambda (&rest _) (setq fetched t) "other"))) (cj/linear--ensure-api-key) - (should (equal linear-emacs-api-key "already-set")) + (should (equal pearl-api-key "already-set")) (should-not fetched)))) (ert-deftest test-linear-ensure-api-key-nil-when-absent () "Boundary: a missing authinfo entry leaves the key nil without error." - (let ((linear-emacs-api-key nil)) + (let ((pearl-api-key nil)) (cl-letf (((symbol-function 'cj/auth-source-secret-value) (lambda (&rest _) nil))) (cj/linear--ensure-api-key) - (should-not linear-emacs-api-key)))) + (should-not pearl-api-key)))) (ert-deftest test-linear-install-key-advice-loads-before-check-setup () - "Error-regression: `linear-emacs-check-setup' loads the key before reading it. + "Error-regression: `pearl-check-setup' loads the key before reading it. The lazy loader originally only advised the GraphQL request entry point, so -`check-setup' — which reads `linear-emacs-api-key' directly without making a +`check-setup' — which reads `pearl-api-key' directly without making a request — falsely reported \"not set\" on a fresh session." - (let ((linear-emacs-api-key nil) + (let ((pearl-api-key nil) (key-at-read :unread)) (cl-letf (((symbol-function 'cj/auth-source-secret-value) (lambda (&rest _) "lin_api_test")) - ((symbol-function 'linear-emacs--graphql-request-async) + ((symbol-function 'pearl--graphql-request-async) (lambda (&rest _) nil)) - ((symbol-function 'linear-emacs-check-setup) - (lambda () (setq key-at-read linear-emacs-api-key)))) + ((symbol-function 'pearl-check-setup) + (lambda () (setq key-at-read pearl-api-key)))) (cj/linear--install-key-advice) (unwind-protect (progn - (linear-emacs-check-setup) + (pearl-check-setup) (should (equal key-at-read "lin_api_test"))) - (advice-remove 'linear-emacs--graphql-request-async + (advice-remove 'pearl--graphql-request-async #'cj/linear--ensure-key-before) - (advice-remove 'linear-emacs-check-setup + (advice-remove 'pearl-check-setup #'cj/linear--ensure-key-before))))) (ert-deftest test-linear-keymap-bound-under-prefix () "Smoke: C-; L holds the linear keymap and the entry commands are bound." (should (keymapp cj/linear-keymap)) (should (eq (keymap-lookup (current-global-map) "C-; L") cj/linear-keymap)) - (should (eq (keymap-lookup cj/linear-keymap "l") #'linear-emacs-list-issues)) - (should (eq (keymap-lookup cj/linear-keymap "n") #'linear-emacs-new-issue)) + (should (eq (keymap-lookup cj/linear-keymap "l") #'pearl-list-issues)) + (should (eq (keymap-lookup cj/linear-keymap "n") #'pearl-new-issue)) ;; commands added in the package rework - (should (eq (keymap-lookup cj/linear-keymap "f") #'linear-emacs-list-issues-filtered)) - (should (eq (keymap-lookup cj/linear-keymap "v") #'linear-emacs-run-view)) - (should (eq (keymap-lookup cj/linear-keymap "o") #'linear-emacs-open-current-issue))) + (should (eq (keymap-lookup cj/linear-keymap "f") #'pearl-list-issues-filtered)) + (should (eq (keymap-lookup cj/linear-keymap "v") #'pearl-run-view)) + (should (eq (keymap-lookup cj/linear-keymap "o") #'pearl-open-current-issue))) (ert-deftest test-linear-edit-submap-bound () "Smoke: C-; L e holds the edit-issue sub-keymap with field commands." (should (keymapp cj/linear-edit-keymap)) (should (eq (keymap-lookup cj/linear-keymap "e") cj/linear-edit-keymap)) - (should (eq (keymap-lookup cj/linear-edit-keymap "a") #'linear-emacs-set-assignee)) - (should (eq (keymap-lookup cj/linear-edit-keymap "s") #'linear-emacs-set-state))) + (should (eq (keymap-lookup cj/linear-edit-keymap "a") #'pearl-set-assignee)) + (should (eq (keymap-lookup cj/linear-edit-keymap "s") #'pearl-set-state))) (provide 'test-linear-config) ;;; test-linear-config.el ends here -- cgit v1.2.3