Compare commits

...

3 commits

Author SHA1 Message Date
Frederik Hanghøj Iversen f71afc0160 Add dir-locals for some Z projects 2020-02-11 09:52:40 +01:00
Frederik Hanghøj Iversen 42f9790570 Add function to find spec file given naming convention in HC 2020-02-11 09:51:54 +01:00
Frederik Hanghøj Iversen f263264a77 Use --no-color option of rspec 2020-02-11 09:51:33 +01:00
4 changed files with 17 additions and 8 deletions

View file

@ -0,0 +1 @@
/Users/frederikhanghjiversen/git/zendesk/copenhagen_theme/.dir-locals.el

View file

@ -0,0 +1 @@
/Users/frederikhanghjiversen/git/zendesk/guide-acceptance-tests/.dir-locals.el

1
dir-locals/help_center.el Symbolic link
View file

@ -0,0 +1 @@
/Users/frederikhanghjiversen/git/zendesk/help_center/.dir-locals.el

22
zdi.el
View file

@ -13,14 +13,7 @@
"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
")
(defvar zdi-build-command-format "docker exec -it help_center bundle exec rspec --no-color %s")
(defun zdi-set-compile-command ()
"Set the command used to compile your project to run rspec through zdi."
@ -28,4 +21,17 @@ zdi help_center -d run bundle exec rspec %s | strip-colors
(set (make-local-variable 'compile-command)
(format zdi-build-command-format (projectile-get-relative-path-buffer))))
(defun zdi-find-spec-file ()
"Go to the spec file corresponding to the currently visited file.
Depends on file naming convention used in Help Center."
(interactive)
(find-file (zdi-build-spec-path (buffer-file-name))))
(defun zdi-build-spec-path (path)
"Guess the location of the spec file corresponding to PATH."
(replace-regexp-in-string
"\\(\\)\\.[^\\.]*$" "_spec"
(replace-regexp-in-string "\\(app\\).*\\'" "spec" path nil nil 1) nil nil 1))
;;; zdi.el ends here