@@ -50,7 +50,7 @@ protected function configure()
5050 new InputArgument ('output-dir ' , InputArgument::OPTIONAL , 'Location where to output built files ' , null ),
5151 new InputOption ('no-html-output ' , null , InputOption::VALUE_NONE , 'Turn off HTML view ' ),
5252 new InputOption ('skip-errors ' , null , InputOption::VALUE_NONE , 'Skip Download or Archive errors ' ),
53- new InputOption ('repository ' , null , InputOption::VALUE_OPTIONAL , 'Only update the given repository ' , null ),
53+ new InputOption ('repository-url ' , null , InputOption::VALUE_OPTIONAL , 'Only update the repository at given url ' , null ),
5454 ))
5555 ->setHelp (<<<EOT
5656The <info>build</info> command reads the given json file
@@ -130,18 +130,32 @@ protected function execute(InputInterface $input, OutputInterface $output)
130130 }
131131
132132
133- if ($ input ->getOption ('repository ' ) !== null ) {
134- $ singleRepository = $ input ->getOption ('repository ' );
133+ if (($ singleRepositoryUrl = $ input ->getOption ('repository-url ' )) !== null
134+ && FALSE !== ($ otherPackagesCache = @file_get_contents ($ outputDir .'/packages.cache ' )))
135+ {
136+ $ singleRepositoryUrl = $ input ->getOption ('repository-url ' );
135137
136- $ otherPackages = unserialize (file_get_contents ($ outputDir .'/packages.cache ' ));
137- unset($ config ['repositories ' ]);
138- $ config ['repositories ' ] = array (
139- array ('type ' => 'vcs ' , 'url ' => $ singleRepository ),
140- );
138+ $ otherPackages = unserialize ($ otherPackagesCache );
139+
140+ // find repository configuration
141+ $ singleRepositoryConfig = null ;
142+ foreach ($ config ['repositories ' ] as $ r ) {
143+ if ($ r ['url ' ] == $ singleRepositoryUrl ) {
144+ $ singleRepositoryConfig = $ r ;
145+ break ;
146+ }
147+ }
148+ if ($ singleRepositoryConfig === null ) {
149+ throw new \InvalidArgumentException ('Requested repository not found in configuration: ' .$ singleRepositoryUrl );
150+ }
151+
152+ // use only selected repository
153+ $ config ['repositories ' ] = array ($ singleRepositoryConfig );
141154
142155 $ composer = $ this ->getApplication ()->getComposer (true , $ config );
143156 $ packages = $ this ->selectPackages ($ composer , $ output , $ verbose , $ requireAll , $ requireDependencies );
144157
158+ // merge with cached data
145159 $ packages = array_merge ($ otherPackages , $ packages );
146160 ksort ($ packages , SORT_STRING );
147161 } else {
0 commit comments