Exemplo n.º 1
0
 /**
  * @param Project $project
  * @param TaskModel $task
  * @return bool
  * @throws \Exception
  */
 protected function _packageFiles(Project $project, TaskModel $task)
 {
     $version = $task->link_id;
     $files = $task->getCommandFiles();
     $excludes = GlobalHelper::str2arr($project->excludes);
     $packagePath = Project::getDeployPackagePath($version);
     $packageCommand = sprintf('cd %s && tar -p %s -cz -f %s %s', escapeshellarg(rtrim(Project::getDeployWorkspace($version), '/') . '/'), $this->excludes($excludes), escapeshellarg($packagePath), $files);
     $ret = $this->runLocalCommand($packageCommand);
     if (!$ret) {
         throw new \Exception(yii::t('walle', 'package error'));
     }
     return true;
 }