Ejemplo n.º 1
0
 public function transferIBAN($value, $name, $iban, $bic, $subject)
 {
     $name = str_replace('"', '', $name);
     $value = str_replace('.', ',', $value) . ':EUR';
     $transfer_name = date('Y-m-d_H-i') . '_' . $iban;
     $command = new CommandBuilder('aqbanking-cli' . $this->is . ' -P "' . $this->config_dir . '/pinfile" -D "' . $this->config_dir . '/config' . '" sepatransfer --riban=' . $iban . ' --rname="' . $name . '"');
     $command->addFlag('c', $this->config_dir . '/transfer/' . $transfer_name . '.ctx')->addFlag('v', $value)->addFlag('p', $subject);
     $this->shell->run($command);
     return true;
 }
Ejemplo n.º 2
0
 public function testCanAddMultipleFlag()
 {
     $command = new Command('ls');
     $command->addFlag('l')->addFlag('a');
     $this->assertEquals('ls -l -a', (string) $command, 'Command should have multiple flags');
 }
Ejemplo n.º 3
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);
 }
 /**
  * Create a new directory parallel to the webroot and clone the project into that directory.
  *
  * @return bool True if the clone is successful. False otherwise.
  */
 private function pull()
 {
     if (is_writable(dirname($this->installDir))) {
         $cmd = new Command('mkdir');
         $cmd->addFlag('p')->addParam($this->installDir);
         if ($this->ex($cmd)) {
             $cmd = new Command('cd');
             $cmd->addParam($this->installDir)->addSubCommand('&&')->addSubCommand('git')->addSubCommand('clone')->addParam($this->repoUrl)->addParam('.');
             return $this->ex($cmd);
         }
     }
     return false;
 }