/**
  * {@inheritDoc}
  * 
  * @see \HcpssBanderson\Patcher\PatcherInterface::patch()
  */
 public function patch(array $params)
 {
     list($source, $destination) = $this->resolveParams($params);
     $ds = DIRECTORY_SEPARATOR;
     $shell = new ShellExec();
     $patchCommand = new CommandBuilder('patch');
     $patchCommand->addSubCommand($this->projectBase . $ds . $destination)->addSubCommand($this->configBase . $ds . $source);
     return $shell->run($patchCommand);
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  * 
  * @see \HcpssBanderson\Provider\ProviderInterface::assemble()
  */
 public function assemble(array $params)
 {
     $params = $this->resolveParams($params);
     $ds = DIRECTORY_SEPARATOR;
     $tempLocation = vsprintf('%s%s%s', [sys_get_temp_dir(), DIRECTORY_SEPARATOR, uniqid($this->getRepoName($params['source']))]);
     $shell = new ShellExec();
     // Clone the repository
     $cloneCommand = new CommandBuilder('git');
     $cloneCommand->addParam('clone')->addParam($params['source'])->addParam($tempLocation);
     $shell->run($cloneCommand);
     // Checkout the branch
     $checkoutCommand = new CommandBuilder('git');
     $checkoutCommand->addFlag('C', $tempLocation)->addParam('checkout')->addParam($params['branch']);
     $shell->run($checkoutCommand);
     // Delete the .git directory
     $ungitCommand = new CommandBuilder('rm');
     $ungitCommand->addFlag('rf')->addParam($tempLocation . $ds . '.git');
     $shell->run($ungitCommand);
     // Create the install location
     $destination = $this->projectBase;
     if ($params['destination']) {
         $destination .= $ds . $params['destination'];
     }
     if (!empty($params['rename'])) {
         $destination .= $ds . $params['rename'];
     }
     if (!file_exists($destination)) {
         $makeDestCmd = new CommandBuilder('mkdir');
         $makeDestCmd->addFlag('p')->addParam($destination);
         $shell->run($makeDestCmd);
     }
     // Move to the install location
     $moveCommand = new Command('mv');
     $moveCommand->addParam(new Param($tempLocation . $ds . '*', false));
     $moveCommand->addParam(new Param($destination, false));
     // Hidden files have to be specially invited
     $moveHiddenCommand = new Command('mv');
     $moveHiddenCommand->addParam(new Param($tempLocation . $ds . '.[!.]*', false));
     $moveHiddenCommand->addParam(new Param($destination, false));
     $shell->run($moveCommand);
     $shell->run($moveHiddenCommand);
     // Remove the old git folder
     $cleanTempCommand = new CommandBuilder('rm');
     $cleanTempCommand->addFlag('rf')->addParam($tempLocation);
     $shell->run($cleanTempCommand);
 }
 public function testCanGetOutput()
 {
     $shell = new ShellExec();
     $output = $shell->run(new Command('ls'));
     $this->assertNotEmpty($output, 'The should be some output');
 }
Exemple #4
0
/**
 * @Author: Griffen Fargo
 * @Date:   2016-01-26 00:20:13
 * @Last Modified by:   Griffen Fargo
 * @Last Modified time: 2016-04-11 19:30:09
 */
// Load Composer Plugins
require 'vendor/autoload.php';
use AdamBrett\ShellWrapper\Command;
use AdamBrett\ShellWrapper\Command\Param;
use AdamBrett\ShellWrapper\Runners\Exec;
use AdamBrett\ShellWrapper\Runners\ShellExec;
use AdamBrett\ShellWrapper\Runners\System;
use AdamBrett\ShellWrapper\Runners\ReturnValue;
use AdamBrett\ShellWrapper\Command\Builder as CommandBuilder;
$shell = new ShellExec();
$system = new System();
$cmd = $_POST['command'];
// XDebug Stuff
if ($cmd == 'xdebug') {
    $xdebugCommand = new Command($cmd);
    // $debugCheck = new CommandBuilder('php');
    // $debugCheck->addFlag('m')
    //         ->addFlag('c |')
    //         // ->addArgument('|')
    //         ->addArgument('grep xdebug');
    //         // ->addArgument('xdebug');
    $debugCheck = new Command('php -m -c | grep xdebug');
    $check = $system->run($debugCheck);
    echo "current check: " . $check;
    $inipath = php_ini_loaded_file();