public function generateInfoMetadata(PackageEvent $event)
    {
        $op = $event->getOperation();
        $package = $op->getJobType() == 'update'
            ? $op->getTargetPackage()
            : $op->getPackage();
        $installPath = $this->installationManager->getInstallPath($package);

        if (preg_match('/^drupal-/', $package->getType())) {
            if (preg_match('/^dev-/', $package->getPrettyVersion())) {
                $name = $package->getName();
                $project = preg_replace('/^.*\//', '', $name);
                $version = preg_replace('/^dev-(.*)/', $this->core.'.x-$1-dev', $package->getPrettyVersion());
                $branch = preg_replace('/^([0-9]*\.x-[0-9]*).*$/', '$1', $version);
                $datestamp = time();

                $this->io->write('  - Generating metadata for <info>'.$name.'</info>');

                // Compute the rebuild version string for a project.
                $version = $this->computeRebuildVersion($installPath, $branch) ?: $version;

                if ($this->core == '7') {
                    // Generate version information for `.info` files in ini format.
                    $finder = new Finder();
                    $finder
                        ->files()
                        ->in($installPath)
                        ->name('*.info')
                        ->notContains('datestamp =');
                    foreach ($finder as $file) {
                        file_put_contents(
                            $file->getRealpath(),
                            $this->generateInfoIniMetadata($version, $project, $datestamp),
                            FILE_APPEND
                        );
                    }
                } else {
                    // Generate version information for `.info.yml` files in YAML format.
                    $finder = new Finder();
                    $finder
                        ->files()
                        ->in($installPath)
                        ->name('*.info.yml')
                        ->notContains('datestamp:');
                    foreach ($finder as $file) {
                        file_put_contents(
                            $file->getRealpath(),
                            $this->generateInfoYamlMetadata($version, $project, $datestamp),
                            FILE_APPEND
                        );
                    }
                }
            }
        }
    }
public function generateInfoMetadata(PackageEvent $event)
    {
        $op = $event->getOperation();
        $package = $op->getJobType() == 'update'
            ? $op->getTargetPackage()
            : $op->getPackage();
        $installPath = $this->installationManager->getInstallPath($package);

        if (preg_match('/^drupal-/', $package->getType())) {
            if (preg_match('/^dev-/', $package->getPrettyVersion())) {
                $name = $package->getName();
                $project = preg_replace('/^.*\//', '', $name);
                $version = preg_replace('/^dev-(.*)/', $this->core.'.x-$1-dev', $package->getPrettyVersion());
                $branch = preg_replace('/^([0-9]*\.x-[0-9]*).*$/', '$1', $version);
                $datestamp = time();

                $this->io->write('  - Generating metadata for <info>'.$name.'</info>');

                // Compute the rebuild version string for a project.
                $version = $this->computeRebuildVersion($installPath, $branch) ?: $version;

                if ($this->core == '7') {
                    // Generate version information for `.info` files in ini format.
                    $finder = new Finder();
                    $finder
                        ->files()
                        ->in($installPath)
                        ->name('*.info')
                        ->notContains('datestamp =');
                    foreach ($finder as $file) {
                        file_put_contents(
                            $file->getRealpath(),
                            $this->generateInfoIniMetadata($version, $project, $datestamp),
                            FILE_APPEND
                        );
                    }
                } else {
                    // Generate version information for `.info.yml` files in YAML format.
                    $finder = new Finder();
                    $finder
                        ->files()
                        ->in($installPath)
                        ->name('*.info.yml')
                        ->notContains('datestamp:');
                    foreach ($finder as $file) {
                        file_put_contents(
                            $file->getRealpath(),
                            $this->generateInfoYamlMetadata($version, $project, $datestamp),
                            FILE_APPEND
                        );
                    }
                }
            }
        }
    }
public function generateInfoMetadata ( PackageEvent $ event ) { $ op = $ event -> getOperation ( ) ; $ package = $ op -> getJobType ( ) == 'update' ? $ op -> getTargetPackage ( ) : $ op -> getPackage ( ) ; $ installPath = $ this -> installationManager -> getInstallPath ( $ package ) ; if ( preg_match ( '/^drupal-/' , $ package -> getType ( ) ) ) { if ( preg_match ( '/^dev-/' , $ package -> getPrettyVersion ( ) ) ) { $ name = $ package -> getName ( ) ; $ project = preg_replace ( '/^.*\//' , '' , $ name ) ; $ version = preg_replace ( '/^dev-(.*)/' , $ this -> core . '.x-$1-dev' , $ package -> getPrettyVersion ( ) ) ; $ branch = preg_replace ( '/^([0-9]*\.x-[0-9]*).*$/' , '$1' , $ version ) ; $ datestamp = time ( ) ; $ this -> io -> write ( '  - Generating metadata for <info>' . $ name . '</info>' ) ; // Compute the rebuild version string for a project. $ version = $ this -> computeRebuildVersion ( $ installPath , $ branch ) ? : $ version ; if ( $ this -> core == '7' ) { // Generate version information for `.info` files in ini format. $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ installPath ) -> name ( '*.info' ) -> notContains ( 'datestamp =' ) ; foreach ( $ finder as $ file ) { file_put_contents ( $ file -> getRealpath ( ) , $ this -> generateInfoIniMetadata ( $ version , $ project , $ datestamp ) , FILE_APPEND ) ; } } else { // Generate version information for `.info.yml` files in YAML format. $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ installPath ) -> name ( '*.info.yml' ) -> notContains ( 'datestamp:' ) ; foreach ( $ finder as $ file ) { file_put_contents ( $ file -> getRealpath ( ) , $ this -> generateInfoYamlMetadata ( $ version , $ project , $ datestamp ) , FILE_APPEND ) ; } } } } }
Inject metadata into all .info files for a given project.

@see drush_pm_inject_info_file_metadata()
Inject metadata into all . info files for a given project .