Ejemplo n.º 1
0
 protected function getRefList(Project $project)
 {
     $list = [];
     foreach ($project->getSortedRefs() as $ref) {
         $list[$ref] = $project->url(null, $ref);
     }
     return $list;
 }
Ejemplo n.º 2
0
 public function __construct(Factory $docit, Filesystem $files, Project $project, Container $container)
 {
     ini_set('memory_limit', '2G');
     $path = $project->path($project->config('phpdoc_hook_settings.path'));
     $pathName = 'phpdoc';
     parent::__construct($docit, $files, $project, $container, $path, $pathName);
     $this->parser = new PhpdocParser();
     $this->mergeAttributes($project->config('phpdoc_hook_settings'));
     $this->setPath($path);
 }
Ejemplo n.º 3
0
 /**
  * handle
  *
  * @param \Docit\Core\Project $project
  */
 public function handle(Project $project)
 {
     $that = $this;
     Project::macro('getPhpdocDocument', function () use($that) {
         /** @var Project $this */
         return $that->container->make(PhpdocDocument::class, ['project' => $this, 'factory' => $this->getFactory()]);
     });
 }
Ejemplo n.º 4
0
 /**
  * handle
  *
  * @param \Docit\Core\Project $project
  */
 public function handle(Project $project)
 {
     $that = $this;
     // Add a method on the project class that creates a new GitSync for that specific project
     Project::macro('githubSync', function () {
         /** @var Project $this */
         return app('docit.hooks.github.factory')->githubSync($this);
     });
     // Add a method on the project class that creates a new GitSync for that specific project
     Project::macro('githubShow', function () use($that) {
         /** @var Project $this */
         return app('docit.hooks.github.factory')->githubShow($this);
     });
 }
Ejemplo n.º 5
0
 /**
  * Handle the hook.
  *
  * @param  \Docit\Core\Project $project
  * @return void
  */
 public function handle(Project $project)
 {
     if (!$project->config('enable_filesystem_hook')) {
         $project->setFiles(new LocalFilesystem());
     }
     $disk = $project->config('default_filesystem_disk');
     $settings = $project->config('filesystem_hook_settings');
     if (!isset($settings[$disk])) {
         return;
     }
     $files = $this->fsm->disk($disk);
     if (isset($files)) {
         $project->setFiles($files);
         $project->setPath($project->getName());
     }
 }
Ejemplo n.º 6
0
 /**
  * handle
  *
  * @param \Docit\Core\Project $project
  */
 public function handle(Project $project, Menu $menu)
 {
     if (!$project->config('enable_phpdoc_hook', false)) {
         return;
     }
     $node = $menu->add('phpdoc', $project->config('phpdoc_hook_settings.menu_name'));
     $node->setMeta('icon', $project->config('phpdoc_hook_settings.menu_icon'));
     $node->setAttribute('href', route('docit.phpdoc', ['projectName' => $project->getName(), 'ref' => $project->getRef()]));
 }
Ejemplo n.º 7
0
 public function getVersionsToSync()
 {
     $versionsToSync = [];
     $currentVersions = $this->project->getRefs();
     $allowedVersionRange = new expression($this->setting('sync.sync.versions'));
     $tags = $this->github->repositories()->tags($this->setting('owner'), $this->setting('repository'));
     foreach ($tags as $tag) {
         try {
             $version = new version($tag['name']);
         } catch (SemVerException $e) {
             continue;
         }
         if ($version->satisfies($allowedVersionRange) === false or in_array($version->getVersion(), $currentVersions, true)) {
             continue;
         }
         $versionsToSync[] = $version;
     }
     return $versionsToSync;
 }
Ejemplo n.º 8
0
 public function githubShow(Project $project)
 {
     return new GitShow($this, $project, $this->githubClient(), $project->getFiles(), $this->cache);
 }
Ejemplo n.º 9
0
 /**
  * Returns an array of parent menu items
  *
  * @return array
  */
 public function getBreadcrumb()
 {
     return $this->project->getDocumentsMenu()->getBreadcrumbToHref($this->url());
 }
Ejemplo n.º 10
0
 public function setting($key, $default = null)
 {
     return array_get($this->project->config('github_hook_settings'), $key, $default);
 }