defunkt / cijoe

CI Joe is a fun Continuous Integration server. Unmaintained.
MIT License
1.05k stars 129 forks source link

Multi-project support broken? #7

Closed roidrage closed 15 years ago

roidrage commented 15 years ago

Just tried setting up two git repositories using a rackup file, and failed bitterly. Even though the support seems to be there to run multiple projects within one Joe process, I don't think that's possible at the moment, unless I understood something completely wrong.

I looked through the source, and it seems the reason for that is rather simple. When a CIJoe instance is initialized Dir.chdir is supposed to change the current working directory to the project's directory. The problem with multiple projects is that it only works for the first one with relative path and is sure to wreak havoc when used with absolute paths, because it sets the current directory for the whole process, so all commands from project A will be run in the directory of project B, or worst case, with relative paths Joe won't find the project, because expand_path is adding project A's project path to project B's relative path.

I'm not sure how to fix this properly, because it affects the Config class as well as the CIJoe code. One workaround would be to wrap all commands in a Dir.chdir block which resets the current directory after the given block was executed. That might be just enough to run a single commands without having different project builders interfere with each other. Though I'm not too sure yet how the Config class should be changed to work with that concept.

Any thoughts or pointers? I might be totally off here, but even my simple test failed bitterly, so maybe not.

dstrelau commented 15 years ago

I'm pretty sure this was working when I added the ability to run multiple projects. I'll have a look at it when I get home to the computer with that code on it.

roidrage commented 15 years ago

With the Dir.chdir code in effect I honestly can't imagine how it would work. I just added both directories, each a different git repository, and tried to open each project in the browser. The first one works fine, the second breaks, because Joe either can't find the directory (with relative paths) or borks with full paths because it's already in a different directory, that of the first one.

Thanks for looking into it!

dstrelau commented 15 years ago

Okay, so after trying for an hour to get this working, I'm tending to agree with you. A SL clean-upgrade has left the original code MIA, but I'm pretty sure that if it was working, it wasn't working properly. While Wrapping things in Dir.chdir (or a helper to make system calls in that fashion) would probably work, I think it's more trouble than it's worth.

I think the best thing to do is just remove that bit about multiple projects from the readme and be done with it.

roidrage commented 15 years ago

Sounds good to me. Better and simpler to just fire up several Joe instances.

defunkt commented 15 years ago

Remove misleading info on multiple joes with config.ru. Closed by 73b7fff1d932c73a296540a1aaddc26470eab2ed