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));
 }
 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);
 }
 public function createRepository($accountIdentifer, $projectIdentifier)
 {
     /**
      * @var \Extend\Library\ShellAdapter $projectShell
      */
     $projectShell = Loader::library('ShellAdapter');
     $projectShell->createProject($accountIdentifer . DIRECTORY_SEPARATOR . $projectIdentifier);
 }
 /**
  * 抽象方法,触发命令执行
  *
  * @return mixed
  */
 public function fire()
 {
     if (Loader::library('FindProjects', $this->args)->execute()) {
         exit(0);
     } else {
         exit(1);
     }
 }
 /**
  * 抽象方法,触发命令执行
  *
  * @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);
     }
 }
 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);
         }
     }
 }
 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]);
     }
 }
 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]);
 }
 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);
             }
         }
     }
 }
Example #10
0
function registerFunction()
{
    Loader::helper('Url');
    \Foundation\Support\Facades\View::registerFunction('baseUrl', 'baseUrl');
}
 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')]]);
 }
 function __construct()
 {
     parent::__construct();
     $connection = Loader::library('Connection/Connection');
     $this->_c = $connection->loadRemote('find');
 }