/**
  * {@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);
 }
 /**
  * Erste benötigte Verbindung zum Bank-Server
  * holt alle nötigen Informationen und legt sie ins Konfigurations-Verzeichnis
  * 
  */
 public function checklogin()
 {
     debug('checklogin');
     /*
      * get sys_id
      */
     $command = new CommandBuilder('aqhbci-tool4' . $this->is . " --acceptvalidcerts -P '" . $this->config_dir . "/pinfile' -C '" . $this->config_dir . "/config'");
     $command->addSubCommand('getsysid')->addFlag('b', $this->bank_code)->addFlag('c', $this->banking_login);
     $this->shell->run($command);
     /*
      * get accounts
      */
     $command = new CommandBuilder('aqhbci-tool4' . $this->is . " --acceptvalidcerts -P '" . $this->config_dir . "/pinfile' -C '" . $this->config_dir . "/config'");
     $command->addSubCommand('getaccounts');
     $this->shell->run($command);
     /*
      * set itanmode
      */
     $mode = $this->bank->getItanMode();
     if ($mode !== false) {
         $command = new CommandBuilder('aqhbci-tool4' . $this->is . " --acceptvalidcerts -P '" . $this->config_dir . "/pinfile' -C '" . $this->config_dir . "/config'");
         $command->addSubCommand('setitanmode')->addFlag('m', $mode);
         $this->shell->run($command);
     }
 }
 public function testCanHaveSubCommand()
 {
     $command = new Command('ls');
     $command->addSubCommand('ls');
     $this->assertEquals('ls ls', (string) $command, 'Command should have sub command');
 }
 /**
  * Backup the database.
  *
  * @return bool True if the database was successfully backed up. False on error.
  */
 private function backupDatabase()
 {
     // get the name of the DB to backed up and the connection to use
     $dbdir = database_path();
     $dbconn = config('database.default');
     $dbname = config("database.connections.{$dbconn}.database");
     // make a directory for the backup file and switch into that directory
     $cmd = new Command('cd');
     $cmd->addParam($dbdir)->addSubCommand('&&')->addSubCommand('mkdir')->addParam('backups');
     if ($this->ex($cmd)) {
         $cmd = new Command('cd');
         $cmd->addParam($dbdir . '/backups')->addSubCommand('&&');
         switch ($dbconn) {
             case 'sqlite':
                 $cmd->addSubCommand('cp');
                 $cmd->addParam($dbname)->addParam('.');
                 return $this->ex($cmd);
             case 'mysql':
                 $cmd->addSubCommand('mysqldump');
                 $cmd->addParam($dbname)->addParam('>')->addParam("{$dbname}.sql");
                 return $this->ex($cmd);
             case 'pgsql':
                 $cmd->addSubCommand('pg_dump');
                 $cmd->addParam($dbname)->addParam('>')->addParam("{$dbname}.sql");
                 return $this->ex($cmd);
         }
     }
     return false;
 }