/**
  * Download and make an addon from a Builder template.
  * --force will re-download an exist template
  */
 public function handle()
 {
     $this->logo();
     if ($this->download($template = $this->argument('template'), $this->option('force'))) {
         /* read the Builder template metadata and return the templaet context object */
         $context = $this->getTemplateContext($template);
         list($vendor, $type, $slug, $path) = _resolveAddonNamespace(_render('{{ vendor }}.{{ type }}.{{ slug }}', $context), $this->option('shared'));
         $this->dispatch(new ScaffoldTemplate($vendor, $type, $slug, $this->getBuilderPath($template), $path, $context));
         $this->info("Builder has successfully created an addon from '{$template}'");
     } else {
         $this->output->error("Builder template not found. Use 'builder:list' command for a list of avilable templates.");
     }
 }
Exemplo n.º 2
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);
 }
 /**
  * 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);
 }