From a48675005bf048cd3fdb4cbfc8c5d84817099e44 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 13 Jan 2013 15:57:03 +0100 Subject: [PATCH] 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). --- src/Composer/Command/RequireCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index f75ec44db..1f3ae7a5a 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -54,8 +54,8 @@ EOT { $file = Factory::getComposerFile(); - if (!file_exists($file)) { - $output->writeln(''.$file.' not found.'); + if (!file_exists($file) && !file_put_contents($file, "{}\n")) { + $output->writeln(''.$file.' could not be created.'); return 1; }