Example #1
0
 /**
  * Configure the downloader in order to retrieve the correct tarball
  * 
  * @param string $branch
  */
 protected function configureDownloader($branch = NULL)
 {
     if (empty($branch)) {
         $branch = $this->project->getDefaultBranch();
     }
     if (empty($branch)) {
         $branch = self::$default_branch;
     }
     $repo_user = $this->project->getRepository()->getUser();
     $repo_password = $this->project->getRepository()->getPassword();
     if (!empty($repo_user) && !empty($repo_password)) {
         $this->downloader->setUser($repo_user)->setPassword($repo_password);
     }
     $this->downloader->setName($this->project->getName())->setDestination($this->localdata->getExtractDir())->setUrl($this->project->getRepository()->getUrl() . "/{$branch}")->setProgress(!$this->silent_download);
 }
Example #2
0
 /**
  * 
  * @param string $project_name
  * @return \AppBundle\Models\Project
  */
 protected function _getProject($project_name)
 {
     if (isset($this->conf['projects'][$project_name])) {
         $project_data = $this->conf['projects'][$project_name];
         $repo = new Repository();
         $repo->setUrl($project_data['repo']['url']);
         $repo->setReponame($project_data['repo']['name']);
         $repo->setOwner($project_data['repo']['owner']);
         if (isset($project_data['repo']['user']) && isset($project_data['repo']['password'])) {
             $repo->setUser($project_data['repo']['user']);
             $repo->setPassword($project_data['repo']['password']);
         }
         $project = new Project();
         $project->setName($project_name);
         if (isset($project_data['project']['default_branch'])) {
             $project->setDefaultBranch($project_data['project']['default_branch']);
         }
         $project->setRepository($repo);
         $project->setLocaldata($this->getLocalData($project_name));
         return $project;
     }
     return FALSE;
 }