コード例 #1
0
 /**
  * Factory class instantiator - use this to load instances
  * @param modX $modx
  * @return gtpBuilder instance
  */
 public static function getInstance()
 {
     global $modx;
     if (self::$_instance == null) {
         self::$_instance = new self($modx);
     }
     return self::$_instance;
 }
コード例 #2
0
 public function process()
 {
     $this->helper = gtpBuilder::getInstance();
     $params = $this->getProperties();
     // Gather details
     $owner = $this->getProperty('owner', false);
     if (!$owner) {
         $this->addFieldError('owner', $this->modx->lexicon('gtpbuilder.repo_owner_ns'));
         return $this->failure($this->modx->lexicon('gtpbuilder.repo_owner_ns'));
     }
     $repo = $this->getProperty('repo', false);
     if (!$repo) {
         $this->addFieldError('repo', $this->modx->lexicon('gtpbuilder.repo_ns'));
         return $this->failure($this->modx->lexicon('gtpbuilder.repo_ns'));
     }
     $branch = $this->getProperty('branch', false);
     if (!$branch) {
         $this->addFieldError('branch', $this->modx->lexicon('gtpbuilder.repo_branch_ns'));
         return $this->failure($this->modx->lexicon('gtpbuilder.repo_branch_ns'));
     }
     $username = $this->getProperty('auth_user', false);
     if ($username !== false) {
         $password = $this->getProperty('auth_pass', false);
         if (!$password) {
             $this->addFieldError('auth_pass', $this->modx->lexicon('gtpbuilder.auth_pass_ns'));
             return $this->failure($this->modx->lexicon('gtpbuilder.auth_pass_ns'));
         }
     }
     $success = gtpBuilder::buildFromGithub('Github', $owner, $repo, $branch, $username, $password);
     if ($success) {
         $this->helper->warn('Package built successfully');
         $this->helper->log('COMPLETED');
         return $this->success();
     } else {
         $this->helper->warn('Package build failed');
         $this->helper->log('COMPLETED');
         return $this->failure();
     }
 }
コード例 #3
0
 public function __construct()
 {
     $this->gtp = gtpBuilder::getInstance();
 }
コード例 #4
0
<?php

$path = $modx->getOption('core_path') . 'components/gtpbuilder/';
if (!class_exists('gtpBuilder')) {
    require $path . 'gtpbuilder.class.php';
}
$owner = 'alanpich';
$repo = 'grideditor';
$branch = 'master';
gtpBuilder::buildFromGithub($owner, $repo, $branch);