Last active
August 29, 2015 14:13
-
-
Save abhiyerra/5622d86de25c9d503083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Need to convert this to Emacs Lisp. But this should show the issues. | |
curl -u "username:password" "https://api.github.com/orgs/workmachine/issues?filter=created&state=open" | jq '.[] | @text "\(.repository.name) - \(.title) \(.html_url)"' | sed -e 's/"//g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq ay/my-jiras (shell-command-to-string "curl -u \"username:password\" -s -X GET -H \"Content-Type: application/json\" \"https://location.of.jira.com:/rest/api/2/search?jql=status+%21%3D+Closed+AND+status+%21%3D+Done+AND+assignee+in+%28ayerra%29\"")) | |
(defun ay/jira-state-to-org-state (status) | |
(cond ((string= status "In Review") "WAITING") | |
((string= status "Resolved") "DONE") | |
((string= status "Reopened") "NEXT-ACTION") | |
((string= status "In Progress") "STARTED") | |
((string= status "Open") "PLAN") | |
(t status))) | |
(defun ay/org-generate-jira () | |
(setq ay/my-jira-j (let ((json-object-type 'plist)) | |
(json-read-from-string ay/my-jiras))) | |
(mapconcat | |
(lambda (issue) | |
(let ((key (plist-get issue :key)) | |
(priority (plist-get (plist-get (plist-get issue :fields) :priority) :name)) | |
(issuetype (plist-get (plist-get (plist-get issue :fields) :issuetype) :name)) | |
(status (plist-get (plist-get (plist-get issue :fields) :status) :name)) | |
(assignee (plist-get (plist-get (plist-get issue :fields) :assignee) :displayName)) | |
(summary (plist-get (plist-get issue :fields) :summary))) | |
(concat (format "** %s %s :%s:\n" (ay/jira-state-to-org-state status) summary issuetype ) | |
" :PROPERTIES:\n" | |
(format " :JIRA: %s\n" key) | |
" :END:\n"))) | |
(plist-get ay/my-jira-j :issues) "")) | |
(ay/org-generate-jira) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq org-agenda-custom-commands | |
'(("W" "Next Actions Work" | |
tags-todo "work+TODO=\"NEXT-ACTION\"" | |
((org-agenda-sorting-strategy '(deadline-up priority-up)))) | |
("P" "Next Actions Personal" | |
tags-todo "personal+TODO=\"NEXT-ACTION\"" | |
((org-agenda-sorting-strategy '(deadline-up)))) | |
("c" "Next Actions Code" | |
tags-todo "code+TODO=\"NEXT-ACTION\"" | |
((org-agenda-sorting-strategy '(deadline-up)))) | |
("w" "Next Actions Weekend and with Corrie" | |
tags-todo "corrie+TODO=\"NEXT-ACTION\"|weekend+TODO=\"NEXT-ACTION\"" | |
((org-agenda-sorting-strategy '(deadline-up)))) | |
("D" "Upcoming Deferred Actions" todo "DEFERRED" | |
((org-agenda-sorting-strategy '(scheduled-up deadline-up)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar emacs-dayone-cmd "/usr/local/bin/dayone new") | |
(defvar emacs-dayone-succes-reg "^New entry :") | |
(defun ay/org-archive-to-dayone () | |
"Archive org-mode subtree to DayOne." | |
(interactive) | |
(org-back-to-heading) | |
(let* ((tmp-file (make-temp-file "emacs-dayone")) | |
(cmd (format "%s < %s" emacs-dayone-cmd tmp-file)) | |
(title (nth 4 (org-heading-components))) | |
(tags (nth 5 (org-heading-components))) | |
(content (concat (if title (format "# %s\n\n" title) "") | |
(if tags (format "%s\n\n" tags) "") | |
(org-export-as 'md t nil t nil)))) | |
(with-temp-file tmp-file (insert content)) | |
(if (string-match emacs-dayone-succes-reg (shell-command-to-string cmd)) | |
(progn | |
(message "Success: contents saved") | |
(org-cut-subtree)) | |
(message "Failed: can't saved")) | |
(delete-file tmp-file) | |
(recenter-top-bottom))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq org-todo-keywords | |
'((sequence "TODO(t)" "PLAN(p)" "NEXT-ACTION(n)" "STARTED(s)" "WAITING(w@/!)" "DEFERRED(e)" "APPT" "|" "DONE(d!/!)" "CANCELLED(c@/!)"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment