-
-
Notifications
You must be signed in to change notification settings - Fork 651
cider-connect: auto-detect ssh hosts and all running repls on local and remote hosts
#808
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
Conversation
46e3e03 to
180361b
Compare
cider.el
Outdated
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 function is way too complex IMO and should be broken up into several functions.
It certainly won't. We have plenty of Windows users and should avoid Unix-specific stuff. There has to be a more portable way to do this. |
|
Also - when this is broken down into smaller units of work at least some of them should be unit tested. |
|
Well it should work on Linux and Mac and we have plenty of those. Windows users will have the same functionality as they had before. This is uniformly better. To adapt that to Windows one would need 1) process listing command 2) regexp change. That should be an easy task for any Windows user. I expect someone to contribute this very soon. I am not a Windows user and have no capability to figure that out. Moreover, for remote functionality we already rely on ssh tunneling. I would guess that doesn't work on Windows either. |
|
Also note that once technomancy/leiningen#1686 is fixed this hack won't be necessary. So I would better focus on an user interaction side right now. |
Well, I don't use Windows, so I can live without support for it. :-)
Hadn't thought about this. Guess this tunnelling support should be documented somewhere, because likely few people know it exists. Break up the code into smaller bits and I'll have a look at it. |
cider.el
Outdated
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.
leinengen -> leiningen
180361b to
0483a4e
Compare
I have looked into that and it's not easy. Everything is interconnected. So I have simplified it as mush as I could, gave self-documenting names to all locals and inline-documented the code. Should be pretty clear what it does right now. I have also extracted the |
45dbe00 to
e47ed82
Compare
cider.el
Outdated
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.
Inlining code that complex in a let reduces readability a lot. Extracting this would be easy.
I've always understood what the code does, but that's not the point. I'm certain in can be simplified by extracting portions of that monstrous |
ba907ca to
f394489
Compare
|
Ok, I have extracted the pieces out. |
|
In the commit message:
|
cider.el
Outdated
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.
Btw, leiningen is not the only tool that writes a .nrepl-port file. Immutant also does so, maybe others 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.
Btw, leiningen is not the only tool that writes a .nrepl-port file. Immutant also does so, maybe others as well.
Be it cider-locate-running-nrepl-ports then.
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.
Yeah, that's an OK name.
44e396d to
e4e8dd5
Compare
|
Done. I gave generic |
temp.el1
Outdated
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.
You should remove this file.
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.
Fixed. Thanks.
- `cider-connect` now interactively asks for host from a combined list of hosts from machine-wide ssh configuration and `cider-known-endpoints`. - Once the host has been selected `cider-connect` locates ports of the running instances of nREPL servers on the corresponding host (currently only those started with lein repl). The machine must have `ps` and `grep` programs in the bin path.
e4e8dd5 to
57ac604
Compare
`cider-connect`: auto-detect ssh hosts and all running repls on local and remote hosts
Two main changes:
cider-connectnow interactively asks for host from a combined list ofmachine-wide ssh configuration and
cider-known-endpoints.cider-connectlocates all running instancesof lein servers. The machine must have
psandgrepprograms in the binpath.
The algorithm lists user processes with
psand retrives lein paths , then searches fornrepl-portfiles. This detection works fine if you run one server per project. If you run more servers at the same time lein will overwrite that file and will eventually delete it on first server exit. Hopefully this issue will be sorted soon in technomancy/leiningen#1686.It will probably not work on windows out of the box, but should not break anything.