franzliedke / studio

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

RuntimeException while creating new package #12

Closed driesvints closed 9 years ago

driesvints commented 9 years ago

Reproduce: run studio create <dir name> --> throws RuntimeException.

Here's the console output:

Balerion:projects summer$ studio create rss
Please name this package RSS
 Please enter a valid package name in the format "vendor/name".
Please name this package prologue/rss
Please provide a default namespace (PSR-4) [Prologue\Rss]
Do you want to set up PhpUnit as a testing tool? [y|N] y
Do you want to set up PhpSpec as a testing tool? [y|N] y
Do you want to set up TravisCI as continuous integration tool? [y|N] y
Package directory rss created.
Running composer install for new package...
Package successfully created.
Dumping autoloads...

  [RuntimeException]
  Error while running composer: Composer could not find a composer.json file in /Users/summer/Sites/projects
  To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section

create [-g|--git="..."] path

I also now have a studio.json file in the directory where I called the command with the following contents:

{
    "packages": {
        "prologue/rss": "rss"
    }
}

I don't know what that file does or why it was created. I guess it gets removed again at the end of the install process and wasn't because the installer never reached the end?

Anyway, looks like the skeleton got set up nicely. Great package, thanks! :)

franzliedke commented 9 years ago

Ah, apparently you ran this in a directory that wasn't a Composer project itself.

Funny that I didn't anticipate that use-case, it's quite straightforward. Probably because I started out with the objective of replacing Workbench, which always ran inside Composer projects (a Laravel install).

Thanks for bringing this to my attention, it will be fixed soon.

P.S.: The studio.json file is important for autoloading when developing a library as part of a larger project (when you don't yet want to have it in the vendor directory). It lets my Composer plugin know that your libraries dependencies should be autoloadable from the main application, too.

franzliedke commented 9 years ago

Fixed. Again, thanks for the report.

This should be available under dev-master and in the next release (0.9.6).

driesvints commented 9 years ago

Thanks! :)

franzliedke commented 9 years ago

You're welcome.

I must correct myself, though: it's in 0.9.x-dev, not dev-master. I mixed up my branches...