示例#1
0
 /**
  * 
  * @param string $project_name
  * @return \AppBundle\Models\LocalData
  */
 protected function _getLocalData($project_name)
 {
     if (isset($this->conf['projects'][$project_name])) {
         $project_data = $this->conf['projects'][$project_name];
         $this->checkFolders($project_data);
         //
         $localdata = new LocalData();
         $localdata->setAppPath($project_data['local_data']['app_path']);
         $localdata->setExtractDir($project_data['local_data']['extract_dir']);
         $localdata->setUser($project_data['local_data']['user']);
         if (!empty($project_data['local_data']['rsync_exclude'])) {
             $rsync_file = $this->getFilePath($project_data['local_data']['rsync_exclude']);
             if (!file_exists($rsync_file)) {
                 throw new RsyncFileDoesNotExistsException();
             }
             $localdata->setRsyncexclude($rsync_file);
         }
         //REMOTE CONFIGURATIONS
         if (!empty($project_data['local_data']['remote_synch'])) {
             if (!empty($project_data['local_data']['remote_synch']["enabled"])) {
                 $localdata->setRemote($project_data['local_data']['remote_synch']["enabled"]);
                 if (!empty($project_data['local_data']['remote_synch']["name"])) {
                     $localdata->setRemoteName($project_data['local_data']['remote_synch']["name"]);
                 }
                 if (!empty($project_data['local_data']['remote_synch']["events"])) {
                     $localdata->setRemoteEvents($project_data['local_data']['remote_synch']["events"]);
                 }
                 if (!empty($project_data['local_data']['remote_synch']["branches"])) {
                     $localdata->setRemoteBranches($project_data['local_data']['remote_synch']["branches"]);
                 }
                 if (!empty($project_data['local_data']['remote_synch']["grunt"])) {
                     $localdata->setRemoteGrunt($project_data['local_data']['remote_synch']["grunt"]);
                 }
                 if (!empty($project_data['local_data']['remote_synch']["secret"])) {
                     $localdata->setRemoteSecret($project_data['local_data']['remote_synch']["secret"]);
                 }
             }
         }
         return $localdata;
     }
     return FALSE;
 }