소스 검색

Implicitly create composer.json in require command

This allows shorteninig install instructions if you do not want to use init
(because it is interactive) and you do not want to use create-project (there
is no skeleton, or you do not want to use a skeleton).
Igor Wiedler 12 년 전
부모
커밋
a48675005b
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/Composer/Command/RequireCommand.php

+ 2 - 2
src/Composer/Command/RequireCommand.php

@@ -54,8 +54,8 @@ EOT
     {
         $file = Factory::getComposerFile();
 
-        if (!file_exists($file)) {
-            $output->writeln('<error>'.$file.' not found.</error>');
+        if (!file_exists($file) && !file_put_contents($file, "{}\n")) {
+            $output->writeln('<error>'.$file.' could not be created.</error>');
 
             return 1;
         }