Generates a manifest JSON file and returns the path.

@param \JWage\APNS\Safari\Package $package
@return string $manifestJsonPath
350997
public function createManifest(Package $package)
    {
        $manifestData = array();
        foreach (Package::$packageFiles as $rawFile) {
            $filePath = sprintf('%s/%s', $package->getPackageDir(), $rawFile);
            $manifestData[$rawFile] = sha1(file_get_contents($filePath));
        }

        $manifestJsonPath = sprintf('%s/manifest.json', $package->getPackageDir());
        $manifestJson = json_encode((object) $manifestData);

        file_put_contents($manifestJsonPath, $manifestJson);

        return $manifestJsonPath;
    }
543342
def _package_path(package):
    
    from os import path
    confdir = config_dir()
    return path.join(confdir, "{}.cfg".format(package))
108321
public function getDeployInfo($package) {
    $deployInfoFile = $package->getRootDirectory()->getFile('deploy-info.json');

    $deployInfo = new \stdClass;
    if ($deployInfoFile->exists()) {
      $deployInfo = JSONConverter::create()->parseFile($deployInfoFile);
    }

    if (!isset($deployInfo->isStaging)) {
      $deployInfo->isStaging = NULL;
    }

    if (!isset($deployInfo->isDevelopment)) {
      $deployInfo->isDevelopment = NULL;
    }

    if (!isset($deployInfo->isBuilt)) {
      $deployInfo->isBuilt = NULL;
    }

    return $deployInfo;
  }
172970
public function appendPackage($package) {
		$package = $this->handlePackage($package);
		
		$this->packages[] = $package;
		return $package;
	}
1228416
private static function loadPackage(string $package): stdClass {
    $language = new stdClass();
    if (!empty($package)) {
      $filename = null;
      if ($packageData = explode(":", $package)) {
        if (!empty($packageData[0])) {
          $filename .= Lang::$root[$packageData[0]];
        }
        if (!empty($packageData[1])) {
          $filename .= DIRECTORY_SEPARATOR . $packageData[1];
        }
        $pathaname = Lang::selectPackage($filename);
        if (file_exists($pathaname)) {
          $pathaname = Path::replaceOSSeparator($pathaname);
          $decode = json_decode(file_get_contents((new SplFileObject($pathaname, "r"))->getPathname()));
          $language = (JSON_ERROR_NONE == json_last_error()) ? $decode : $language;
        }
      }
    }
    return $language;
  }
1108486
public static function primaryNamespace($package)
    {
        $primaryNs = null;
        $autoLoad = $package->getAutoload();
        foreach ($autoLoad as $type => $pathMap) {
            if ($type !== 'psr-4') {
                continue;
            }
            $count = count($pathMap);

            if ($count === 1) {
                $primaryNs = key($pathMap);
                break;
            }

            $matches = preg_grep('#^(\./)?src/?$#', $pathMap);
            if ($matches) {
                $primaryNs = key($matches);
                break;
            }

            foreach (['', '.'] as $path) {
                $key = array_search($path, $pathMap, true);
                if ($key !== false) {
                    $primaryNs = $key;
                }
            }
            break;
        }

        if (!$primaryNs) {
            throw new RuntimeException(
                sprintf(
                    "Unable to get primary namespace for package %s." .
                    "\nEnsure you have added proper 'autoload' section to your plugin's config.",
                    $package->getName()
                )
            );
        }
        return trim($primaryNs, '\\');
    }
1235836
private function loadPackageRuleSet(Package $package)
    {
        $ruleSet = new RuleSet();
        $key = $package->generatePackageKey();

        if ($this->cache->has($key)) {
            $ruleSet = $this->cache->getCachedRuleSet($key);
        } elseif (is_dir($path = $package->getPackagePath(self::PACKAGE_PATH))) {
            $ruleSet = $this->traverser->traverse($path);
            $this->cache->cacheRuleSet($key, $ruleSet);
        } else {
            // there is no vendor package in the given path
        }

        return $ruleSet;
    }
1214230
private function getPackageSubscription(PackageEntity $package)
    {
        $em = $this->getEntityManager();
        $me = $this->getAccessHelper()->getUserEntity('current');
        $repo = $this->app->make(PackageSubscriptionRepository::class);
        /* @var PackageSubscriptionRepository $repo */
        $ps = $repo->find(['user' => $me, 'package' => $package]);
        if ($ps === null) {
            $ps = PackageSubscriptionEntity::create($me, $package, false);
            $em->persist($ps);
            $em->flush($ps);
        }

        return $ps;
    }
420149
public function getInstallPath(PackageInterface $package)
    {
        $prettyName = $package->getPrettyName();
        DebugPrinter::log(
            'Getting install path for `%s` package',
            array($prettyName,)
        );
        if (isset($this->installDirCache[$prettyName])) {
            return $this->installDirCache[$prettyName];
        }
        $installDir = null;
        if ($this->composer->getPackage()) {
            $rootExtra = $this->composer->getPackage()->getExtra();
            if (!empty($rootExtra['opencart-install-dir'])) {
                $installDir = $rootExtra['opencart-install-dir'];
            }
        }
        if (!$installDir) {
            $extra = $package->getExtra();
            if (!empty($extra['opencart-install-dir'])) {
                $installDir = $extra['opencart-install-dir'];
            }
        }
        if (is_array($installDir)) {
            if (isset($installDir[$prettyName])) {
                $this->installDirCache[$prettyName] = $installDir[$prettyName];
                return $installDir[$prettyName];
            }
            $this->installDirCache[$prettyName] = $this->defaultInstallDir;
            return $this->defaultInstallDir;
        }
        $installDir = $installDir ? $installDir : $this->defaultInstallDir;
        DebugPrinter::log(
            'Computed install dir for package `%s`: `%s`',
            array($prettyName, $installDir,)
        );
        $this->installDirCache[$prettyName] = $installDir;
        return $installDir;
    }
88802
protected function getAppViewPaths(string $package): array
    {
        return \array_map(function ($path) use ($package) {
            return "{$path}/packages/{$package}";
        }, $this->app->make('config')->get('view.paths', []));
    }
313000
protected function getDownloadUrl(array $package): string
    {
        $downloadUrl = parent::getDownloadUrl($package);

        $downloadUrl = str_replace('releases/download', 'raw', $downloadUrl);

        return $downloadUrl.'/builds/'.basename(Phar::running());
    }
533833
private function getSymlinkSource($package)
    {
        $matches = $this->getGitRegexMatches($package);

        foreach ($this->local_config as $paths) {
            if (Utils::endsWith($matches[2], '.git')) {
                $repo_dir = preg_replace('/\.git$/', '', $matches[2]);
            } else {
                $repo_dir = $matches[2];
            }
            
            $paths = (array) $paths;
            foreach ($paths as $repo) {
                $path = rtrim($repo, '/') . '/' . $repo_dir;
                if (file_exists($path)) {
                    return $path;
                }
            }

        }

        return false;
    }
85781
function generatePackage( $package, $options )
    {
        $this->Package = $package;
        $remoteIDArray = array();
        $this->NodeIDArray = array_unique( $this->NodeIDArray );
        foreach( $this->NodeIDArray as $nodeID )
        {
            $this->NodeObjectArray[(string)$nodeID] = eZContentObjectTreeNode::fetch( $nodeID );
        }

        foreach( $this->RootNodeIDArray as $nodeID )
        {
            $this->RootNodeObjectArray[(string)$nodeID] = eZContentObjectTreeNode::fetch( $nodeID );
        }

        $this->generateObjectArray( $options['node_assignment'] );

        $classIDArray = false;
        if ( $options['include_classes'] )
        {
            $remoteIDArray['class'] = array();
            $classIDArray = $this->generateClassIDArray();

            foreach ( $classIDArray as $classID )
            {
                eZContentClassPackageHandler::addClass( $package, $classID );
            }
        }

        $dom = new DOMDocument( '1.0', 'utf-8' );
        $packageRoot = $dom->createElement( 'content-object' );
        $dom->appendChild( $packageRoot );

        $objectListDOMNode = $this->createObjectListNode( $options );
        $importedObjectListDOMNode = $dom->importNode( $objectListDOMNode, true );
        $packageRoot->appendChild( $importedObjectListDOMNode );

        $overrideSettingsArray = false;
        $templateFilenameArray = false;
        if ( $options['include_templates'] )
        {
            $overrideSettingsListNode = $this->generateOverrideSettingsArray( $options['site_access_array'], $options['minimal_template_set'] );
            $importedOverrideSettingsListNode = $dom->importNode( $overrideSettingsListNode, true );
            $packageRoot->appendChild( $importedOverrideSettingsListNode );

            $designTemplateListNode = $this->generateTemplateFilenameArray();
            $importedDesignTemplateListNode = $dom->importNode( $designTemplateListNode, true );
            $packageRoot->appendChild( $importedDesignTemplateListNode );

            $fetchAliasListNode = $this->generateFetchAliasArray();
            $importedFetchAliasListNode = $dom->importNode( $fetchAliasListNode, true );
            $packageRoot->appendChild( $importedFetchAliasListNode );
        }

        $siteAccessListDOMNode = $this->createSiteAccessListNode( $options );
        $importedSiteAccessListDOMNode = $dom->importNode( $siteAccessListDOMNode, true );
        $packageRoot->appendChild( $importedSiteAccessListDOMNode );

        $topNodeListDOMNode = $this->createTopNodeListDOMNode( $options );
        $importedTopNodeListDOMNode = $dom->importNode( $topNodeListDOMNode, true );
        $packageRoot->appendChild( $importedTopNodeListDOMNode );

        //$filename = substr( md5( mt_rand() ), 0, 8 );
        $filename = 'contentobjects';
        $this->Package->appendInstall( 'ezcontentobject', false, false, true,
                                       $filename, $this->contentObjectDirectory(),
                                       array( 'content' => $packageRoot ) );
        $this->Package->appendInstall( 'ezcontentobject', false, false, false,
                                       $filename, $this->contentObjectDirectory(),
                                       array( 'content' => false ) );
    }
90106
public function findPackageConfiguration($package)
    {
        $paths = [
            $this->paths->getBasePath().'vendor/%s/src/config',
            $this->paths->getBasePath().'vendor/%s/config',
            $this->paths->getRocketeerPath().'/vendor/%s/src/config',
            $this->paths->getRocketeerPath().'/vendor/%s/config',
            $this->paths->getUserHomeFolder().'/.composer/vendor/%s/src/config',
            $this->paths->getUserHomeFolder().'/.composer/vendor/%s/config',
        ];

        // Check for the first configuration path that exists
        $paths = array_map(function ($path) use ($package) {
            return sprintf($path, $package);
        }, $paths);

        return $paths;
    }
1283995
function resolvePaths(processDirectory, cliConfig) {
  logger.debug('resolvePaths', processDirectory, cliConfig);

  const overrides = cliConfig || {};
  // Locate and read package.json
  const packageJsonFile = path.resolve(
    findup.sync(processDirectory, 'package.json'),
    'package.json'
  );
  const baseDir = path.dirname(packageJsonFile);

  const config = Object.assign(
    {},
    getConfigSettings(packageJsonFile, baseDir),
    overrides
  );
  const outputFile = path.resolve(baseDir, config.outputFile);

  const outputFiles = [
    {
      outputFile,
      patterns: config.searchDir.map(dir =>
        path.resolve(baseDir, dir, config.pattern)
      ),
    },
  ];

  const returnValue = {
    outputFiles,
  };
  logger.debug('resolvePaths', returnValue);
  return returnValue;
}
681131
public function getLoaderInstallPath(PackageInterface $package)
    {
        $config      = $this->getInstallerConfig($package);
        $installPath = 'wp-content/mu-plugins/';

        if (!$this->composer->getPackage()) {
            return $this->parseTemplate($installPath, $config);
        }

        $extra      = $this->composer->getPackage()->getExtra();
        $prettyName = !empty($config['vendor']) ? ($config['vendor'] . '/') : '';
        $prettyName = $prettyName . $config['name'];

        if (!empty($extra['installer-loader-paths'])) {
            $customPath = $this->resolveInstallPath($extra['installer-loader-paths'], $prettyName);

            if ($customPath !== false) {
                $installPath = $customPath;
            }
        }

        return $this->parseTemplate($installPath, $config);
    }
938154
public function getInstallPath(PackageInterface $package)
    {
        if ($package->getType() === 'oxid-base') {
            return $this->_locations[$package->getType()];
        }
        $themeName = "ra";
        $extra = $package->getExtra();
        $installFolder = $this->_locations[$package->getType()] . '/' . str_replace(array($themeName . "/", '-theme'), '', $package->getPrettyName());
        if ($extra) {
            $themeName = $extra["themeName"];
            $installFolder = $this->_locations[$package->getType()] . '/' . $themeName;
        }

        return $installFolder;
    }