Exemplo n.º 1
0
 /**
  * @test
  */
 public function installShouldCreateCacheDir()
 {
     $src = self::$fixturesDirectory . '/config';
     $configuration = $this->createConfig($src);
     $this->eventDispatcher->addSubscriber(new CacheCreateListener($this->bower));
     $this->bower->install($configuration);
     $this->assertFileExists($this->target . '/cache');
 }
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     if (!$this->install) {
         return;
     }
     foreach ($this->bowerManager->getBundles() as $config) {
         $this->bower->install($config);
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getContent()
 {
     $formulae = array();
     /** @var $config ConfigurationInterface */
     foreach ($this->bowerManager->getBundles() as $bundle => $config) {
         try {
             $mapping = $this->bower->getDependencyMapping($config);
         } catch (FileNotFoundException $ex) {
             throw $ex;
         } catch (RuntimeException $ex) {
             throw new RuntimeException('Dependency cache keys not yet generated, run "app/console sp:bower:install" to initiate the cache: ' . $ex->getMessage());
         }
         $extensionFormulae = array();
         foreach ($mapping as $package) {
             $packageName = $this->namingStrategy->translateName($package->getName());
             foreach ($this->extensions as $extension) {
                 $packageFormulae = $this->createPackageFormulae($package, $packageName, $extension);
                 if (!empty($packageFormulae)) {
                     $formulaName = sprintf('%s_%s', $packageName, $extension);
                     $formulae[$formulaName] = $packageFormulae;
                     $extensionFormulae[$extension][] = $formulaName;
                 }
             }
         }
         $bundleFormulae = $this->createBundleFormulae($bundle, $extensionFormulae);
         $formulae = array_merge($formulae, $bundleFormulae);
     }
     return $formulae;
 }
Exemplo n.º 4
0
 /**
  * @expectedException \Sp\BowerBundle\Bower\Exception\RuntimeException
  */
 public function testUnsuccessfulInstallThrowsRuntimeException()
 {
     $jsonString = file_get_contents(self::$fixturesDirectory . '/error.json');
     $configDir = "/config_dir";
     $config = new Configuration($configDir);
     $config->setCache($this->cache);
     $this->processBuilder->expects($this->once())->method('getProcess')->will($this->returnValue($this->process));
     $this->process->expects($this->once())->method('isSuccessful')->will($this->returnValue(false));
     $this->process->expects($this->once())->method('getErrorOutput')->will($this->returnValue($jsonString));
     $this->bower->install($config);
 }
Exemplo n.º 5
0
 /**
  * @param \Sp\BowerBundle\Bower\Event\BowerEvent $event
  */
 public function onPostInstall(BowerEvent $event)
 {
     $this->bower->createDependencyMappingCache($event->getConfiguration());
 }