Setup composer packages.

@return $this
420278
protected function setupComposerPackages()
    {
        $platform = $this->getPlatformInstance();

        if ($platform instanceof ComposerPackageInterface) {
            $platform->alterComposer($this->composer);
        }
        $this->saveComposer();

        return $this;
    }
1191469
protected function addThemePackageToRootComposer()
    {
        $composer = json_decode(file_get_contents(base_path('composer.json')), true);

        $composer['require'][$this->argument('name')] = '*';

        file_put_contents(
            base_path('composer.json'),
            json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
        );
    }
1268199
public function withPackage($packages)
    {
        $packages = is_array($packages)
            ? $packages
            : func_get_args();

        $this->package->with($packages);

        return $this;
    }
1140864
public function setupBehat()
    {
        $root_path = ProjectX::projectRoot();
        $behat_path = "{$root_path}/tests/Behat/behat.yml";

        $this->taskFilesystemStack()
            ->mkdir("{$root_path}/tests/Behat", 0775)
            ->copy($this->getTemplateFilePath('tests/behat.yml'), $behat_path)
            ->run();

        $this->composer->addRequires([
            'behat/behat' => static::BEHAT_VERSION,
        ], true);

        return $this;
    }
850399
protected function updateComposerConfig()
    {
        parent::updateComposerConfig();
        $this->composerManager->updateProjectConfig(array(
            'name' => $this->composerManager->createPackageName($this->projectName),
            'license' => 'proprietary',
            'description' => null,
            'extra' => array('branch-alias' => null),
        ));

        return $this;
    }
397721
private function initInstalledPackages()
    {
        /** @var PackageInterface $package */
        foreach ($this->installedRepository->getPackages() as $package) {
            $operator = $this->getFilterOperator($package);
            /** @var Link $link */
            $link = current($this->arrayLoader->parseLinks($this->package->getName(), $this->package->getVersion(), 'installed', array($package->getName() => $operator.$package->getPrettyVersion())));
            $link = $this->includeRootConstraint($package, $link);

            $this->requires[$package->getName()] = $link;
        }
    }
717128
protected function _setup()
    {
        if (!file_exists($this->getConsoleHome()))
        {
            $result = @mkdir($this->getConsoleHome(), 0775, true);

            if (!$result) {
                $this->_output->writeln(sprintf('<error>Unable to write to home directory: %s. Please check write permissions.</error>', getenv('HOME')));
            }
        }

        // Handle legacy plugin directory
        if (is_writable($this->getConsoleHome()) && !file_exists($this->getPluginPath()))
        {
            $old = realpath(dirname(__FILE__) . '/../../../plugins/');

            if (file_exists($old))
            {
                $this->_output->writeln('<comment>Moving legacy plugin directory to ~/.joomlatools-console/plugins.</comment>');

                $cmd = sprintf('mv %s %s', escapeshellarg($old), escapeshellarg($this->getPluginPath()));
                exec($cmd);
            }
        }
    }
1289133
private function setup()
    {
        if ($this->started) {
            return;
        }

        if ($this->app['extend.writeable']) {
            // Do required JSON update/set up
            try {
                $this->updateJson();
            } catch (ParseException $e) {
                $this->app['logger.flash']->danger(Trans::__('Error reading extensions/composer.json file: %ERROR%', ['%ERROR%' => $e->getMessage()]));
                $this->started = false;

                return;
            }
        }

        $this->started = true;
    }
636462
protected function registerInstallCommand(): void
    {
        $this->app->singleton('orchestra.commands.tenanti.install', function (Application $app) {
            return new InstallCommand($app->make('orchestra.tenanti'));
        });
    }
702454
protected function setupConsoleCommands()
    {
        // Share dashboard:install command with the application.
        $this->app['dashboard::install'] = $this->app->share(function () {
            return new InstallerCommand();
        });

        // Share dashboard:setup command with the application.
        $this->app['dashboard::setup'] = $this->app->share(function () {
            return new SetupCommand();
        });

        // Share dashboard:fresh command with the application.
        $this->app['dashboard::fresh'] = $this->app->share(function () {
            return new FreshCommand();
        });

        // Share dashboard:uninstall command with the application.
        $this->app['dashboard::uninstall'] = $this->app->share(function () {
            return new UninstallCommand();
        });

        // Adds dashboard:install to the console kernel.
        $this->commands('dashboard::install');

        // Adds dashboard:setup to the console kernel.
        $this->commands('dashboard::setup');

        // Adds dashboard:fresh to the console kernel.
        $this->commands('dashboard::fresh');

        // Adds dashboard:uninstall to the console kernel.
        $this->commands('dashboard::uninstall');
    }
625956
public function installed()
    {
        try {
            return $this->json($this->manager()->getAllPackages());
        } catch (\Exception $e) {
            return $this->getJsonException($e);
        }
    }
951561
final public function install()
    {
        // Initiate Flysystem
        $this->files = new Filesystem();

        // Make sure we have the Console Output style
        // before continuing with the install sequence
        if (empty($this->getCommand())) {
            throw new InstallPackageException('Could not run install sequence. Reason: Missing Console Output reference.');
        }

        // Run install methods
        $this->prepareInstall();
        $this->installConfigs();
        $this->installFacades();
        $this->installScaffolding();
        $this->installViews();
        $this->installAssets();
        $this->installCustom();
        $this->installDatabase();
        $this->finishInstall();
    }
147835
public function registerPackages(array $packages)
    {
        foreach ($packages as $alias => $package) {
            $this->addPackage($alias, $package);
        }

        return $this;
    }
1030128
protected function install()
    {
        $installScripts = array();
        foreach ($this->autoloaderCollection as $dir => $jsonAutoloader) {
            $bundleName = $jsonAutoloader->getBundleName();
            $this->installPackage($dir, $jsonAutoloader);

            // Check if the bundle under exam has attached an ActionManager file
            $actionsManager = $jsonAutoloader->getActionManager();
            if ((!array_key_exists($bundleName, $this->installedBundles) && null !== $actionsManager)) {
                if (null !== $jsonAutoloader->getActionManagerClass()) {
                    $installScripts[$bundleName] = $actionsManager;

                    // Copies the current ActionManager class to app/config/bundles/cache folder
                    // because it must be preserved when a bundle is uninstalled
                    $reflection = new \ReflectionClass($actionsManager);
                    $fileName = $reflection->getFileName();
                    $className = $this->cachePath . '/' . $bundleName . '/' . basename($fileName);
                    $this->filesystem->copy($fileName, $className, true);
                }
            }

            unset($this->installedBundles[$bundleName]);
        }

        $installerScript = $this->scriptFactory->createScript('PreBootInstaller');
        $installerScript->executeActions($installScripts);
    }
620119
public function addDependency($packages)
    {
        $packages = is_array($packages) ? $packages : func_get_args();

        foreach ($packages as $package) {
            $this->dependency[] = $package;
        }

        return $this;
    }
52869
public function install()
    {
        $grumPhpFile = $this->destination . '/grumphp.yml';

        if (file_exists($grumPhpFile)) {
            unlink($grumPhpFile);
            $this->io->write(
                sprintf(
                    '<comment>Removed:</comment> existing GrumPHP config file %s',
                    $grumPhpFile
                )
            );
        }

        $definition = $this->file->read();
        if (!empty($definition['extra']['grumphp']['config-default-path'])) {
            return;
        }

        $definition['extra']['grumphp']['config-default-path'] =
            'vendor/mediact/testing-suite/config/default/grumphp.yml';

        $this->file->write($definition);
        $this->io->write(
            '<info>Added:</info> GrumPHP config to composer.json'
        );
    }
286828
protected function setupPackage()
    {
        $configuration = realpath(__DIR__.'/../config/credentials.php');
        $migrations = realpath(__DIR__.'/../migrations');

        $this->publishes([
            $configuration => config_path('credentials.php'),
            $migrations    => base_path('database/migrations'),
        ]);

        $this->mergeConfigFrom($configuration, 'credentials');

        $this->loadViewsFrom(realpath(__DIR__.'/../views'), 'credentials');
    }