Exemple #1
0
    public function __construct(WebforgeContainer $webforgeContainer, Project $targetProject, LibraryBuilder $libraryBuilder = NULL)
    {
        if ($targetProject->loadedFromPackage) {
            $this->autoPrependFile = 'bootstrap.php';
            $this->cliPHPTemplate = <<<'PHP_CLI'
#!/usr/bin/env php      
<?php

require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'%autoPrependFile%';

$console = new %projectConsole%($project = \Psc\PSC::getProject(), $project->getModule('Doctrine'));
$console->run();

PHP_CLI;
        } else {
            $this->cliPHPTemplate = <<<'PHP_CLI'
#!/usr/bin/env php
<?php

require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'%autoPrependFile%';

$console = new %projectConsole%($project = \Psc\PSC::getProject(), $project->getModule('Doctrine'));
$console->run();

PHP_CLI;
        }
        $this->cliPHPTemplate .= '?>';
        // stupid sublime
        $packageRegistry = $webforgeContainer->getPackageRegistry();
        $bridge = $webforgeContainer->getCMSBridge();
        $this->psc = $bridge->createProjectFromPackage($packageRegistry->findByIdentifier('pscheit/psc-cms'));
        $bridge->initLocalConfigurationFor($this->psc);
        $vendor = $webforgeContainer->getLocalPackage()->getDirectory(Package::VENDOR);
        $packageIdentifier = 'pscheit/psc-cms-js';
        $this->pscjs = $vendor->sub($packageIdentifier . '/');
        if (!$this->pscjs->exists()) {
            throw new RuntimeException($webforgeContainer->getLocalPackage()->getIdentifier() . ' has not a dependency: ' . $packageIdentifier . ' installed. Add it to composer.json');
        }
        $this->libraryBuilder = $libraryBuilder ?: new LibraryBuilder($this->psc);
        $this->targetProject = $targetProject;
    }
Exemple #2
0
 protected function createWebforgeContainer()
 {
     if (isset($GLOBALS['env']['container'])) {
         return $GLOBALS['env']['container']->webforge;
     } else {
         $container = new WebforgeContainer();
         $container->initLocalPackageFromDirectory(new Dir(getcwd() . DIRECTORY_SEPARATOR));
         return $container;
     }
 }