Example #1
0
 public function testReload()
 {
     $this->composer->reload();
     $this->assertFileNotExists($this->lock_file);
     touch($this->lock_file);
     $this->composer->reload();
     $this->assertFileNotExists($this->lock_file);
 }
Example #2
0
 /**
  * @param array $tag
  * @param Composer $composer
  * @param OutputInterface $output
  */
 protected function doUpdateItself(array $tag, Composer $composer, OutputInterface $output)
 {
     $output->writeln('Discovered a new version of the application: <info>' . $tag['name'] . '</info>');
     // create install package
     $package = new Package('anime-db/anime-db', $tag['version'], $tag['name']);
     $package->setDistType('zip');
     $package->setDistUrl($tag['zipball_url']);
     $package->setInstallationSource('dist');
     // download new version
     $target = sys_get_temp_dir() . '/anime-db';
     $this->getContainer()->get('filesystem')->remove($target);
     $composer->download($package, $target);
     $new_package = $composer->getPackageFromConfigFile($target . '/composer.json');
     $dispatcher = $this->getContainer()->get('event_dispatcher');
     // notify about downloaded
     $dispatcher->dispatch(StoreEvents::DOWNLOADED, new Downloaded($target, $new_package, $composer->getRootPackage()));
     // rewriting the application files
     $this->rewriting($target);
     // notify about updated
     // event will be sent after the update application components
     $this->getContainer()->get('anime_db.event_dispatcher')->dispatch(StoreEvents::UPDATED, new Updated($new_package));
     $composer->reload();
     $output->writeln('<info>Update itself has been completed</info>');
 }