Permalink
Browse files

--quiet option support (curl downloader)

  • Loading branch information...
1 parent e4a3cf5 commit 04aa0d89bffcfadfb2266acdcf00132f786c4475 @c9s c9s committed Jun 9, 2012
Showing with 14 additions and 6 deletions.
  1. +1 −0 TODO.md
  2. +6 −2 src/Onion/Dependency/DependencyResolver.php
  3. +7 −4 src/Onion/Downloader/CurlDownloaderFactory.php
View
@@ -5,6 +5,7 @@ TODO
* support github installation
* bundle dependencies into ./local/ and ./onion.lock (json)
+* quite option should also disable downlaod progress
* compile command: which compile source into phar file.
* dist: make php package.
@@ -68,7 +68,9 @@ function resolvePearPackage($package)
$channel = new \PEARX\Channel( $host, array(
'cache' => \Onion\Application::getInstance()->getCache(),
- 'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(),
+ 'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(
+ $this->logger->level == 0 // quiet
+ ),
));
$depPackage = $channel->findPackage( $packageName );
$this->resolvePearPackage( $depPackage );
@@ -96,7 +98,9 @@ function resolve( $package )
$channel = new \PEARX\Channel( $host , array(
'cache' => \Onion\Application::getInstance()->getCache(),
- 'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(),
+ 'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(
+ $this->logger->level == 0 // --quiet option
+ ),
));
$depPackage = $channel->findPackage( $depPackageName );
@@ -5,10 +5,13 @@
class CurlDownloaderFactory
{
- static function create()
+ static function create($quiet = false)
{
- $d = new CurlDownloader;
- $d->setProgressHandler( new ProgressBar );
- return $d;
+ if( $quiet ) {
+ return new CurlDownloader();
+ }
+ return new CurlDownloader( array(
+ 'progress' => new ProgressBar
+ ));
}
}

0 comments on commit 04aa0d8

Please sign in to comment.