예제 #1
0
파일: Git.php 프로젝트: zitec/CodePaxCLI
 /**
  * Class constructor
  *
  * @param string $_git_user svn user
  * @param string $_git_pass svn pass
  * @param string $_git_url url to repository
  * @param string $_project_folder project folder
  * */
 public function __construct($_git_user, $_git_pass, $_git_url, $_project_folder)
 {
     parent::__construct();
     if (defined('PATH_TO_GIT_BIN')) {
         $this->path_to_git_bin = PATH_TO_GIT_BIN;
     }
     $this->project_folder = $_project_folder;
     if ($this->is_windows) {
         $this->path_to_git_bin = "\"{$this->path_to_git_bin}\"";
         $this->project_folder = "\"{$_project_folder}\"";
     }
     $this->git_connection_string = "cd {$this->project_folder}{$this->command_separator}{$this->path_to_git_bin}";
     $this->checkLocalConfig();
     if (!defined('GIT_PROTOCOL') || defined('GIT_PROTOCOL') && GIT_PROTOCOL != 'HTTPS' || GIT_REMOTE_NAME != 'origin') {
         $this->checkRemoteConfig($_git_user, $_git_pass, $_git_url);
     }
     $this->remoteUpdate();
     //--- set repository info
     $shell_command = $this->git_connection_string . " log --max-count=1 " . self::GET_RESULT_DIRECTIVE;
     $response_string = shell_exec($shell_command);
     if (isset($response_string)) {
         $this->git_info = $response_string;
     }
 }
예제 #2
0
파일: Svn.php 프로젝트: zitec/CodePaxCLI
 /**
  * Class constructor
  *
  * @param string $_svn_user svn user
  * @param string $_svn_pass svn pass
  * @param string $_svn_url url to repository
  * @param string $_project_folder project folder
  * */
 public function __construct($_svn_user, $_svn_pass, $_svn_url, $_project_folder)
 {
     parent::__construct();
     if (defined('PATH_TO_SVN_BIN')) {
         $this->path_to_svn_bin = PATH_TO_SVN_BIN;
     }
     $this->svn_url = $_svn_url;
     $this->project_folder = $_project_folder;
     if ($this->is_windows) {
         $this->path_to_svn_bin = "\"{$this->path_to_svn_bin}\"";
         $this->project_folder = "\"{$_project_folder}\"";
     }
     $this->svn_connection_string = "{$this->path_to_svn_bin} --non-interactive --username={$_svn_user} --password={$_svn_pass}";
     //--- set repository info
     $shell_command = "{$this->path_to_svn_bin} info {$this->project_folder}";
     $response_string = shell_exec($shell_command);
     if (isset($response_string)) {
         $this->svn_info = urldecode(substr($response_string, 0, -2));
     }
 }