Prechádzať zdrojové kódy

Exit nicely if there is no composer.json file

Jordi Boggiano 13 rokov pred
rodič
commit
fcde34cd3b
1 zmenil súbory, kde vykonal 3 pridanie a 1 odobranie
  1. 3 1
      bin/composer

+ 3 - 1
bin/composer

@@ -41,7 +41,9 @@ $im->addInstaller(new Installer\InstallerInstaller($vendorPath, $dm, $rm->getLoc
 $loader  = new Package\Loader\ArrayLoader($rm);
 $file = new JsonFile('composer.json');
 if (!$file->exists()) {
-    throw new \RuntimeException('The composer.json file could not be found in the current directory');
+    echo 'Composer could not find a composer.json file in '.getcwd().PHP_EOL;
+    echo 'To initialize a project, please create a composer.json file as described on the http://packagist.org/ "Getting Started" section'.PHP_EOL;
+    exit(1);
 }
 $packageConfig = $file->read();
 $package = $loader->load($packageConfig);