Ayaline\Bundle\ComposerBundle\Consumer\Step\ServeVendorStep::execute PHP Method

execute() public method

public execute ( Sonata\NotificationBundle\Consumer\ConsumerEvent $event, $directory )
$event Sonata\NotificationBundle\Consumer\ConsumerEvent
    public function execute(ConsumerEvent $event, $directory)
    {
        $sha1LockFile = sha1_file($this->workingTempPath . '/' . $directory . '/composer.lock');
        $resultPath = $this->rootDir . '/../web/assets/' . $sha1LockFile;
        if (is_file($resultPath . '/vendor.zip')) {
            $this->triggerNewStep($event, array('message' => 'Serving cached vendor.zip'));
            return 0;
        }
        $this->triggerNewStep($event, array('message' => 'Compressing vendor.zip'));
        $this->filesystem->mkdir($resultPath);
        $process = new Process('zip -rq ' . $resultPath . '/vendor.zip .');
        $process->setWorkingDirectory($this->workingTempPath . '/' . $directory);
        $process->run();
        if (!$process->isSuccessful()) {
            $this->triggerError($event, array('message' => $process->getErrorOutput()));
            return 1;
        }
        return 0;
    }
ServeVendorStep