franzliedke / studio

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

Studio and composer create-project #62

Closed Arcesilas closed 8 years ago

Arcesilas commented 8 years ago

Hi,

Thanks for the awesome job with Studio, it's so cool!

I've tried to use Studio with composer create-project command, without success. Is it the normal or is it a bug? Or maybe I'm doing something wrong? Using Studio allows to create a package easily, to test it almost in "real life", using Composer with require command. I'd like to use it to download a project too... I can use Satis, but it's a bit more complicated: I wish Studio could help :)

franzliedke commented 8 years ago

Howdy, thanks for reporting this! :)

We currently do not hook into the create-project command. Not sure how that would work exactly - after all, create-project creates a directory which is where the studio.json file would have to be located.

So, can you explain how exactly Studio should hook into the process here?

Arcesilas commented 8 years ago

Hi, thanks for your answer!

create-project can also install in the current directory, but it actually needs to be empty. Is there a way to tell composer not to worry if there is only studio.json? (not sure it's possible...)

I don't really know how Composer works, at its core, so it's not easy for me to guess how it could work: I can make assumptions, suggestions... but they could not be relevant or feasible.

Could it be possible to give Composer an option to tell it where the package can be found? Or link to an external studio.json?

For example:

with an external studio.json: composer create-project --studio=~/dev/studio.json myvendor/mypackage myapplication

or only for the project package: composer create-project --load-package ~/dev/mypackage myvendor/mypackage myapplication

With the external studio.json, all required dependencies are indicated in the file. With a --load-package option, user should have to list all packages to load with Studio. External file has my preference.

Is something like that possible?

I know it's completely possible to do this with Satis, but I think using Satis is quite more complex than using Studio. Loading a development project is also possible with Satis, by the way.

franzliedke commented 8 years ago

So would you want the myvendor/mypackage to be resolved using Studio, or just (some of) its dependencies?

Or am I missing something here? ;)

Studio is really meant for making your life easier when it comes to developing packages that you use as dependencies in other packages.

Arcesilas commented 8 years ago

Running composer create-project would also run the scripts in post-create-project-cmd event, for example. I know scripts can be run manually, but I find it more convenient to be able to install a local package with Studio :)

For the latter, you can first do composer create-project ... and then add the studio.json file.

But my package is not published, it's only available locally. I just cannot run composer create-project since Composer would look on packagist for my unpublished package... I want it to look in the local directory where it is located.

franzliedke commented 8 years ago

Okay, gotcha, thanks for explaining!

I'm afraid I can't / don't want to support this at the moment. As I said above, Studio is making your life with your project's dependencies easier, not a project itself. To be honest, I'd say the create-project command simply doesn't make much sense without a remotely hosted package.

So I'm going to close this.

I hope you understand. Thanks for taking an interest, pitching your ideas and - most importantly - using Studio. :)

franzliedke commented 8 years ago

Ha, you know what: create-project supports a --repository flag - that should help you achieve your goal even without Studio. :wink: