Install the specified module.

@param string $name
@param string $version
@param string $type
@param bool   $subtree

@return \Symfony\Component\Process\Process
768125
public function install($name, $version = 'dev-master', $type = 'composer', $subtree = false)
    {
        $installer = new Installer($name, $version, $type, $subtree);

        return $installer->run();
    }
611549
public function installPackage(string $name, string $version, bool $dev = true)
    {
        $node = $dev ? 'require-dev' : 'require';

        if (array_key_exists($node, $this->definition)
            && array_key_exists($name, $this->definition[$node])
        ) {
            return;
        }

        $application = new Application();
        $command     = new RequireCommand();

        $definition = clone $application->getDefinition();
        $definition->addArguments($command->getDefinition()->getArguments());
        $definition->addOptions($command->getDefinition()->getOptions());

        $input = new ArrayInput(
            [
                'command' => 'require',
                'packages' => [$name . ':' . $version],
                '--dev' => $dev,
                '--no-scripts' => true,
                '--no-interaction' => true,
                '--no-plugins' => true,
                '--working-dir' => $this->workingDir
            ],
            $definition
        );

        $application->setAutoExit(false);
        $application->run($input, $this->output);
    }
1109243
public function install($module, $version, $options = null)
    {
        $module = strtolower($module);
        $options = is_null($options) ? array() : $options;
        
        $modules = $this->findModules();
        $current = array();
    
        foreach($modules as $name){
            $modVersion = $this->getModuleVersion($name);
            
            if ($modVersion) {
                $current[$name] = new SoftwareVersion(
                    $this->getModuleVersion($name));
            }
        }
        
        // Resolve deps
        $deps = $this->resolveDependencies(
            $module
        );
        
        if (!$deps->offsetExists($module)) {
            $deps->offsetSet($module, $version);
        }
        
        $queue = new PriorityQueue();
        
        // Setup all dependencies
        foreach($deps as $depModule => $depVersion){
            if(!$this->hasSetupService($depModule)){
                continue;
            }
    
            $setup = $this->initSetupService($depModule);
            $queue->insert(['service' => $setup, 'module' => $depModule], $setup->getPriority());
        }
        
        foreach ($queue->getIterator() as $datum) {
            $service    = $datum['service'];
            $depModule  = $datum['module'];
            $operation  = 'setup';
            $args       = array();
        
            if ($depModule == $module) {
                $args['options'] = $options;
            }
             
            // complete existing installation
            $service->exec(
                $operation,
                $args
            );
        }
        
        return true;
    }
399982
public static function create(Package $package, $version)
    {
        $result = new static();
        $result->package = $package;
        $result->version = (string) $version;
        $result->createdOn = new DateTime();
        $result->updatedOn = new DateTime();

        return $result;
    }
1201025
public static function create($name, $type, $extension, $vendor)
    {
        // Prepare the component name
        $componentLabel = $componentName = array_pop($name);
        if (substr($componentName, -9) !== 'Component') {
            $componentName .= 'Component';
        }

        // Prepare the component directory
        $componentPath    = implode(DIRECTORY_SEPARATOR, $name);
        $componentAbsPath = GeneralUtility::getFileAbsFileName(
            'EXT:'.$extension.DIRECTORY_SEPARATOR.'Components'.DIRECTORY_SEPARATOR
            .implode(DIRECTORY_SEPARATOR, $name)
        );
        if (!is_dir($componentAbsPath) && !mkdir($componentAbsPath, 06775, true)) {
            throw new CommandException('Could not create component directory', 1507997978);
        }

        // Prepare the component namespace
        $componentNamespace = rtrim(
            $vendor.'\\'.GeneralUtility::underscoredToUpperCamelCase($extension)
            .'\\Component\\'.implode('\\', $name),
            '\\'
        );

        // Copy the skeleton template
        $substitute       = [
            '###extension###' => $extension,
            '###namespace###' => $componentNamespace,
            '###label###'     => $componentLabel,
            '###tspath###'    => strtolower(implode('.', array_merge($name, [$componentLabel]))),
            '###path###'      => $componentPath,
        ];
        $skeletonTemplate = GeneralUtility::getFileAbsFileName(
            'EXT:tw_componentlibrary/Resources/Private/Skeleton/'.ucfirst($type).'.php'
        );
        $skeletonString   = strtr(file_get_contents($skeletonTemplate), $substitute);
        $skeletonFile     = $componentAbsPath.DIRECTORY_SEPARATOR.$componentName.'.php';
        file_put_contents($skeletonFile, $skeletonString);
        chmod($skeletonFile, 0664);
    }
146902
public void mergeSubsystem(final GlobalTransformerRegistry registry, String subsystemName, ModelVersion version) {
        final PathElement element = PathElement.pathElement(SUBSYSTEM, subsystemName);
        registry.mergeSubtree(this, PathAddress.EMPTY_ADDRESS.append(element), version);
    }
150453
public function generateMigration($version = null)
    {
        $path = dirname($this->getIdentifier()->filepath).'/migrations';
        $next = $this->getMaxVersion() + 1;
        $migration_file = "$path/$next.php";
        if (!file_exists($migration_file)) {
            //create the directory
            if (!file_exists(dirname($migration_file))) {
                mkdir(dirname($migration_file), 0755, true);
            }
            $class_name = 'Com'.ucfirst($this->getComponent()).'SchemaMigration'.$next;
            $component = ucfirst($this->getComponent());
            $content = <<<EOF
<?php

/**
 * LICENSE: ##LICENSE##
 *
 * @package    Com_{$component}
 * @subpackage Schema_Migration
 */

/**
 * Schema Migration
 *
 * @package    Com_{$component}
 * @subpackage Schema_Migration
 */
class $class_name extends ComMigratorMigrationVersion
{
   /**
    * Called when migrating up
    */
    public function up()
    {
        //add your migration here
    }

   /**
    * Called when rolling back a migration
    */
    public function down()
    {
        //add your migration here
    }
}
EOF;
            file_put_contents($migration_file, $content);
        }
    }
613599
private function createNode($name, $type = 'array', $default = null, $if = null, $then = null)
    {
        $node = $this->createTreeBuilder()->root($name, $type);

        if ($default !== null) {
            $node->defaultValue($default);
        }

        if ($if !== null && $then !== null) {
            $node->validate()->ifTrue($if)->thenInvalid(sprintf($then, $name));
        }

        return $node;
    }
134605
public function installExtensionFromFileUpload($file, $type = 'Extension')
	{
		$this->amOnPage('/administrator/index.php?option=com_installer');
		$this->waitForText('Extensions: Install', '30', array('css' => 'H1'));
		$this->click(array('link' => 'Upload Package File'));

		$this->debug('I make sure legacy uploader is visible');
		$this->executeJS('document.getElementById("legacy-uploader").style.display="block";');

		$this->debug('I enter the file input');
		$this->attachFile(array('id' => 'install_package'), $file);

		$this->waitForText('was successful', '30', array('id' => 'system-message-container'));

		if ($type == 'Extension')
		{
			$this->debug('Extension successfully installed.');
		}

		if ($type == 'Plugin')
		{
			$this->debug('Installing plugin was successful.');
		}

		if ($type == 'Package')
		{
			$this->debug('Installation of the package was successful.');
		}
	}
5731
public function upgrade($module, $version, array $options = null){
    
        /**
         * Fetch previous version for module
         */
        $oldVersion = $this->getModuleVersion($module);
        $oldVersion = new SoftwareVersion($oldVersion);
    
        if($oldVersion->isLt($version)){
            throw new \Exception('Unable to upgrade to '.$version.' (version '.$oldVersion.' is already installed)');
        }
    
        return $this->install($module, $version, $options);
    }
33813
protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
  {
    foreach ($paths as $path => $names) {
      if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
        return $path;
      }
    }

    return false;
  }
236502
public function add($name, $type = TextType::class, $args = [])
    {
        if ($this->getTypeClass($type) === RepeatedType::class || $type instanceof RepeatedType) {
            return $this->addRepeatedType($name, $type, $args);
        }

        $formControl = $this->getTypeObject($type, $args);

        if (!isset($args['name'])) {
            $formControl->setName($name);
        }

        if ($formControl->getLabel() === null) {
            $formControl->setLabel($formControl->getHumanName());
        }

        $this->getForm()->add($formControl);

        return $this;
    }
98226
public function install($version, $stage = null)
    {
        $deploymentStrategy = $this->getContainer()->get('deployment_strategy');

        $result = $deploymentStrategy->install($version, $stage);

        $this->dispatch(AccompliEvents::INSTALL_COMMAND_COMPLETE);

        return $result;
    }
416112
private function install($version)
    {
        $retries = 3;
        $infoMsg = 'Downloading...';
        $infoType = 'info';

        $success = false;
        while ($retries--) {
            try {
                if (!$this->quiet) {
                    out($infoMsg, $infoType);
                    $infoMsg = 'Retrying...';
                    $infoType = 'error';
                }

                $releaseInfo = $this->getReleaseInfo($version);

                $this->downloadTemporaryFile($releaseInfo['pharUrl'], $this->tmpPharPath);
                $this->downloadTemporaryFile($releaseInfo['pubkeyUrl'], $this->tmpPubkeyPath);

                $this->verifyAndSave();

                $success = true;
                break;
            } catch (RuntimeException $e) {
                out($e->getMessage(), 'error');
            }
        }

        if (!$this->quiet) {
            if ($success) {
                out(PHP_EOL . "QA Tools (version {$releaseInfo['version']}) successfully installed to: {$this->target}", 'success');
                out("Use it: php {$this->installPath}", 'info');
                out('');
            } else {
                out('The download failed repeatedly, aborting.', 'error');
            }
        }

        return $success;
    }
749847
protected function createModules(string $name): void
    {
        $this->autoCreateDirs([
            base_path($this->moduleName().'/'.$name.'/Schedules'),
            base_path($this->moduleName().'/'.$name.'/Config'),
            base_path($this->moduleName().'/'.$name.'/Commands'),
            base_path($this->moduleName().'/'.$name.'/Events'),
            base_path($this->moduleName().'/'.$name.'/Exceptions'),
            base_path($this->moduleName().'/'.$name.'/Handlers'),
            base_path($this->moduleName().'/'.$name.'/Tasks'),
            base_path($this->moduleName().'/'.$name.'/Jobs'),
            base_path($this->moduleName().'/'.$name.'/Listeners'),
            base_path($this->moduleName().'/'.$name.'/Models'),
            base_path($this->moduleName().'/'.$name.'/Providers'),
            base_path($this->moduleName().'/'.$name.'/Repositories/Constants'),
            base_path($this->moduleName().'/'.$name.'/Middleware'),
            base_path($this->moduleName().'/'.$name.'/DataProviders'),
            base_path($this->moduleName().'/'.$name.'/Controllers'),
            base_path($this->moduleName().'/'.$name.'/Resources'),
            base_path($this->moduleName().'/'.$name.'/Routes'),
            base_path($this->moduleName().'/'.$name.'/Translations'),
            base_path($this->moduleName().'/'.$name.'/Database/Factories'),
            base_path($this->moduleName().'/'.$name.'/Database/Migrations'),
            base_path($this->moduleName().'/'.$name.'/Database/Seeds'),
        ]);
    }
670711
public function addReplace($replace, $version = '*', $overwrite = false)
    {
        if (!isset($this->getReplace()->$replace) || $overwrite) {
            $this->getReplace()->$replace = $version;
        }

        return $this;
    }
347359
public function addDetectedVersion($version, $kind, $repoName)
    {
        $this->detectedVersions[$version] = [
            'kind' => $kind,
            'repoName' => $repoName,
        ];

        return $this;
    }