Example #1
0
 /**
  * getVars
  *
  * @param null $packageName
  * @return array
  */
 public function getGeneratorVars($directory)
 {
     $stubDir = $this->docit->config('stubs_path');
     $destDir = $this->docit->getRootDir() . DIRECTORY_SEPARATOR . $directory;
     $vars = ['config' => array_dot($this->docit->config()), 'open' => '<?php', 'stubDir' => $stubDir, 'destDir' => $destDir, 'directory' => $directory];
     return $vars;
 }
Example #2
0
 public function handle()
 {
     $githubProjects = [];
     $choices = [];
     foreach ($this->factory->getProjects() as $project) {
         if ($project->config('enable_github_hook', false) && $project->config('github_hook_settings.sync.enabled', false)) {
             $githubProjects[] = $project;
             $choices[] = $project->getName();
         }
     }
     $project = $this->choice('Pick the github enabled project you wish to sync', $choices);
     if ($this->option('queue')) {
         $this->queue->push(\Docit\Hooks\Github\Commands\GithubSyncProject::class, ['project' => $project]);
     } else {
         $project = $this->factory->getProject($project);
         $total = count($project->githubSync()->getBranchesToSync()) + count($project->githubSync()->getVersionsToSync());
         if ($total === 0) {
             $this->info('Nothing to sync. Everything is up-to-date');
             return;
         }
         $this->output->progressStart($total);
         $that = $this;
         $project->githubSync()->syncWithProgress(function ($current) use($that) {
             $that->output->progressAdvance();
         });
         $this->output->progressFinish();
         $this->info('Synchronised ' . $total . ' versions/branches');
     }
 }
Example #3
0
 public function handle()
 {
     $show = $this->factory->githubShow($this->docit->getProject('caffeinated-beverage'));
     $issues = $show->getIssues();
     $stats = $show->getStars();
     $a = 'a';
 }
Example #4
0
 /**
  * Resolves and creates the documents menu from the parsed menu.yml
  *
  * @param array       $items The array converted from yaml
  * @param string $parentId
  * @return \Docit\Core\Menus\Menu
  */
 protected function resolveDocumentsMenu($items, $parentId = 'root')
 {
     /**
      * @var Menus\Menu $menu
      */
     $menu = $this->factory->getMenus()->add('project_sidebar_menu');
     foreach ($items as $item) {
         $link = '#';
         if (array_key_exists('document', $item)) {
             // remove .md extension if present
             $path = Str::endsWith($item['document'], '.md', false) ? Str::remove($item['document'], '.md') : $item['document'];
             $link = $this->factory->url($this, $this->ref, $path);
         } elseif (array_key_exists('href', $item)) {
             $link = $item['href'];
         }
         $id = md5($item['name'] . $link);
         $node = $menu->add($id, $item['name'], $parentId);
         $node->setAttribute('href', $link);
         $node->setAttribute('id', $id);
         if (isset($item['icon'])) {
             $node->setMeta('icon', $item['icon']);
         }
         if (isset($item['children'])) {
             $this->resolveDocumentsMenu($item['children'], $id);
         }
     }
     return $menu;
 }
Example #5
0
 /**
  * Handle the factory hook.
  *
  * @param  \Docit\Core\Factory  $factory
  * @return void
  */
 public function handle(Factory $factory)
 {
     $factory->setConfig(array_replace_recursive($factory->config(), $this->config->get('docit.hooks.filesystem.default_project_config')));
 }
Example #6
0
 /**
  * Get the url to this document
  *
  * @return string
  */
 public function url()
 {
     return $this->docit->url($this->project, $this->project->getRef(), $this->pathName);
 }
Example #7
0
 /**
  * Handle the factory hook.
  *
  * @param  \Docit\Core\Factory  $factory
  * @return void
  */
 public function handle(Factory $factory)
 {
     $factory->setConfig(array_replace_recursive($factory->config(), $this->config->get('docit.hooks.phpdoc')));
 }
Example #8
0
 public function handle(DocitFactory $docit)
 {
     $docit->setConfig(array_replace_recursive($docit->config(), $this->config->get('docit.hooks.github.default_project_config')));
 }