Exemplo n.º 1
0
 public function testDaemonEnabled()
 {
     $project = new GitPHP_Project(GITPHP_TEST_PROJECTROOT, 'testrepo.git', $this->getMock('GitPHP_ProjectLoadStrategy_Interface'));
     $this->assertFalse($project->GetDaemonEnabled());
     $project = new GitPHP_Project(GITPHP_TEST_PROJECTROOT, 'testrepoexported.git', $this->getMock('GitPHP_ProjectLoadStrategy_Interface'));
     $this->assertTrue($project->GetDaemonEnabled());
 }
 /**
  * AddProject
  *
  * Add project to collection
  *
  * @access private
  */
 private function AddProject($projectPath)
 {
     try {
         $proj = new GitPHP_Project($this->projectDir, $projectPath);
         $category = trim(dirname($projectPath));
         if (!(empty($category) || strpos($category, '.') === 0)) {
             $proj->SetCategory($category);
         }
         if (!GitPHP_Config::GetInstance()->GetValue('exportedonly', false) || $proj->GetDaemonEnabled()) {
             $this->projects[$projectPath] = $proj;
         }
     } catch (Exception $e) {
         GitPHP_Log::GetInstance()->Log($e->getMessage());
     }
 }
 /**
  * Loads a project
  *
  * @param string $proj project
  * @return GitPHP_Project project
  */
 protected function LoadProject($proj)
 {
     try {
         $project = new GitPHP_Project($this->projectRoot, $proj);
         $category = trim(dirname($proj));
         if (!(empty($category) || strpos($category, '.') === 0)) {
             $project->SetCategory($category);
         }
         if ($this->exportedOnly && !$project->GetDaemonEnabled()) {
             $this->Log('Project export disabled', $project->GetPath());
             return null;
         }
         $this->ApplyGlobalConfig($project);
         $this->ApplyGitConfig($project);
         if ($this->projectSettings && isset($this->projectSettings[$proj])) {
             $this->ApplyProjectSettings($project, $this->projectSettings[$proj]);
         }
         $this->InjectProjectDependencies($project);
         return $project;
     } catch (Exception $e) {
         $this->Log('Project error', $e->getMessage());
     }
     return null;
 }