-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checks if it's an obelisk project #93
Conversation
dante.el
Outdated
(-> (-concat '("") obelisk-root-folder `(,folder-name "")) | ||
(string-join "/") | ||
(file-directory-p))) | ||
'("backend" "common" "config" "frontend" "static")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better check would be to see if the .obelisk/impl
directory exists. All obelisk projects have it by design; that's what the (project-specific) ob
commands use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srid, hi, yes much better. I didn't see that directory :) thanks. I've changed that line
(let* ((file-dir-as-list (--filter (not (string= "" it)) (split-string (file-name-directory default-directory) "/"))) | ||
(obelisk-folder-stucture? (--any? (-contains? file-dir-as-list it) '("backend" "common" "frontend")))) | ||
(when obelisk-folder-stucture? | ||
(let* ((obelisk-root-folder (--take-while (-none? (lambda (a) (string= it a)) '("backend" "common" "frontend")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should instead check for .obelisk/impl
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Let's say you've opened a file in /home/elgusy/stuff/obelisk/learning-reflex/frontend/src/my-lib/a.hs
. Then we check if one of ob's default source files containing folders (common, backend, frontend) is in this path. In case it is, we take a probable project's root directory and then finally we check/confirm if that root directory contains .obelisk/impl
folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't understand. What would happen if you check for existence of just .obelisk/impl
(instead of those source folders)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To check the existence of the folder .obelisk/impl
I need to provide its parent directory, the obelisk root folder, in my above example, - learning-reflex
. To track that root folder I check if either of the strings (common, backend, frontend) is contained in the opened source file's path.
Any timeline when/if is this going to be merged? |
@bidigo This PR was a bit to ad hoc. I wanted to have a generic way to search for root projects, which I've now implemented. You should be able to do what you want with a customization of |
Checks if it is an obelisk project (created with ob init). If it is the case dispatches the appropriate repl command (ob repl) in an appropriate project root directory.