Method that installs the given PEAR file to the given installation directory.

@param localPearFile
The given PEAR file path.
@param installationDir
The given installation directory.
556009
private static void installPear(File localPearFile, File installationDir) {
    InstallationController.setLocalMode(true);
    InstallationDescriptorHandler installationDescriptorHandler = new InstallationDescriptorHandler();
    printInConsole(false, "");
    // check input parameters
    if (localPearFile != null && !localPearFile.exists()) {
      errorFlag = true;
      message = localPearFile.getAbsolutePath() + "file not found \n";
      printInConsole(errorFlag, message);
    } else {
      if (localPearFile != null) {
        pearConsole.append("PEAR file to install is => " + localPearFile.getAbsolutePath() + "\n");
      }
    }
    /* setting current working directory by default */
    if (installationDir == null) {
      installationDir = new File("./");
    }
    pearConsole.append("Installation directory is => " + installationDir.getAbsolutePath() + "\n");

    try {
      JarFile jarFile = new JarFile(localPearFile);
      installationDescriptorHandler.parseInstallationDescriptor(jarFile);
      insdObject = installationDescriptorHandler.getInstallationDescriptor();

      if (insdObject != null)
        mainComponentId = insdObject.getMainComponentId();

      else {
//        pearConsole.setForeground(new Color(0xFF0000));
        throw new FileNotFoundException("installation descriptor not found \n");
      }
      // this version does not support separate delegate components
      if (insdObject.getDelegateComponents().size() > 0) {
        throw new RuntimeException("separate delegate components not supported \n");
      }
    } catch (Exception err) {
      errorFlag = true;
      message = " terminated \n" + err.toString();
      printInConsole(errorFlag, message);
      System.exit(-1);
    }
    InstallationController installationController = new InstallationController(mainComponentId,
            localPearFile, installationDir);
    // adding installation controller message listener
    installationController.addMsgListener(new MessageRouter.StdChannelListener() {
      public void errMsgPosted(String errMsg) {
        printInConsole(true, errMsg);
      }

      public void outMsgPosted(String outMsg) {
        printInConsole(false, outMsg);
      }
    });
    insdObject = installationController.installComponent();
    if (insdObject == null) {
//      runButton.setEnabled(false);
      /* installation failed */
      errorFlag = true;
      message = " \nInstallation of " + mainComponentId + " failed => \n "
              + installationController.getInstallationMsg();
      printInConsole(errorFlag, message);

    } else {
      try {

        /* save modified installation descriptor file */
        installationController.saveInstallationDescriptorFile();
        mainComponentRootPath = insdObject.getMainComponentRoot();
        errorFlag = false;
        message = " \nInstallation of " + mainComponentId + " completed \n";
        printInConsole(errorFlag, message);
        message = "The " + mainComponentRootPath + "/" + SET_ENV_FILE
                + " \n    file contains required " + "environment variables for this component\n";
        printInConsole(errorFlag, message);
        /* 2nd step: verification of main component installation */
        if (installationController.verifyComponent()) {
          // enable 'run' button only for AE
          File xmlDescFile = new File(insdObject.getMainComponentDesc());
          try {
            String uimaCompCtg = UIMAUtil.identifyUimaComponentCategory(xmlDescFile);
          } catch (Exception e) {
            // Ignore exceptions!
          }
          errorFlag = false;
          message = "Verification of " + mainComponentId + " completed \n";
          printInConsole(errorFlag, message);
        } else {
          errorFlag = true;
          message = "Verification of " + mainComponentId + " failed => \n "
                  + installationController.getVerificationMsg();
          printInConsole(errorFlag, message);
        }
      } catch (Exception exc) {
        errorFlag = true;
        message = "Error in InstallationController.main(): " + exc.toString();
        printInConsole(errorFlag, message);
      } finally {
        installationController.terminate();
      }
    }
    if(errorFlag) {
      System.exit(-1);
    }
  }
1233880
Installer newInstaller(
      Path installedSdkRoot, ProgressListener progressListener, ConsoleListener consoleListener) {

    return new Installer(
        installedSdkRoot,
        getInstallScriptProvider(),
        usageReporting,
        progressListener,
        consoleListener,
        CommandRunner.newRunner());
  }
533468
public static LocalResource createLocalResource(FileSystem fs, Path provisionedResourcePath){
		try {
			FileStatus scFileStatus = fs.getFileStatus(provisionedResourcePath);
			LocalResource localResource = LocalResource.newInstance(
					ConverterUtils.getYarnUrlFromURI(provisionedResourcePath.toUri()),
					LocalResourceType.FILE,
					LocalResourceVisibility.APPLICATION, scFileStatus.getLen(),
					scFileStatus.getModificationTime());
			return localResource;
		}
		catch (Exception e) {
			throw new IllegalStateException("Failed to communicate with FileSystem while creating LocalResource: " + fs, e);
		}
	}
1030800
public synchronized static void install() {
        if (!isInstalled()) {
            InputStream is = BMPCLocalLauncher.class.getResourceAsStream(BMP_LOCAL_ZIP_RES);
            try {
                // Unzip BrowserMob Proxy contained in the project "/resources"
                unzip(is, BMPC_USER_DIR);

                // Set executable permissions on the BrowserMob Proxy lanching scripts
                new File(BMP_LOCAL_EXEC_UNIX).setExecutable(true);
                new File(BMP_LOCAL_EXEC_WIN).setExecutable(true);

                // Check there is an installed version
                installedVersion();
            } catch (Exception e) {
                throw new BMPCUnexpectedErrorException("Installation failed", e);
            }
        }
    }
596911
public function installDependencies(InstallerInterface $installer)
    {
        $decode = $this->config->getBowerFileContent();
        if (!empty($decode['dependencies'])) {
            foreach ($decode['dependencies'] as $name => $requiredVersion) {
                if (false !== strpos($requiredVersion, 'github')) {
                    list($name, $requiredVersion) = explode('#', $requiredVersion);
                }
                $package = new Package($name, $requiredVersion);
                $this->installPackage($package, $installer, true);
            }
        }
    }
1125559
public function install(
        InstalledRepositoryInterface $repo,
        PackageInterface $package
    ) {
        $installPath = $this->getInstallPath($package);
        $junglist = new FileJunglist;
        DebugPrinter::log(
            'Installing package `%s` to %s',
            array($package->getPrettyName(), $installPath,)
        );
        parent::install($repo, $package);
        DebugPrinter::log('Post-install file rotating');
        $junglist->rotateInstalledFiles($installPath);
        $junglist->copyConfigFiles($installPath);
        DebugPrinter::log('Finished installation');
    }
461741
public Path upload(final File localFile) throws IOException {

    if (!localFile.exists()) {
      throw new FileNotFoundException(localFile.getAbsolutePath());
    }

    final Path source = new Path(localFile.getAbsolutePath());
    final Path destination = new Path(this.path, localFile.getName());

    try {
      this.fileSystem.copyFromLocalFile(source, destination);
    } catch (final IOException ex) {
      LOG.log(Level.SEVERE, "Unable to upload " + source + " to " + destination, ex);
      throw ex;
    }

    LOG.log(Level.FINE, "Uploaded {0} to {1}", new Object[] {source, destination});

    return destination;
  }
801196
public static void acceptsDir(OptionParser parser) {
        parser.acceptsAll(Arrays.asList(OPT_D, OPT_DIR), "directory path for input/output")
              .withRequiredArg()
              .describedAs("dir-path")
              .ofType(String.class);
    }
1290486
protected function installLocalData()
    {
        $localData = $this->extension->getManifest()->getLocalData();
        if(isset($localData['php'])) {
            $scripts = $localData['php'];
            $scripts = is_array($scripts) ? $scripts : array($scripts);
            foreach ($scripts as $script) {
                $this->runExtensionScript($script);
            }
        }
    }
155351
private function getInstalledVersion($localRepository, $packageName)
    {
        if (count($installed = $localRepository->findPackages($packageName))) {
            /** @var PackageInterface[] $installed */
            return $installed[0]->getPrettyVersion();
        }

        return null;
    }
271760
def install_dir(pkgpath, install_path, register_func, delete_after_install=False):
    
    logger.debug("%s is a directory, attempting to validate", pkgpath)
    plugin = register_func(pkgpath)
    logger.debug("%s looks good, copying to %s", pkgpath, install_path)
    try:
        copy_tree(pkgpath, os.path.join(install_path, plugin.name))
        if delete_after_install:
            logger.debug("deleting %s", pkgpath)
            shutil.rmtree(pkgpath)
        pkgpath = os.path.join(install_path, plugin.name)
    except (OSError, CTError) as exc:
        # TODO: handle package name exists (upgrade? overwrite?)
        logger.debug(str(exc), exc_info=True)
        raise exceptions.PluginAlreadyInstalled(plugin.name)

    return install_deps(pkgpath)
373635
public void setLocal(final File value) {
    if (value == null) {
      throw new NullPointerException("value");
    }
    if (value.exists() && !value.isDirectory()) {
      throw new BuildException("local should be a directory");
    }
    this.localName = value;
    try {
      this.canonicalPath = this.localName.getCanonicalPath();
    } catch (final IOException ex) {
      throw new BuildException(ex);
    }
  }
1076546
@Override public void setupLocal() {
    _ok = new int[_files.length];
    for( int i = 0; i < _files.length; ++i ) {
      File f = new File(_files[i]);
      if( f.exists() && (f.length()==_sizes[i]) )
        _ok[i] = 1;
    }
  }
45510
function install( &$installParameters )
    {
        if ( $this->Parameters['install_type'] != 'install' )
            return;
        $installItems = $this->Parameters['install'];
        if ( !isset( $installParameters['path'] ) )
            $installParameters['path'] = false;
        $installResult = true;
        foreach ( $installItems as $item )
        {
            if ( !$this->installItem( $item, $installParameters ) )
            {
                eZDebug::writeDebug( $item, 'item which failed installing' );
                $installResult = false;
            }
        }
        $this->setInstalled();
        return $installResult;
    }
1097078
public function setLocalPath(string $localPath = null)
    {
        if (null === $localPath) {
            $localPath = $this->defaultLocalPath();
        }
        $this->localPath = $localPath;
    }
452706
private void installLocaleProvider() {
        LocaleProvider.setProvider(new LocaleProvider() {
            public Locale get() {
                Locale locale=null;
                StaplerRequest req = Stapler.getCurrentRequest();
                if(req!=null)
                    locale = req.getLocale();
                if(locale==null)
                    locale = Locale.getDefault();
                return locale;
            }
        });
    }
1029613
public function main()
    {
        if ($this->dir === null) {
            throw new BuildException("You must specify the \"dir\" attribute for PEAR package task.");
        }

        if ($this->version === null) {
            throw new BuildException("You must specify the \"version\" attribute for PEAR package task.");
        }

        $package = new PEAR_PackageFileManager2();

        $this->setOptions($package);

        // the hard-coded stuff
        $package->setPackage('propel_runtime');
        $package->setSummary('Runtime component of the Propel PHP object persistence layer');
        $package->setDescription('Propel is an object persistence layer for PHP5 based on Apache Torque. This package provides the runtime engine that transparently handles object persistence and retrieval.');
        $package->setChannel('pear.propelorm.org');
        $package->setPackageType('php');

        $package->setReleaseVersion($this->version);
        $package->setAPIVersion($this->version);

        $package->setReleaseStability($this->state);
        $package->setAPIStability($this->state);

        $package->setNotes($this->notes);

        $package->setLicense('MIT', 'http://www.opensource.org/licenses/mit-license.php');

        // Add package maintainers
        $package->addMaintainer('lead', 'hans', 'Hans Lellelid', 'hans@xmpl.org');
        $package->addMaintainer('lead', 'david', 'David Zuelke', 'dz@bitxtender.com');
        $package->addMaintainer('lead', 'francois', 'Francois Zaninotto', 'fzaninotto@[gmail].com');
        $package->addMaintainer('lead', 'couac', 'William Durand', 'william.durand1@[gmail].com');

        // "core" dependencies
        $package->setPhpDep('5.2.0');
        $package->setPearinstallerDep('1.4.0');

        // "package" dependencies
        $package->addExtensionDep('required', 'pdo');
        $package->addExtensionDep('required', 'spl');

        // now we run this weird generateContents() method that apparently
        // is necessary before we can add replacements ... ?
        $package->generateContents();

        $e = $package->writePackageFile();

        if (PEAR::isError($e)) {
            throw new BuildException("Unable to write package file.", new Exception($e->getMessage()));
        }
    }