franzliedke / studio

A workbench for developing Composer packages.
MIT License
1.14k stars 73 forks source link

Managed packages in a sub-folder #17

Closed RemiCollin closed 9 years ago

RemiCollin commented 9 years ago

I tested creating a /studio subfolder as I have 4 different packages I'm working on into the same project. This doesn't work as studio looks for the composer.json in the same folder he created the package into.

As a workaround I moved the studio.json in the root folder, and edited the package folder, which works perfectly.

Maybe it would be nice to look recursively into parent folder for the composer.json ?

(not PRing as I know you're about to release a new version ;) )

franzliedke commented 9 years ago

Hmm, not sure I understand. Let's assume the following directory structure:

- root
| - src
| - tests
| - vendor

You now run studio create four times...

- root
| - src
| - tests
| - vendor
| - managed1
| - managed2
| - managed3
| - managed4

Now you want your four managed subprojects in one common directory, right? So you move them:

- root
| - src
| - tests
| - vendor
| - studio
|  | - managed1
|  | - managed2
|  | - managed3
|  | - managed4

All you need to do is update the paths in studio.json and run composer dumpautoload. Or am I misunderstanding something?

RemiCollin commented 9 years ago

Yes it the way i made it works. Just thinking most user would probably want it this way, as it worked for example in L4's workbench, so automating this could be a nice addition.

franzliedke commented 9 years ago

I still don't understand, sorry. Can you point me to a place in Studio's code where I should check parent directories for a composer.json?

RemiCollin commented 9 years ago

Ok, let's say I have a /studio subfolder where I develop my packages. I would do :

cd studio
studio create newpackage

Right now composer throw an error as running composer dump-autoload after package creation won't find any composer.json file in the folder.

But forget it, there will be no need for that, I just found a simple way to do it, simply :

studio create studio/newpackage

Works... :facepalm

franzliedke commented 9 years ago

Yeah, exactly. Studio should always be run in the root of the package. I need to think whether that can be improved...

RemiCollin commented 9 years ago

I think as long as it is clearly stated in the doc, it's perfectly fine that way.