Read the file.

@param _installFile the install file
@return JavaScriptUpdate
356172
public static JasperReportUpdate readFile(final InstallFile _installFile)
    {
        final JasperReportUpdate ret = new JasperReportUpdate(_installFile);
        final JasperReportDefinition definition = ret.new JasperReportDefinition(_installFile);
        ret.addDefinition(definition);
        return ret;
    }
262570
protected function installFromFile()
    {
        if (!file_exists($path = base_path('modules.json'))) {
            $this->error("File 'modules.json' does not exist in your project root.");

            return;
        }

        $modules = Json::make($path);

        $dependencies = $modules->get('require', []);

        foreach ($dependencies as $module) {
            $module = collect($module);

            $this->install(
                $module->get('name'),
                $module->get('version'),
                $module->get('type')
            );
        }
    }
691985
def installUpdate(self):
        
        # We can add this but dunno how useful this is since it sometimes
        # requires user action using a gui.
        part = '/updater/apply'
        release = self.check_for_update(force=True, download=True)
        if release and release.version != self.version:
            # figure out what method this is..
            return self.query(part, method=self._session.put)
1323203
public ServerPackageAsset resolveServerPackage(File archiveFile) throws InstallException {
        ServerPackageAsset spa = (ServerPackageJarAsset.validType(archiveFile.getAbsolutePath().toLowerCase())) ? new ServerPackageJarAsset(archiveFile, false) : new ServerPackageZipAsset(archiveFile, false);

        this.installAssets = new ArrayList<List<InstallAsset>>();
        this.installAssets.add(Arrays.asList((InstallAsset) spa));

        return spa;
    }
470342
@Override
    public Result check() {
        Result result = Result.newResult();
        for (FileEntry entry : entries) {
            if (entry.refresh(entry.getFile())) {
                //check update only
                result.addUpdatedFile(entry.getFile());
            }
        }
        return result;
    }
961508
public function readFile()
    {
        $this->openFile();
        $length = filesize($this->getFilePath());
        if($length === 0) return '';
        $read = fread($this->getFile(), $length);
        if($read === false)
        {
            throw FileOperationException::createForFailedToReadFromFile($this->getFilePath());
        }
        return $read;
    }
148074
function initializeFromHTTPFile( $httpFile, $imageAltText = false )
    {
        $this->increaseImageSerialNumber();

        $mimeData = eZMimeType::findByFileContents( $httpFile->attribute( 'filename' ) );
        if ( !$mimeData['is_valid'] )
        {
            $mimeData = eZMimeType::findByName( $httpFile->attribute( 'mime_type' ) );
            if ( !$mimeData['is_valid'] )
            {
                $mimeData = eZMimeType::findByURL( $httpFile->attribute( 'original_filename' ) );
            }
        }
        $this->removeAliases();
        $this->setOriginalAttributeDataValues( $this->ContentObjectAttributeData['id'],
                                               $this->ContentObjectAttributeData['version'],
                                               $this->ContentObjectAttributeData['language_code'] );
        $contentVersion = eZContentObjectVersion::fetchVersion( $this->ContentObjectAttributeData['version'],
                                                                $this->ContentObjectAttributeData['contentobject_id'] );
        $objectName = $this->imageName( $this->ContentObjectAttributeData, $contentVersion );
        $objectPathString = $this->imagePath( $this->ContentObjectAttributeData, $contentVersion, true );

        eZMimeType::changeBaseName( $mimeData, $objectName );
        eZMimeType::changeDirectoryPath( $mimeData, $objectPathString );

        $httpFile->store( false, false, $mimeData );

        $originalFilename = $httpFile->attribute( 'original_filename' );
        return $this->initialize( $mimeData, $originalFilename, $imageAltText );
    }
126612
function checkInstallerStatus(requester, searchParams) {
        var installErrorStr = searchParams.installErrorStr,
            bracketsErrorStr = searchParams.bracketsErrorStr,
            updateDirectory = searchParams.updateDir,
            encoding =        searchParams.encoding || "utf8",
            statusObj = {installError: ": BA_UN"},
            logFileAvailable = false,
            currentRequester = requester || "";

        var notifyBrackets = function notifyBrackets(errorline) {
            statusObj.installError = errorline || ": BA_UN";
            postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj);
        };

        var parseLog = function (files) {
            files.forEach(function (file) {
                var fileExt = path.extname(path.basename(file));
                if (fileExt === ".logs") {
                    var fileName = path.basename(file),
                        fileFullPath = updateDirectory + '/' + file;
                    if (fileName.search("installStatus.logs") !== -1) {
                        logFileAvailable = true;
                        parseInstallerLog(fileFullPath, bracketsErrorStr, "utf8", notifyBrackets);
                    } else if (fileName.search("update.logs") !== -1) {
                        logFileAvailable = true;
                        parseInstallerLog(fileFullPath, installErrorStr, encoding, notifyBrackets);
                    }
                }
            });
            if (!logFileAvailable) {
                postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj);
            }
        };

        fs.readdir(updateDirectory)
            .then(function (files) {
                return parseLog(files);
            }).catch(function () {
                postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj);
            });
    }
1249737
function softwareUpdate_assertUpdateApplied(updateData) {
    // Get the information from the last update
    var info = updateData.updates[updateData.updateIndex];

    // The upgraded version should be identical with the version given by
    // the update and we shouldn't have run a downgrade
    var check = this._vc.compare(info.build_post.version, info.build_pre.version);
    this._controller.assert(function() {
      return check >= 0;
    }, "The version number of the upgraded build is higher or equal.");

    // The build id should be identical with the one from the update
    this._controller.assert(function() {
      return info.build_post.buildid == info.patch.buildid;
    }, "The build id is equal to the build id of the update.");

    // An upgrade should not change the builds locale
    this._controller.assert(function() {
      return info.build_post.locale == info.build_pre.locale;
    }, "The locale of the updated build is identical to the original locale.");
  }
1042767
function _readJSONFile (file, callback) {

			if ("undefined" === typeof file) {
				throw new ReferenceError("missing \"file\" argument");
			}
				else if ("string" !== typeof file) {
					throw new TypeError("\"file\" argument is not a string");
				}
				else if ("" === file.trim()) {
					throw new Error("\"file\" argument is empty");
				}
			else if ("undefined" === typeof callback) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				isFileProm(file).then((exists) => {

					return !exists ?
						Promise.reject(new Error("The file does not exist")) :
						new Promise((resolve, reject) => {

							readFile(file, (err, content) => {
								return err ? reject(err) : resolve(content);
							});

						});

				}).then((content) => {
					callback(null, JSON.parse(content));
				}).catch(callback);

			}

		}
858993
private function loadModuleFile($installPath)
    {
        if (!file_exists($installPath)) {
            throw FileNotFoundException::forPath($installPath);
        }

        if (!is_dir($installPath)) {
            throw new NoDirectoryException(sprintf(
                'The path %s is a file. Expected a directory.',
                $installPath
            ));
        }

        try {
            return $this->jsonStorage->loadModuleFile($installPath.'/puli.json');
        } catch (FileNotFoundException $e) {
            // Modules without module files are ok
            return null;
        }
    }
1350749
protected static function readSaltFromFile(): string
    {
        Utility::validatePath(static::$saltFile);
        $result = file_get_contents(static::$saltFile);
        $result = $result ?: '';
        static::validateSalt($result);

        return $result;
    }
599993
public function install(): OperationResult
    {
        $result = new OperationResult();

        $sourceFile = "{$this->packageInstallDir}/.installer/%s/.env";
        foreach ($this->projectType->getProjectDirs() as $projectDir) {
            $envFile = sprintf($sourceFile, $projectDir);
            if (is_file($envFile)) {
                $content = "\n";
                $content .= "###BEGIN-Rikudou-Installer-{$this->packageName}###\n";
                $content .= "# Do not remove the above line if you want the installer to be able to delete the content on uninstall\n";
                $content .= file_get_contents($envFile) . "\n";
                $content .= "###END-Rikudou-Installer-{$this->packageName}###";

                foreach (self::ENV_FILES as $file) {
                    $targetEnvFile = "{$this->projectRootDir}/${file}";
                    if (file_exists($targetEnvFile)) {
                        if (!file_put_contents($targetEnvFile, $content, FILE_APPEND | LOCK_EX)) {
                            $result->addErrorMessage("<error>Could not copy env variables from {$this->packageName}</error>");
                        }
                    }
                }
            }
        }

        if (!$result->isFailure()) {
            $result->addStatusMessage("Successfully copied env variables from {$this->packageName}");
        }

        return $result;
    }
306589
function install_ (pkg, reg, seen, mustHave, pkglist, bundles, cb) {
  log.verbose(pkg, "install_")
  if (seen[pkg]) return cb() // repeat, skip it
  seen[pkg] = true

  // it's a local thing or a url if it has a / in it.
  if (pkg.indexOf("/") !== -1 || pkg === ".") {
    log.silly(pkg, "install local")
    return cache.add(pkg, finisher(pkg, reg, pkglist, bundles, cb))
  }

  // now we know it's not a URL or file,
  // so handle it like a tag, version, or range.
  pkg = pkg.split("@")
  var name = pkg[0]
    , defTag = npm.config.get("tag")
    , ver = pkg.slice(1).join("@").trim() || defTag
    , range = semver.validRange(ver)
    , exact = semver.valid(ver)
    , tag = !exact && !range && range !== "" && ver
  log.verbose([pkg, mustHave], "must install?")
  pkg = pkg.join("@")
  seen[name+"@"+ver] = true

  // if there is a satisfying version already, then simply move on.
  if (!tag && findSatisfying(pkg, name, range, mustHave, reg)) {
    return cb()
  }

  // at this point, assume that it has to be installed.
  if (exact) {
    log.verbose("exact", pkg)
    // just pull the data out of the cache to ensure it's there
    return cache.read(name, exact, finisher(pkg, reg, pkglist, bundles, cb))
  }

  getData(name, function (er, data) {
    if (er) return cb(er)
    log.silly(data, pkg)
    if (tag) {
      log.verbose(tag, pkg+" tag")
      var tags = data["dist-tags"]
      if (!tags[tag]) cb(new Error(
        "Tag not found: "+data.name+"@"+tag
        +"\nValid install targets for "+data.name+": "
        +installTargets(data)))
      install_(data.name+"@"+tags[tag], reg, seen, mustHave
              , pkglist, bundles, cb)
    } else {
      log(pkg, "range")
      // prefer the default tag version.
      var defTag = npm.config.get("tag")
        , satis
      defTag = defTag && data["dist-tags"] && data["dist-tags"][defTag]
      if (semver.satisfies(defTag, range)) satis = defTag
      else satis = semver.maxSatisfying(Object.keys(data.versions), range)

      if (!satis) return cb(new Error(
        "No satisfying version found for '"+data.name+"'@'"+range+"'"
        +"\nValid install targets for "+data.name+": "
        +installTargets(data)))
      install_(data.name+"@"+satis, reg, seen, mustHave
              , pkglist, bundles, cb)
    }
  })
}
999884
public void installFile(PackageFile packageFile) {
    File file = packageFile.getFile();
    if (!file.exists()) {
      throw new PackageManagerException("File does not exist: " + file.getAbsolutePath());
    }

    try (CloseableHttpClient httpClient = pkgmgr.getHttpClient()) {

      // before install: if bundles are still stopping/starting, wait for completion
      pkgmgr.waitForBundlesActivation(httpClient);

      if (packageFile.isInstall()) {
        log.info("Upload and install " + (packageFile.isForce() ? "(force) " : "") + file.getName() + " to " + props.getPackageManagerUrl());
      }
      else {
        log.info("Upload " + file.getName() + " to " + props.getPackageManagerUrl());
      }

      VendorPackageInstaller installer = VendorInstallerFactory.getPackageInstaller(props.getPackageManagerUrl());
      if (installer != null) {
        installer.installPackage(packageFile, pkgmgr, httpClient, props, log);
      }
    }
    catch (IOException ex) {
      throw new PackageManagerException("Install operation failed.", ex);
    }
  }
1233880
Installer newInstaller(
      Path installedSdkRoot, ProgressListener progressListener, ConsoleListener consoleListener) {

    return new Installer(
        installedSdkRoot,
        getInstallScriptProvider(),
        usageReporting,
        progressListener,
        consoleListener,
        CommandRunner.newRunner());
  }
524841
function readManifest(addonPath) {
  var manifest;

  if (addonPath.slice(-4) === '.xpi') {
    manifest = checkedCall(fs.readFile, addonPath).then(function(buff) {
      var zip = new AdmZip(buff);
      if (!zip.getEntry('install.rdf')) {
        throw new AddonFormatError(
            'Could not find install.rdf in ' + addonPath);
      }
      var done = promise.defer();
      zip.readAsTextAsync('install.rdf', done.fulfill);
      return done.promise;
    });
  } else {
    manifest = checkedCall(fs.stat, addonPath).then(function(stats) {
      if (!stats.isDirectory()) {
        throw Error(
            'Add-on path is niether a xpi nor a directory: ' + addonPath);
      }
      return checkedCall(fs.readFile, path.join(addonPath, 'install.rdf'));
    });
  }

  return manifest.then(function(content) {
    return checkedCall(xml.parseString, content);
  });
}