From a31cd7e6a9f4233a36b30413c19c32b17af9ce43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Hangh=C3=B8j=20Iversen?= Date: Fri, 22 Nov 2019 11:11:59 +0100 Subject: [PATCH] Hello world --- BACKLOG.md | 6 ++++++ README.md | 15 +++++++++++++++ zdi.el | 31 +++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 BACKLOG.md create mode 100644 README.md create mode 100644 zdi.el diff --git a/BACKLOG.md b/BACKLOG.md new file mode 100644 index 0000000..1a3b4df --- /dev/null +++ b/BACKLOG.md @@ -0,0 +1,6 @@ +# Source `zdi.sh` on startup. +# Have `zdi help_center -d` running as a daemon +Run a `help_center` shell in the background as a server and send +commands to it. That way we should be able to re-run RSpec way faster +because we don't suffer the overhead of whatever ZDI and Docker needs +to do to get up and running. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b614253 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Emacs integration for ZDI + +A small utility for running rspec directly from the comfort of emacs. +It’s just a first rough version that works for developing on help +center. I haven’t made it super configurable. You should modify it +to your own needs or make it more configurable and send a PR. + +It allows you to go to an rspec file in help center and run the RSpec +on it by doing `M-x compile`. + +## Installation + + (add-to-list 'load-path PATH-TO-ZDI) + (require zdi) + (add-hook 'ruby-mode-hook 'zdi-set-compile-command) diff --git a/zdi.el b/zdi.el new file mode 100644 index 0000000..0d327e7 --- /dev/null +++ b/zdi.el @@ -0,0 +1,31 @@ +;;; Jira --- A simple wrapper around ZDI + +;;; Commentary: + +;;; Emacs integration for ZDI. + +;;; Code: + +(provide 'zdi) +(require 'projectile) + +(defun projectile-get-relative-path-buffer () + "Get the project-relative path of the current buffer." + (file-relative-name buffer-file-name (projectile-project-root))) + +(defvar zdi-build-command-format + "source ~/git/zendesk/zdi/dockmaster/zdi.sh +function strip-colors() { + gsed -r \"s/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g\" +} + +zdi help_center -d run bundle exec rspec %s | strip-colors +") + +(defun zdi-set-compile-command () + "Set the command used to compile your project to run rspec through zdi." + + (set (make-local-variable 'compile-command) + (format zdi-build-command-format (projectile-get-relative-path-buffer)))) + +;;; zdi.el ends here