Exemplo n.º 1
0
 /**
  * getVars
  *
  * @param null $packageName
  * @return array
  */
 public function getGeneratorVars($directory)
 {
     $stubDir = $this->codex->config('stubs_path');
     $destDir = $this->codex->getRootDir() . DIRECTORY_SEPARATOR . $directory;
     $vars = ['config' => array_dot($this->codex->config()), 'open' => '<?php', 'stubDir' => $stubDir, 'destDir' => $destDir, 'directory' => $directory];
     return $vars;
 }
Exemplo n.º 2
0
 public function handle()
 {
     $projects = [];
     $choices = [];
     foreach ($this->factory->getProjects() as $project) {
         if ($project->config('enable_git_hook', false) === true) {
             $projects[] = $project;
             $choices[] = $project->getName();
         }
     }
     $project = $this->choice('Pick the git enabled project you wish to sync', $choices);
     if ($this->option('queue')) {
         app('codex.hooks.git')->createSyncJob($project);
         $this->comment('Created sync job and pushed it onto the queue.');
     } else {
         $this->comment('Starting synchronisation. This might take a while.');
         app('codex.hooks.git')->gitSyncer($this->factory->getProject($project))->syncAll();
     }
 }
Exemplo n.º 3
0
 protected function applyToGitProjects($remote, \Closure $closure)
 {
     foreach ($this->codex->getProjects() as $project) {
         if ($project->config('enable_git_hook', false) === false || $project->config('git_hook_settings.webhook.enabled', false) === false) {
             continue;
         }
         $config = $project->config('git_hook_settings');
         $projectRepo = $project->config('git_hook_settings.owner') . '/' . $project->config('git_hook_settings.repository');
         $hook = call_user_func_array($closure, [$project]);
         if ($hook instanceof Response) {
             return $hook;
         }
         if ($hook['repository'] !== $projectRepo) {
             continue;
         }
         $this->factory->createSyncJob($project);
         $this->codex->log('info', 'codex.hooks.git.webhook.call', ['remote' => $remote]);
         return response('', 200);
     }
 }
Exemplo n.º 4
0
 protected function applyToGitProjects($remote, \Closure $closure)
 {
     foreach ($this->codex->projects->all() as $project) {
         $name = $project->getName();
         $enabled = $project->hasEnabledHook('git');
         $webhook = $project->config('hooks.git.webhook.enabled', false);
         if (!$enabled || !$webhook) {
             continue;
         }
         $projectRepo = $project->config('hooks.git.owner') . '/' . $project->config('hooks.git.repository');
         $hook = call_user_func_array($closure, [$project]);
         if ($hook instanceof Response) {
             return $hook;
         }
         if ($hook !== $projectRepo) {
             continue;
         }
         $this->git->createSyncJob($project);
         $this->codex->log('info', 'codex.hooks.git.webhook.call', ['remote' => $remote]);
         return response('', 200);
     }
 }
Exemplo n.º 5
0
 public function handle(CodexFactory $codex)
 {
     $codex->setConfig(array_replace_recursive($codex->config(), $this->config->get('codex.hooks.git.default_project_config')));
 }