/**
  * Returns a directory to save the downloaded project into.
  * @return string
  */
 protected function getDestination()
 {
     $type = $this->project->getProjectType();
     $name = $this->project->getProject();
     $version = $this->project->getVersion();
     $dir = $this->getTempDirectory() . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $name;
     // Build the destination folder tree if it doesn't already exists.
     if (!is_dir($dir)) {
         mkdir($dir, 0775, true);
     }
     return $dir . DIRECTORY_SEPARATOR . $version;
 }
Exemplo n.º 2
0
 /**
  * Locate the base directory of the local project.
  */
 public function locateLocalProject()
 {
     // we need a remote project to do this :(
     $this->hashRemoteProject();
     $project_type = $this->project->getProjectType();
     return realpath($this->local_folder);
 }
Exemplo n.º 3
0
 /**
  * @param Project $project
  * @param ReleaseHistory $release_history
  * @param boolean $flat
  * @return array
  */
 protected function generateReport(Project $project, ReleaseHistory $release_history, $flat = false)
 {
     $report = array('project' => $project->getProject(), 'type' => $project->getProjectType(), 'version' => $project->getVersion(), 'version_date' => $project->getDatestamp(), 'recommended' => null, 'dev' => null, 'also_available' => array(), 'status' => $project->getStatus(), 'status_label' => ReleaseHistory::getStatusLabel($project->getStatus()), 'reason' => '');
     if ($flat) {
         $report['recommended'] = $project->getRecommended();
         $report['dev'] = $project->getDevVersion();
         $report['also_available'] = implode(',', $project->getAlsoAvailable());
     } else {
         if ($release = $release_history->getRelease($project->getRecommended())) {
             $report['recommended'] = $this->getReportFromRelease($release);
         }
         if ($release = $release_history->getRelease($project->getDevVersion())) {
             $report['dev'] = $this->getReportFromRelease($release);
         }
         foreach ($project->getAlsoAvailable() as $version) {
             if ($release = $project->getRelease($version)) {
                 $report['also_available'][] = $this->getReportFromRelease($release);
             }
         }
     }
     if ($reason = $project->getReason()) {
         $report['reason'] = $reason;
     }
     return $report;
 }