Browse Source

Add support for new verbosity levels, and initial debug output

Jordi Boggiano 12 years ago
parent
commit
3b97e2e260

+ 1 - 1
composer.json

@@ -25,7 +25,7 @@
         "php": ">=5.3.2",
         "justinrainbow/json-schema": "1.1.*",
         "seld/jsonlint": "1.*",
-        "symfony/console": "~2.1@dev",
+        "symfony/console": "~2.3@dev",
         "symfony/finder": "~2.1",
         "symfony/process": "~2.1@dev"
     },

+ 9 - 9
composer.lock

@@ -3,7 +3,7 @@
         "This file locks the dependencies of your project to a known state",
         "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
     ],
-    "hash": "38828459a269ef0e409883721853d7fe",
+    "hash": "01e4c62c851ae821a789f70484fed8a6",
     "packages": [
         {
             "name": "justinrainbow/json-schema",
@@ -84,12 +84,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Console.git",
-                "reference": "f22b036677ee58fdb256f2404c95a9f401b767cf"
+                "reference": "7bcef9e062cc89b893a35c67a7456d41cb50113d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Console/zipball/f22b036677ee58fdb256f2404c95a9f401b767cf",
-                "reference": "f22b036677ee58fdb256f2404c95a9f401b767cf",
+                "url": "https://api.github.com/repos/symfony/Console/zipball/7bcef9e062cc89b893a35c67a7456d41cb50113d",
+                "reference": "7bcef9e062cc89b893a35c67a7456d41cb50113d",
                 "shasum": ""
             },
             "require": {
@@ -125,7 +125,7 @@
             ],
             "description": "Symfony Console Component",
             "homepage": "http://symfony.com",
-            "time": "2013-04-23 16:54:01"
+            "time": "2013-04-25 13:33:44"
         },
         {
             "name": "symfony/finder",
@@ -181,12 +181,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Process.git",
-                "reference": "a2a22e359c8c6c6a44ec2d158d0865e9a94348b1"
+                "reference": "d55770ab111a89ee92773eb16f8acef9b09870f5"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Process/zipball/a2a22e359c8c6c6a44ec2d158d0865e9a94348b1",
-                "reference": "a2a22e359c8c6c6a44ec2d158d0865e9a94348b1",
+                "url": "https://api.github.com/repos/symfony/Process/zipball/d55770ab111a89ee92773eb16f8acef9b09870f5",
+                "reference": "d55770ab111a89ee92773eb16f8acef9b09870f5",
                 "shasum": ""
             },
             "require": {
@@ -219,7 +219,7 @@
             ],
             "description": "Symfony Process Component",
             "homepage": "http://symfony.com",
-            "time": "2013-04-23 20:53:10"
+            "time": "2013-04-25 13:23:11"
         }
     ],
     "packages-dev": [

+ 1 - 1
src/Composer/Command/InstallCommand.php

@@ -38,7 +38,7 @@ class InstallCommand extends Command
                 new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'),
                 new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
                 new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
-                new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
+                new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
                 new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump')
             ))
             ->setHelp(<<<EOT

+ 1 - 1
src/Composer/Command/StatusCommand.php

@@ -29,7 +29,7 @@ class StatusCommand extends Command
             ->setName('status')
             ->setDescription('Show a list of locally modified packages')
             ->setDefinition(array(
-                new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
+                new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
             ))
             ->setHelp(<<<EOT
 The status command displays a list of dependencies that have

+ 1 - 1
src/Composer/Command/UpdateCommand.php

@@ -38,7 +38,7 @@ class UpdateCommand extends Command
                 new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'),
                 new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
                 new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
-                new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
+                new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
                 new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump')
             ))
             ->setHelp(<<<EOT

+ 17 - 1
src/Composer/IO/ConsoleIO.php

@@ -71,7 +71,23 @@ class ConsoleIO implements IOInterface
      */
     public function isVerbose()
     {
-        return $this->output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE;
+        return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public function isVeryVerbose()
+    {
+        return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public function isDebug()
+    {
+        return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
     }
 
     /**

+ 15 - 1
src/Composer/IO/IOInterface.php

@@ -27,12 +27,26 @@ interface IOInterface
     public function isInteractive();
 
     /**
-     * Is this input verbose?
+     * Is this output verbose?
      *
      * @return bool
      */
     public function isVerbose();
 
+    /**
+     * Is the output very verbose?
+     *
+     * @return bool
+     */
+    public function isVeryVerbose();
+
+    /**
+     * Is the output in debug verbosity?
+     *
+     * @return bool
+     */
+    public function isDebug();
+
     /**
      * Is this output decorated?
      *

+ 16 - 0
src/Composer/IO/NullIO.php

@@ -35,6 +35,22 @@ class NullIO implements IOInterface
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public function isVeryVerbose()
+    {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public function isDebug()
+    {
+        return false;
+    }
+
     /**
      * {@inheritDoc}
      */

+ 4 - 0
src/Composer/Util/RemoteFilesystem.php

@@ -18,6 +18,7 @@ use Composer\Downloader\TransportException;
 
 /**
  * @author François Pluchino <francois.pluchino@opendisplay.com>
+ * @author Jordi Boggiano <j.boggiano@seld.be>
  */
 class RemoteFilesystem
 {
@@ -101,6 +102,9 @@ class RemoteFilesystem
         $this->lastProgress = null;
 
         $options = $this->getOptionsForUrl($originUrl, $additionalOptions);
+        if ($this->io->isDebug()) {
+            $this->io->write('Downloading '.$fileUrl);
+        }
         if (isset($options['github-token'])) {
             $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
             unset($options['github-token']);