コード例 #1
0
 /**
  * Execute the console command.
  */
 public function fire(AddonManager $addons)
 {
     list($vendor, $type, $slug, $path) = _resolveAddonNamespace($this->argument('namespace'), $this->option('shared'));
     if ($type === 'module') {
         $this->logo();
         /* Get the default module template from the registry */
         if ($this->download($template = _config('config.default-module'), $this->option('force'))) {
             $context = $this->getTemplateContext($template, ['vendor' => $vendor, 'slug' => $slug], true);
             $this->dispatch(new ScaffoldTemplate($vendor, $type, $slug, $this->getBuilderPath(_config('config.default-module')), $path, $context));
             $this->info("Builder has successfully created a module addon from '{$template}'");
             return;
         } else {
             /* When things go wrong - which does happen sometimes - fallback to Pyro make:addon */
             $this->ignoreJobs = false;
         }
     }
     parent::fire($addons);
 }
コード例 #2
0
 /**
  * Execute the console command.
  */
 public function fire(AddonManager $addons)
 {
     $this->logo();
     list($vendor, $type, $slug, $path) = _resolveAddonNamespace($this->argument('namespace'), $this->option('shared'));
     /* Get the template name if provided by the user */
     if (!($template = $this->argument('template'))) {
         /* otherwise, construct an index for a potential template based on the addon type  */
         $index = "templates.{$type}" . ($type !== 'theme' ? "" : ($this->option('admin') ? '.0' : '.1'));
         /* if the template option is provided, create a template project, not the actual addon */
         $template = _config("config." . ($this->option('template') ? "default-template" : $index));
     }
     if ($template && $this->download($template, $this->option('force'))) {
         $context = $this->getTemplateContext($template, ['vendor' => $vendor, 'slug' => $slug, 'type' => $type], true, $this->option('defaults'));
         $this->dispatch(new ScaffoldTemplate($vendor, $type, $slug, $this->getBuilderPath($template), $path, $context));
         $this->info("Builder has successfully created a {$type} addon from '{$template}' at:");
         $this->line($path);
         return;
     } else {
         /* When things go wrong - which happens sometimes - fallback to Pyro make:addon */
         $this->ignoreJobs = false;
     }
     parent::fire($addons);
 }