/**
  * Handle the command.
  *
  * @param  InstallExtension|Kernel      $console
  * @param  AddonManager                 $manager
  * @param  Dispatcher                   $dispatcher
  * @param  ExtensionRepositoryInterface $extensions
  * @return bool
  */
 public function handle(Kernel $console, AddonManager $manager, Dispatcher $dispatcher, ExtensionRepositoryInterface $extensions)
 {
     $this->extension->fire('installing');
     $options = ['--addon' => $this->extension->getNamespace(), '--force' => true];
     $console->call('migrate:refresh', $options);
     $extensions->install($this->extension);
     $manager->register();
     if ($this->seed) {
         $console->call('db:seed', $options);
     }
     $this->extension->fire('installed');
     $dispatcher->fire(new ExtensionWasInstalled($this->extension));
     return true;
 }
Exemplo n.º 2
0
 /**
  * Execute the console command.
  */
 public function fire(AddonManager $addons)
 {
     $namespace = $this->argument('namespace');
     if (!str_is('*.*.*', $namespace)) {
         throw new \Exception("The namespace should be snake case and formatted like: {vendor}.{type}.{slug}");
     }
     list($vendor, $type, $slug) = array_map(function ($value) {
         return str_slug(strtolower($value), '_');
     }, explode('.', $namespace));
     $type = str_singular($type);
     $path = $this->dispatch(new MakeAddonPaths($vendor, $type, $slug, $this));
     $this->dispatch(new WriteAddonLang($path, $type, $slug));
     $this->dispatch(new WriteAddonClass($path, $type, $slug, $vendor));
     $this->dispatch(new WriteAddonComposer($path, $type, $slug, $vendor));
     $this->dispatch(new WriteAddonServiceProvider($path, $type, $slug, $vendor));
     $addons->register();
     if ($type == 'module' || $this->option('migration')) {
         $this->call('make:migration', ['name' => 'create_' . $slug . '_fields', '--addon' => "{$vendor}.{$type}.{$slug}", '--fields' => true]);
     }
 }
Exemplo n.º 3
0
 /**
  * Execute the console command.
  */
 public function fire(Dispatcher $events, Application $application, AddonManager $manager)
 {
     $this->dispatch(new ConfirmLicense($this));
     $data = new Collection();
     $this->dispatch(new SetStreamsData($data));
     $this->dispatch(new SetDatabaseData($data, $this));
     $this->dispatch(new SetApplicationData($data, $this));
     $this->dispatch(new SetAdminData($data, $this));
     $this->dispatch(new SetOtherData($data, $this));
     $this->dispatch(new WriteEnvironmentFile($data->all()));
     $this->dispatch(new ReloadEnvironmentFile());
     $this->dispatch(new ConfigureDatabase());
     $this->dispatch(new SetDatabasePrefix());
     $this->dispatch(new LocateApplication());
     $installers = new InstallerCollection();
     $this->dispatch(new LoadCoreInstallers($installers));
     $this->dispatch(new LoadApplicationInstallers($installers));
     $this->dispatch(new LoadModuleInstallers($installers));
     $this->dispatch(new LoadExtensionInstallers($installers));
     $this->dispatch(new RunInstallers($installers, $this));
     $this->call('env:set', ['line' => 'INSTALLED=true']);
     $this->dispatch(new ReloadEnvironmentFile());
     $installers->add(new Installer('streams::installer.running_migrations', function (Kernel $console) {
         $console->call('migrate', ['--force' => true, '--no-addons' => true]);
     }));
     $manager->register();
     // Register all of our addons.
     $events->fire(new StreamsHasInstalled($installers));
     $this->info('Running post installation tasks.');
     $this->dispatch(new LoadModuleSeeders($installers));
     $this->dispatch(new LoadExtensionSeeders($installers));
     $installers->add(new Installer('streams::installer.running_seeds', function (Kernel $console) {
         $console->call('db:seed', ['--force' => true]);
     }));
     $this->dispatch(new RunInstallers($installers, $this));
 }