franzliedke / studio

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

Is create -> load the correct approach? Installers? Guidance? #60

Closed rask closed 8 years ago

rask commented 8 years ago

The documentation is a bit vague in my opinion. Is the following the correct approach to creating a new package using studio?

  1. Create a new package skeleton using studio create <asdf>.
  2. Adjust the skeleton, perhaps create baseline content.
  3. Go to a Composer-powered project root.
  4. Run studio load <asdf>.
  5. studio.json is created containing something like

    {
       "version": 1,
       "paths": [
           "<asdf>"
       ]
    }

This should load the WIP package living in <asdf> to the Composer-powered project, am I correct?

When I run composer update nothing is installed and Nothing to install or update comes up in my terminal.

How I understand it should go:

  1. studio create ...
  2. studio load ...
  3. composer update
  4. Dev package created with studio create should appear to vendor or similar, either as a link/copy or as a line in the autoloader.

Currently nothing happens which resembles number 4 on that list.

I tried to create a package for a Wordpress plugin ("type": "wordpress-plugin") and a regular library package too, but both do not work for me. I'm running latest Composer and my environment is Ubuntu 14.04.

franzliedke commented 8 years ago

You should run composer require your/managed-package after step 4.

I agree, this needs to be documented better.

rask commented 8 years ago

I see. I thought Studio somehow sidesteps the require blocks there.

So if I require my/package which is available as a local Studio package and as a remote Git repository, Studio will take preference over the remote one?

Thanks for the clarification, I'll see what happens. :)

franzliedke commented 8 years ago

That's the idea, yes. There are some situations currently where this does not work that way (see #58), but in general that's the concept.

JayBizzle commented 8 years ago

I'm really struggling to get this to work.

I have a package already in a repo.

I run studio create organisation/repo --git https://www.github.com/organisation/repo

Then I run composer require organisation/repo and I keep getting a composer error saying organisation/repo can't be found.

Can't for the life of me figure out what I'm doing wrong.

Help please :)

JayBizzle commented 8 years ago

My bad, had an incorrect field in my composer.json 😒

mnpenner commented 8 years ago

Yeah...this is clear as mud.

I've just ran

studio load "/home/mpenner/Projects/polymig"

[OK] Packages matching the path /home/mpenner/Projects/polymig will now be loaded by Composer.

But what exactly did that do? Is it supposed to alter my composer.json and add one of those "path" repositories? Because it didn't.

And if that is all it does, what's the benefit of that? Those "path" repos actually don't work well at all in practice; you have to remove them before pushing.


Oh I see...it created studio.json and now when I run update company/polymig it symlinks it without mucking up my composer.json. That is handy. Thank you.

Maybe that [OK] message can be amended slightly to say that you need to run composer update xxx/yyy.

JayBizzle commented 8 years ago

@mnpenner Yeah, the read me could do with a simple step-by-step to get a package working. Took me a while of trial and error

franzliedke commented 8 years ago

Hi folks, thanks for your input!

I finally took the time, merged @rask's suggestions and expanded on them - please check out the new "Workflow" section of the README and let me know what you think!