コード例 #1
0
 public function index($userName, $projectName)
 {
     /**
      * @var \Proxy\ProjectProxy $projectProxy
      */
     $projectProxy = Loader::proxy('ProjectProxy');
     $memberCount = $projectProxy->getProjectMemberCount($this->project->id);
     $roles = $projectProxy->getProjectMemberWithRole($this->project->id);
     /**
      * @var \Proxy\NoticeProxy $noticeProxy
      */
     $noticeProxy = Loader::proxy('NoticeProxy');
     $notices = $noticeProxy->getNoticeByProject($this->project->id, 5);
     Loader::library('NoticeAdapter/NoticeAdapter', null, FALSE);
     $noticeFormats = [];
     foreach ($notices as $notice) {
         $noticeFormats[] = NoticeAdapter::newNotice($notice);
     }
     /**
      * @var Model/Repository $repo
      */
     $repo = $this->project->repository();
     $readme = $repo->readme();
     View::render('project_index', array('pageName' => 'project_index', 'account' => $this->account, 'project' => $this->project, 'memberCount' => $memberCount, 'roles' => $roles, 'notices' => $noticeFormats, 'readme' => $readme));
 }
コード例 #2
0
 function __construct($accountIdentifier, $projectIdentifier)
 {
     $this->_shell = Loader::library('ShellAdapter');
     $repoHome = $this->_shell->getRepoHome();
     $this->_path = $repoHome . DS . $accountIdentifier . DS . $projectIdentifier . '.git';
     $this->_currentBranch = $this->_shell->getCurrentBranch($this);
 }
コード例 #3
0
 public function createRepository($accountIdentifer, $projectIdentifier)
 {
     /**
      * @var \Extend\Library\ShellAdapter $projectShell
      */
     $projectShell = Loader::library('ShellAdapter');
     $projectShell->createProject($accountIdentifer . DIRECTORY_SEPARATOR . $projectIdentifier);
 }
コード例 #4
0
 /**
  * 抽象方法,触发命令执行
  *
  * @return mixed
  */
 public function fire()
 {
     if (Loader::library('FindProjects', $this->args)->execute()) {
         exit(0);
     } else {
         exit(1);
     }
 }
コード例 #5
0
 /**
  * 抽象方法,触发命令执行
  *
  * @return mixed
  */
 public function fire()
 {
     $key = $this->args[0];
     $originCommand = getenv('SSH_ORIGINAL_COMMAND');
     $shell = Loader::library('FindShell', ['keyId' => $key, 'command' => $originCommand]);
     if ($shell->execute()) {
         exit(0);
     } else {
         exit(1);
     }
 }
コード例 #6
0
 public function handle(array $params = null)
 {
     $turbo = Loader::library('Turbolink');
     if ($turbo->isPjax()) {
         $response = Response::getInstance();
         if (is_a($response, 'Foundation\\Http\\Response')) {
             $content = (string) $response->getOutput();
             $body = $turbo->extract($content);
             $response->setOutput($body);
         }
     }
 }
コード例 #7
0
 function __construct($params)
 {
     $this->keyId = $params['keyId'];
     $this->originCommand = $params['command'];
     $this->config = FindConfig::getInstance();
     $this->reposPath = $this->config->reposPath();
     $this->proxy = Loader::proxy('FindProxy');
     $this->user = $this->proxy->getUserByKey($this->keyId);
     if (empty($this->user)) {
         Exception::throwException(30001, [$this->keyId]);
     }
 }
コード例 #8
0
 public function checkAccess()
 {
     Loader::helper('Repo');
     $command = Input::request('command');
     $keyId = Input::request('key_id');
     $repo = fetchRepoIdentifier(Input::request('repo'));
     $result = false;
     if ($command == 'git-upload-pack') {
         $result = $this->_pullCommandAccessCheck($repo, $keyId);
     } else {
         $result = $this->_pushCommandAccessCheck($repo, $keyId);
     }
     Response::json(['code' => 0, 'data' => $result]);
 }
コード例 #9
0
 function __construct()
 {
     parent::__construct();
     $this->validation = Loader::library('Validation');
     $this->validation->load('Api');
     if (!$this->validation->run()) {
         $errors = $this->validation->error();
         foreach ($errors as $key => $value) {
             if (!empty($value)) {
                 ErrorManager::throwCustomException(500, $value);
             }
         }
     }
 }
コード例 #10
0
function registerFunction()
{
    Loader::helper('Url');
    \Foundation\Support\Facades\View::registerFunction('baseUrl', 'baseUrl');
}
コード例 #11
0
 public function processCreateProject()
 {
     $args = Input::post();
     /**
      * @var \Proxy\ProjectProxy $projectProxy
      */
     $projectProxy = Loader::proxy('ProjectProxy');
     //创建项目
     $project = $projectProxy->createProject($args);
     Response::json(['code' => 0, 'data' => ['project' => $project, 'account' => Request::getParameter('currentAccount')]]);
 }
コード例 #12
0
 function __construct()
 {
     parent::__construct();
     $connection = Loader::library('Connection/Connection');
     $this->_c = $connection->loadRemote('find');
 }