Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

elgusy
Copy link

@elgusy elgusy commented Oct 14, 2018

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.

dante.el Outdated
(-> (-concat '("") obelisk-root-folder `(,folder-name ""))
(string-join "/")
(file-directory-p)))
'("backend" "common" "config" "frontend" "static"))
Copy link

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.

Copy link
Author

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"))
Copy link

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?

Copy link
Author

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

Copy link

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)?

Copy link
Author

@elgusy elgusy Oct 22, 2018

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.

@elgusy elgusy changed the title Checks if it obelisk a project Checks if it's an obelisk project Oct 15, 2018
@bidigo
Copy link

bidigo commented Jan 10, 2019

Any timeline when/if is this going to be merged?

@jyp
Copy link
Owner

jyp commented Jan 11, 2019

@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 dante-methods-alist. Let me know.

@jyp jyp closed this Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants