Build the package

@return  bool

@since   1.0
354806
public function run()
	{
		// TODO improve DRY!
		$this->say('Creating package ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);

		// Start getting single archives
		if (file_exists(JPATH_BASE . '/dist/zips'))
		{
			$this->_deleteDir(JPATH_BASE . '/dist/zips');
		}

		$this->_mkdir(JPATH_BASE . '/dist/zips');
		$this->analyze();

		if ($this->hasComponent)
		{
			$this->createComponentZip();
		}

		if ($this->hasModules)
		{
			$this->createModuleZips();
		}

		if ($this->hasPlugins)
		{
			$this->createPluginZips();
		}

		if ($this->hasTemplates)
		{
			$this->createTemplateZips();
		}

		if ($this->hasLibraries)
		{
			$this->createLibraryZips();
		}

		$this->createPackageZip();

		// Create symlink to current folder
		if ($this->isWindows())
		{
			$this->_exec('mklink /J ' . JPATH_BASE . "\dist\pkg-" . $this->getExtensionName() . "-current.zip" . ' ' . $this->getWindowsPath($this->target));
		}
		else
		{
			$this->_symlink($this->target, JPATH_BASE . "/dist/pkg-" . $this->getExtensionName() . "-current.zip");
		}

		return true;
	}
742589
public function build()
    {
        $this->dataObject = [];
        foreach ($this->buildItems as $name => $value) {
            if ($value instanceof BuilderInterface) {
                if (!$this->buildItems[$name]->build()) {
                    return false;
                }
                $this->dataObject[$name] = $this->buildItems[$name]->getResult();
            } elseif (is_callable($value)) {
                $this->dataObject[$name] = $value();
            } else {
                $this->dataObject[$name] = $this->buildItems[$name];
            }
        }

        return true;
    }
1201443
public function build()
    {
        if (isset($this->component)) {
            return $this->component;
        }

        $this->component = BuildUtil::removeNullElements([
            'type' => ComponentType::SPACER,
            'size' => $this->size,
        ]);

        return $this->component;
    }
894415
protected function installPackage()
    {
        if ($this->confirm('Do you want publish the pingpong/admin\'s migrations ?')) {
            $this->call('admin:migration');
        }

        if ($this->confirm('Do you want publish the pingpong/trusty\'s migrations ?')) {
            $this->call('vendor:publish', [
                '--provider' => 'Pingpong\Trusty\TrustyServiceProvider',
            ]);
        }

        if ($this->confirm('Do you want run all migrations now ?')) {
            $this->call('migrate');
        }

        if ($this->confirm('Do you want run the pingpong/admin\'s seeders now ?')) {
            $this->call('admin:seed');
        }

        if ($this->confirm('Do you want publish configuration files from pingpong/admin package ?')) {
            $this->call('vendor:publish', [
                '--provider' => 'Pingpong\Admin\AdminServiceProvider',
                ['--tag' => ['config']],
            ]);
        }

        if ($this->confirm('Do you want publish assets from pingpong/admin package ?')) {
            $this->call('vendor:publish', [
                '--provider' => 'Pingpong\Admin\AdminServiceProvider',
                ['--tag' => ['assets']],
            ]);
        }

        if ($this->confirm('Do you want create the app/menus.php file ?')) {
            $this->installMenus();
        }

        $this->call('optimize');
    }
117711
public function build()
    {
        switch ($this->provider) {
            default:
            case Provider::RACKSPACE:
                $class = __NAMESPACE__ . '\\RackspaceFactory';
                break;
            case Provider::OPENSTACK:
                $class = __NAMESPACE__ . '\\OpenStackFactory';
                break;
        }

        return $this->buildFactory($class)->buildClient();
    }
814149
public function install()
    {
        PackageList::refreshCache();
        $em = $this->app->make(EntityManagerInterface::class);
        $package = new PackageEntity();
        $package->setPackageName($this->getPackageName());
        $package->setPackageDescription($this->getPackageDescription());
        $package->setPackageVersion($this->getPackageVersion());
        $package->setPackageHandle($this->getPackageHandle());
        $em->persist($package);
        $em->flush();

        $this->app->make('cache/overrides')->flush();

        $this->installDatabase();

        Localization::clearCache();

        return $package;
    }
716707
public function build()
    {
        $packages = [];
        if (file_exists($installed = $this->vendorPath . '/composer/installed.json')) {
            $packages = json_decode(file_get_contents($installed), true);
        }
        $manifests = ['migrations' => [], 'events' => [],'translations' => [], 'backend' => [], 'frontend' => []];
        foreach ($packages as $package) {
            if ($package['type'] === self::PACKAGE_TYPE && isset($package['extra'][self::EXTRA_FIELD])) {
                $manifest = $this->getManifest($package);

                if (isset($manifest['migrationPath'])) {//迁移
                    $manifests['migrations'][] = $manifest['migrationPath'];
                }
                if (isset($manifest['events'])) {
                    foreach ($manifest['events'] as $event) {
                        $manifests['events'][] = $event;
                    }
                }
                if (isset($manifest['translations'])) {
                    foreach ($manifest['translations'] as $id => $translation) {
                        $manifests['translations'][$id] = $translation;
                    }
                }
                if (isset($manifest['frontend']['class'])) {
                    $manifests['frontend'][$manifest['id']] = $manifest['frontend'];
                }
                if (isset($manifest['backend'])) {
                    $manifests['backend'][$manifest['id']] = $manifest['backend'];
                }
            }
        }

        //写清单文件
        $this->write(self::MIGRATION_FILE, $manifests['migrations']);
        $this->write(self::EVENT_FILE, $manifests['events']);
        $this->write(self::TRANSLATE_FILE, $manifests['translations']);
        $this->write(self::FRONTEND_MODULE_FILE, $manifests['frontend']);
        $this->write(self::BACKEND_MODULE_FILE, $manifests['backend']);
    }
274602
public function build()
    {
        $config = $this->classMetadata->getExtension(Fluent::EXTENSION_NAME);

        $config['loggable'] = true;
        $config['versioned'] = array_unique(array_merge(
            isset($config['versioned']) ? $config['versioned'] : [],
            [
                $this->fieldName,
            ]
        ));

        $this->classMetadata->addExtension(Fluent::EXTENSION_NAME, $config);
    }
910043
public function compile()
    {
        $pharFilePath = dirname(__FILE__).'/../../build/packagist-security-checker.phar';

        if (file_exists($pharFilePath)) {
            unlink($pharFilePath);
        }

        $phar = new Phar($pharFilePath, 0, 'packagist-security-checker.phar');
        $phar->setSignatureAlgorithm(\Phar::SHA1);

        $phar->startBuffering();

        $this
            ->addPHPFiles($phar)
            ->addVendorFiles($phar)
            ->addComposerVendorFiles($phar)
            ->addBin($phar)
            ->addStub($phar)
            ->addLicense($phar);

        $phar->stopBuffering();

        unset($phar);
    }
914004
public function install()
    {
        $module = Core::app()->getModuleById($this->sModuleAlias);

        if (!$module)
        {
            // 1. add row to the modules table
            $moduleDir = RX_PATH.'/ruxon/modules/'.$this->sModuleAlias;

            $info = Loader::loadConfigFile($moduleDir, 'module');

            $module = array(
                'Name' => $info['Name'],
                'Description' => $info['Description'],
                'Version' => $info['Version'],
                'DbRevision' => '-1'
            );

            Core::app()->updateModuleById($this->sModuleAlias, $module);

            $sClassName = $this->sModuleAlias.'Module';
            $classNameWithNamespaces = '\ruxon\modules\\'.$this->sModuleAlias.'\classes\\'.$sClassName;
            Manager::getInstance()->setModule($this->sModuleAlias, class_exists($classNameWithNamespaces) ? new $classNameWithNamespaces : new $sClassName);

            // 2. create table structure
            $migrator = new MysqlDbMigrator($this->sModuleAlias);
            $migrator->migrateTo('last');


            // 3. copy default config to config folder
            $file1 = RX_PATH.'/ruxon/modules/'.$this->sModuleAlias.'/config/module.inc.php';
            $file2 = RX_PATH.'/ruxon/config/modules/'.$this->sModuleAlias.'.inc.php';
            if (file_exists($file1) && !file_exists($file2))
            {
                copy($file1, $file2);
            }

            return true;
        }

        return false;
    }
1179272
private function createPackage() {
		try {
			$meta = array_merge(Metadata::all(), [
				"name" => $this->args->name,
				"release" => $this->args->release,
				"license" => $this->source->getLicense(),
				"type" => $this->args->zend ? "zend_extension" : "extension",
			]);
			$file = (new Task\PharBuild($this->source, __DIR__."/../pharext_installer.php", $meta))->run($this->verbosity());
		} catch (\Exception $e) {
			$this->error("%s\n", $e->getMessage());
			exit(self::EBUILD);
		}

		try {
			if ($this->args->sign) {
				$this->info("Using private key to sign phar ...\n");
				$pass = (new Task\Askpass)->run($this->verbosity());
				$sign = new Task\PharSign($file, $this->args->sign, $pass);
				$pkey = $sign->run($this->verbosity());
			}

		} catch (\Exception $e) {
			$this->error("%s\n", $e->getMessage());
			exit(self::ESIGN);
		}

		if ($this->args->gzip) {
			try {
				$gzip = (new Task\PharCompress($file, Phar::GZ))->run();
				$move = new Task\PharRename($gzip, $this->args->dest, $this->args->name ."-". $this->args->release);
				$name = $move->run($this->verbosity());

				$this->info("Created gzipped phar %s\n", $name);

				if ($this->args->sign) {
					$sign = new Task\PharSign($name, $this->args->sign, $pass);
					$sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
				}

			} catch (\Exception $e) {
				$this->warn("%s\n", $e->getMessage());
			}
		}
		
		if ($this->args->bzip) {
			try {
				$bzip = (new Task\PharCompress($file, Phar::BZ2))->run();
				$move = new Task\PharRename($bzip, $this->args->dest, $this->args->name ."-". $this->args->release);
				$name = $move->run($this->verbosity());

				$this->info("Created bzipped phar %s\n", $name);

				if ($this->args->sign) {
					$sign = new Task\PharSign($name, $this->args->sign, $pass);
					$sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
				}

			} catch (\Exception $e) {
				$this->warn("%s\n", $e->getMessage());
			}
		}

		try {
			$move = new Task\PharRename($file, $this->args->dest, $this->args->name ."-". $this->args->release);
			$name = $move->run($this->verbosity());

			$this->info("Created executable phar %s\n", $name);

			if (isset($pkey)) {
				$pkey->exportPublicKey($name.".pubkey");
			}

		} catch (\Exception $e) {
			$this->error("%s\n", $e->getMessage());
			exit(self::EBUILD);
		}
	}
66545
protected function setupBuild()
    {
        /** @var Repository $config */
        $config = $this->container['config'];

        $build = [];

        $this->title('Build');

        $build['directory'] = $this->ask("Where should we put the generated site files?", $config['build.directory']);

        return $build;
    }
824200
public function build()
    {
        if(($document = $this->getDocument()) === null) {
            $document = $this->loader->getInstance(NodeLoader::DOCUMENT_NODE);
            $this->setDocument($document);
        }

        if(($header = $document->getHeader()) === null) {
            $header = $this->loader->getInstance(NodeLoader::HEADER_NODE);
            $document->setHeader($header);
        }

        if(($supplier = $header->getSupplier()) === null) {
            $supplier = $this->loader->getInstance(NodeLoader::SUPPLIER_NODE);
            $header->setSupplier($supplier);
        }

        if(($catalog = $header->getCatalog()) === null) {
            $catalog = $this->loader->getInstance(NodeLoader::CATALOG_NODE);
            $header->setCatalog($catalog);
        }

        if(($datetime = $catalog->getDateTime()) === null) {
            $datetime = $this->loader->getInstance(NodeLoader::DATE_TIME_NODE);
            $catalog->setDateTime($datetime);
        }

        if(($newCatalog = $document->getNewCatalog()) === null) {
            $newCatalog = $this->loader->getInstance(NodeLoader::NEW_CATALOG_NODE);
            $document->setNewCatalog($newCatalog);
        }

        return $document;
    }
670613
public function install()
	{
		if ($this->arguments->getOpt('package'))
		{
			$package = $this->arguments->getOpt('package');
		}
		if ($this->arguments->getOpt('version'))
		{
			$version = $this->arguments->getOpt('version');
		}
		if (!isset($package) || !isset($version))
		{
			$this->output->error('A package name and version is required');
		}

		try
		{
			Composer::installPackage($package, $version);
		}
		catch (Exception $e)
		{

		}
		$this->output->addLine("Done.  $package($version) installed.");
	}
549484
public function run()
	{
		$this->say('Building Extension package');

		$this->analyze();

		// Build component
		if ($this->hasComponent)
		{
			$this->buildComponent($this->params)->run();
		}

		// Modules
		if ($this->hasModules)
		{
			$path = $this->getSourceFolder() . "/modules";

			// Get every module
			$hdl = opendir($path);

			while ($entry = readdir($hdl))
			{
				// Only folders
				$p = $path . "/" . $entry;

				if (substr($entry, 0, 1) == '.')
				{
					continue;
				}

				if (!is_file($p))
				{
					// Module folder
					$this->modules[] = $entry;
					$this->buildModule($entry, $this->params)->run();
				}
			}

			closedir($hdl);
		}

		// Plugins
		if ($this->hasPlugins)
		{
			$path = $this->getSourceFolder() . "/plugins";

			// Get every plugin
			$hdl = opendir($path);

			while ($entry = readdir($hdl))
			{
				// Only folders
				$p = $path . "/" . $entry;

				if (substr($entry, 0, 1) == '.')
				{
					continue;
				}

				if (!is_file($p))
				{
					// Plugin type folder
					$type = $entry;

					$hdl2 = opendir($p);

					while ($plugin = readdir($hdl2))
					{
						// Only folders
						$p2 = $path . "/" . $entry;

						if (substr($plugin, 0, 1) == '.')
						{
							continue;
						}

						if (!is_file($p2))
						{
							$this->plugins[] = "plg_" . $type . "_" . $plugin;
							$this->buildPlugin($type, $plugin, $this->params)->run();
						}
					}

					closedir($hdl2);
				}
			}

			closedir($hdl);
		}

		if ($this->hasLibraries)
		{
			$path = $this->getSourceFolder() . "/libraries";

			// Get every library
			$hdl = opendir($path);

			while ($entry = readdir($hdl))
			{
				// Only folders
				$p = $path . "/" . $entry;

				if (substr($entry, 0, 1) == '.')
				{
					continue;
				}

				if (!is_file($p))
				{
					// Library folder
					$this->libraries[] = $entry;
					$this->buildLibrary($entry, $this->params, $this->hasComponent)->run();
				}
			}

			closedir($hdl);
		}

		if ($this->hasCBPlugins)
		{
			$path = $this->getSourceFolder() . "/components/com_comprofiler/plugin";

			// Get every plugin
			$hdl = opendir($path);

			while ($entry = readdir($hdl))
			{
				// Only folders
				$p = $path . "/" . $entry;

				if (substr($entry, 0, 1) == '.')
				{
					continue;
				}

				if (!is_file($p))
				{
					// Plugin type folder
					$type = $entry;

					$hdl2 = opendir($p);

					while ($plugin = readdir($hdl2))
					{
						// Only folders
						$p2 = $path . "/" . $entry;

						if (substr($plugin, 0, 1) == '.')
						{
							continue;
						}

						if (!is_file($p2))
						{
							$this->plugins[] = "plug_" . $plugin;
							$this->buildCBPlugin($type, $plugin, $this->params)->run();
						}
					}

					closedir($hdl2);
				}
			}

			closedir($hdl);
		}

		// Templates
		if ($this->hasTemplates)
		{
			$path = $this->getSourceFolder() . "/templates";

			// Get every module
			$hdl = opendir($path);

			while ($entry = readdir($hdl))
			{
				// Only folders
				$p = $path . "/" . $entry;

				if (substr($entry, 0, 1) == '.')
				{
					continue;
				}

				if (!is_file($p))
				{
					// Template folder
					$this->templates[] = $entry;
					$this->buildTemplate($entry, $this->params)->run();
				}
			}

			closedir($hdl);
		}

		// Build component
		if ($this->hasPackage)
		{
			$this->buildPackage($this->params)->run();
		}

		// Replacements (date, version etc.) in every php file
		$dir = new \RecursiveDirectoryIterator($this->getBuildFolder(), \RecursiveDirectoryIterator::SKIP_DOTS);
		$it  = new \RecursiveIteratorIterator($dir);

		foreach ($it as $file)
		{
			if (in_array(pathinfo($file, PATHINFO_EXTENSION), array('php', 'js')))
			{
				$this->replaceInFile($file);
			}
		}

		return true;
	}
314682
public function check()
    {
        $pass = true;
        foreach ($this->_rules as $rule) {
            if ($rule->lhs() instanceof BasePackage) {
                $package = $rule->lhs();
            } else {
                $package = PackageFactory::create((string)$rule->lhs());
            }

            if (!$package->versionMatch($rule->rhs())) {
                $this->_fail($rule);
                $pass = false;
            } else {
                $this->_pass($rule);
            }
        }

        $this->_checked = true;

        return $pass;
    }
969197
protected function buildKernel()
    {
        $this->app->singleton(
            Kernel::class,
            $this->getAppNamespace() . 'Ws\Kernel'
        );
        
        return $this->Kernel = $this->app->make(Kernel::class);
    }