build a compile command

@return CommandCaller
322379
public function compile()
    {
        $cmd = sprintf('%s %s > %s', $this->binary->getPath(), $this->sourceFolder.DIRECTORY_SEPARATOR.$this->sourceFile, $this->destination);
        $this->execute($cmd);
        return $this;
    }
746869
private function createFromCommand()
    {
        $command = BranchCommand::getInstance($this->getRepository())->listBranches();
        $outputLines = $this->repository->getCaller()->execute($command)->getOutputLines(true);
        foreach ($outputLines as $outputLine) {
            $matches = static::getMatches($outputLine);

            if ($this->name === $matches[1]) {
                $this->parseOutputLine($outputLine);

                return;
            }
        }

        throw new InvalidBranchNameException(sprintf('The %s branch doesn\'t exists', $this->name));
    }
381526
protected function compileRoute()
    {
        if (! $this->compiled) {
            return $this->compiled = with(new RouteCompiler($this))->compile();
        }

        return $this->compiled;
    }
917597
protected function compileCommand()
    {
        $output = ProcessUtils::escapeArgument($this->output);

        $redirect = $this->shouldAppendOutput ? ' >> ' : ' > ';

        if (! $this->runInBackground) {
            return $this->command .$redirect .$output .' 2>&1';
        }

        $delimiter = windows_os() ? '&' : ';';

        $phpBinary = ProcessUtils::escapeArgument(
            with(new PhpExecutableFinder)->find(false)
        );

        $forgeBinary = defined('FORGE_BINARY') ? ProcessUtils::escapeArgument(FORGE_BINARY) : 'forge';

        $finished = $phpBinary .' ' .$forgeBinary .' schedule:finish ' . ProcessUtils::escapeArgument($this->mutexName());

        return '(' .$this->command .$redirect .$output .' 2>&1 ' .$delimiter .' ' .$finished .') > '
            . ProcessUtils::escapeArgument($this->getDefaultOutput()) .' 2>&1 &';
    }
634347
private function getCommandProcessBuilder()
    {
        $pb = new ProcessBuilder();

        // PHP wraps the process in "sh -c" by default, but we need to control
        // the process directly.
        if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
            $pb->add('exec');
        }

        $pb
            ->add('php')
            ->add($this->getContainer()->getParameter('kernel.root_dir').'/console')
            ->add('--env='.$this->env)
        ;

        return $pb;
    }
1218377
protected function buildWorkerCommand()
	{
		$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));

		if (defined('HHVM_VERSION')) {
			$binary .= ' --php';
		}

		if (defined('ARTISAN_BINARY')) {
			$artisan = ProcessUtils::escapeArgument(ARTISAN_BINARY);
		} else {
			$artisan = 'artisan';
		}

		$command = 'queue:work %s --queue=%s --delay=%s --memory=%s --sleep=%s --tries=%s';

		return "{$binary} {$artisan} {$command}";
	}
483548
public function compile() {
		$this->start('Compiling to '. $this->host);

		// fix path
		$this->localProj	= self::path($this->localProj);
		$this->remoteProj	= rtrim($this->remoteProj, DIRECTORY_SEPARATOR);
		
		// Work from project
		if(isset($this->localProj) && is_dir($this->localProj))
			chdir($this->localProj);
		
		// documentation
		if(isset($this->localDoc))
			$this->start('Creating Documentation from ' . $this->localDoc)->makeDoc()->finish();
		
		// twig templates
		if(isset($this->localTpl))
			$this->start('Creating JS Templates from ' . $this->localTpl)->makeTpl()->finish();
		
		
		// static files
		$localStatic = self::path(sys_get_temp_dir()) . 'data' . time() . DIRECTORY_SEPARATOR;
		$this->wipe[] = $localStatic;
		
		foreach($this->remoteStatic as $type => $trash) {
			if(method_exists($this, $type)) {
				$this->tmp[ $type ] = $localStatic . $type . DIRECTORY_SEPARATOR;
				self::readyDir( $this->tmp[ $type ] );

				// process static files
				$this->start('Processing '. $type)->$type()->finish();
				
			} elseif(!empty($this->localStatic[ $type ])) {
					// just moved the folder
					$this->tmp[ $type ] = self::path(current ($this->localStatic[ $type ]));
					
					// remove if not there
					if(!file_exists($this->tmp[ $type ])) 
						unset ($this->remoteStatic[ $type ]);
			}
		}

		// run through static files then upload them
		$this->start('Uploading Static')->uploadStatic()->finish();

		// upload project
		$cmd = [
			'pscp',
			'-p',									// preserve attributes
			'-r',									// copy recursively
			'-q',									// silent
			//'-sftp',								// for use of SFTP protocal
			'-batch',								// non interactive
			'-C',									// enable compression
			'-i', static::safeDir($this->ppk),						// Private key file to access server
		];
		
		// Directory to upload
		foreach($this->localCopy as $name)
			$cmd[] = static::safeDir($this->localProj . $name);
		
		// host:path on server to save data
		$cmd[] = $this->host .':'. $this->remoteProj;
		
		$this->start('Uploading Project')->runLocal($cmd)->finish();

		// config
		if(!isset($this->s3) && !empty($this->remoteStatic)) {
			// reset file permissions
			$cmd = array();
			foreach($this->remoteStatic as $type => $path) {
				$cmd[] = 'chmod 774 -R '. $path;
				// $cmd[] = 'chown mo:www-data -R '. $path;
			}
			
			$this->start('Updating Server Enviroment')->runRemote( $cmd )->finish();
		}

		// clean up
		$this	->start('Cleaning up');
			foreach($this->wipe as $dir)
				self::wipeDir($dir, true);
		$this	->finish();
		
		// finally
		$this->finish();
	}
911359
public function buildCommand(Event $event)
    {
        if ($event->runInBackground) {
            return $this->buildBackgroundCommand($event);
        }

        return $this->buildForegroundCommand($event);
    }
1298682
private function compile()
    {
        $commands = array_keys($this->commands);
        $values = $this->getArrayValues(array_values($this->commands));

        $origSource = $this->source;

        $vs = '%s';
        $bin = $this->converter;
        $type = preg_replace('#^image/#', null, $this->getInfo('type'));

        $this->tmpFile = $this->getTempFile();

        if ($this->isMultipartImage()) {

            $this->intermediate = $this->getTempFile($type);
            $this->source = $this->intermediate;

        }

        array_unshift($values, sprintf('%s:%s', $type, escapeshellarg($this->source)));

        array_unshift($values, $bin);

        array_unshift($commands, $vs);
        array_unshift($commands, $vs);

        if ($this->isMultipartImage()) {

            array_unshift(
                $values,
                sprintf(
                    '%s %s:%s -coalesce %s %s',
                    $this->converter,
                    $type,
                    $origSource,
                    $this->intermediate,
                    PHP_EOL
                )
            );
            array_unshift($commands, $vs);
        }

        array_push($values, sprintf('%s:%s', $this->getOutputType(), $this->tmpFile));
        array_push($commands, $vs);

        $cmd = implode(' ', $commands);

        $this->source = $origSource;

        return vsprintf($cmd, $values);
    }
567689
function compileUpdate()
    {
        $updateManager = new UpdateManager;
        $updateManager->table($this->nodes->source->getLeft());

        foreach ($this->nodes->restrictions as $expr) {
            $updateManager->where($expr);
        }

        foreach ($this->nodes->orders as $order) {
            $updateManager->order($order);
        }

        empty($this->nodes->limit) ?:
            $updateManager->take($this->nodes->limit->getExpression());

        empty($this->nodes->offset) ?:
            $updateManager->skip($this->nodes->offset->getExpression());

        return $updateManager;
    }
1306924
protected function compileClasses()
	{
		$this->registerClassPreloaderCommand();

		$outputPath = $this->laravel['path.storage'] . '/compiled.php';

		$this->callSilent('compile', array(
			'--config'         => implode(',', $this->getClassFiles()),
			'--output'         => $outputPath,
			'--strip_comments' => 1,
		));
	}
885519
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        return sprintf('%s table %s (%s%s%s)',
            $blueprint->temporary ? 'create temporary' : 'create',
            $this->wrapTable($blueprint),
            implode(', ', $this->getColumns($blueprint)),
            (string) $this->addForeignKeys($blueprint),
            (string) $this->addPrimaryKeys($blueprint)
        );
    }
318941
protected function runCommandInForeground()
	{
		$this->callBeforeCallbacks();

		( new Process( trim( $this->buildCommand(), '& ' ), base_path(), null, null, null ) )->run();

		$this->callAfterCallbacks();
	}
592552
protected function compileClasses()
	{
		$this->registerClassPreloaderCommand();

		$this->callSilent('compile', array(
			'--config' => implode(',', $this->getClassFiles()),
			'--output' => $this->laravel->getCachedCompilePath(),
			'--strip_comments' => 1,
		));
	}
431449
protected function registerMakeResourceCommand($command)
     {
         $this->app->singleton($command, function ($app) {
             return new Generators\Commands\ResourceMakeCommand($app);
         });
     }
61682
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        return sprintf('%s table %s (%s)',
            $blueprint->temporary ? 'create temporary' : 'create',
            $this->wrapTable($blueprint),
            implode(', ', $this->getColumns($blueprint))
        );
    }
175445
private function createCommandProphecy()
    {
        $prophet = new Prophet;
        $prophecy = $prophet->prophesize()->willImplement(InlineConfigCommandInterface::class);
        $prophecy
            ->setName('foo')
            ->shouldBeCalled();
        $prophecy
            ->getConfig()
            ->willReturn(['name'=>'foo']);

        return $prophecy;
    }