dev/src/Split/Command.php
private function processComponent(
        OutputInterface $output,
        GitHub $github,
        Split $split,
        array $component,
        $splitBinaryPath,
        $parentTagSource
    ) {
        $output->writeln('');
        $localVersion = current($this->componentManager->componentsVersion($component['id']));
        $isAlreadyTagged = $github->doesTagExist($component['target'], $localVersion);

        $output->writeln(sprintf(
            '<comment>%s</comment>: Starting on component. Target version <info>%s</info>',
            $component['id'],
            $localVersion
        ));

        $this->writeDiv($output);

        if ($isAlreadyTagged) {
            $output->writeln(sprintf(
                'Version <info>%s</info> already exists on target <info>%s</info>',
                $localVersion,
                $component['target']
            ));

            $output->writeln('<comment>[info]</comment> Skipping.');
            return true;
        }

        $output->writeln(sprintf(
            '<comment>%s</comment>: Running splitsh',
            $component['id']
        ));

        $splitBranch = $split->execute($splitBinaryPath, $this->rootPath, $component['path']);
        if ($splitBranch) {
            $output->writeln(sprintf('Split succeeded, branch <info>%s</info> created.', $splitBranch));
        } else {
            $output->writeln('<error>Split failed!</error>');

            return false;
        }

        $output->writeln('');

        $output->writeln(sprintf(
            '<comment>%s</comment>: Push to github target %s',
            $component['id'],
            $component['target']
        ));

        $res = $github->push($component['target'], $splitBranch);
        if ($res[0]) {
            $output->writeln(sprintf('<comment>%s</comment>: Push succeeded.', $component['id']));
        } else {
            $output->writeln(sprintf('<error>%s</error>: Push failed.', $component['id']));

            return false;
        }

        $output->writeln('');
        $output->writeln('<comment>[info]</comment> Creating GitHub tag.');

        // @todo once the release builder is refactored, this should generate
        //       actually useful release notes for the component in question.
        $notes = sprintf(
            'For release notes, please see the [associated Google Cloud PHP release](%s).',
            $parentTagSource
        );

        $res = $github->createRelease(
            $component['target'],
            $localVersion,
            $component['displayName'] . ' ' . $localVersion,
            $notes
        );

        if ($res) {
            $output->writeln(sprintf('<comment>%s</comment>: Tag succeeded.', $component['id']));
        } else {
            $output->writeln(sprintf('<error>%s</error>: Tag failed.', $component['id']));

            return false;
        }

        return true;
    }
private function processComponent(
        OutputInterface $output,
        GitHub $github,
        Split $split,
        array $component,
        $splitBinaryPath,
        $parentTagSource
    ) {
        $output->writeln('');
        $localVersion = current($this->componentManager->componentsVersion($component['id']));
        $isAlreadyTagged = $github->doesTagExist($component['target'], $localVersion);

        $output->writeln(sprintf(
            '<comment>%s</comment>: Starting on component. Target version <info>%s</info>',
            $component['id'],
            $localVersion
        ));

        $this->writeDiv($output);

        if ($isAlreadyTagged) {
            $output->writeln(sprintf(
                'Version <info>%s</info> already exists on target <info>%s</info>',
                $localVersion,
                $component['target']
            ));

            $output->writeln('<comment>[info]</comment> Skipping.');
            return true;
        }

        $output->writeln(sprintf(
            '<comment>%s</comment>: Running splitsh',
            $component['id']
        ));

        $splitBranch = $split->execute($splitBinaryPath, $this->rootPath, $component['path']);
        if ($splitBranch) {
            $output->writeln(sprintf('Split succeeded, branch <info>%s</info> created.', $splitBranch));
        } else {
            $output->writeln('<error>Split failed!</error>');

            return false;
        }

        $output->writeln('');

        $output->writeln(sprintf(
            '<comment>%s</comment>: Push to github target %s',
            $component['id'],
            $component['target']
        ));

        $res = $github->push($component['target'], $splitBranch);
        if ($res[0]) {
            $output->writeln(sprintf('<comment>%s</comment>: Push succeeded.', $component['id']));
        } else {
            $output->writeln(sprintf('<error>%s</error>: Push failed.', $component['id']));

            return false;
        }

        $output->writeln('');
        $output->writeln('<comment>[info]</comment> Creating GitHub tag.');

        // @todo once the release builder is refactored, this should generate
        //       actually useful release notes for the component in question.
        $notes = sprintf(
            'For release notes, please see the [associated Google Cloud PHP release](%s).',
            $parentTagSource
        );

        $res = $github->createRelease(
            $component['target'],
            $localVersion,
            $component['displayName'] . ' ' . $localVersion,
            $notes
        );

        if ($res) {
            $output->writeln(sprintf('<comment>%s</comment>: Tag succeeded.', $component['id']));
        } else {
            $output->writeln(sprintf('<error>%s</error>: Tag failed.', $component['id']));

            return false;
        }

        return true;
    }
private function processComponent ( OutputInterface $ output , GitHub $ github , Split $ split , array $ component , $ splitBinaryPath , $ parentTagSource ) { $ output -> writeln ( '' ) ; $ localVersion = current ( $ this -> componentManager -> componentsVersion ( $ component [ 'id' ] ) ) ; $ isAlreadyTagged = $ github -> doesTagExist ( $ component [ 'target' ] , $ localVersion ) ; $ output -> writeln ( sprintf ( '<comment>%s</comment>: Starting on component. Target version <info>%s</info>' , $ component [ 'id' ] , $ localVersion ) ) ; $ this -> writeDiv ( $ output ) ; if ( $ isAlreadyTagged ) { $ output -> writeln ( sprintf ( 'Version <info>%s</info> already exists on target <info>%s</info>' , $ localVersion , $ component [ 'target' ] ) ) ; $ output -> writeln ( '<comment>[info]</comment> Skipping.' ) ; return true ; } $ output -> writeln ( sprintf ( '<comment>%s</comment>: Running splitsh' , $ component [ 'id' ] ) ) ; $ splitBranch = $ split -> execute ( $ splitBinaryPath , $ this -> rootPath , $ component [ 'path' ] ) ; if ( $ splitBranch ) { $ output -> writeln ( sprintf ( 'Split succeeded, branch <info>%s</info> created.' , $ splitBranch ) ) ; } else { $ output -> writeln ( '<error>Split failed!</error>' ) ; return false ; } $ output -> writeln ( '' ) ; $ output -> writeln ( sprintf ( '<comment>%s</comment>: Push to github target %s' , $ component [ 'id' ] , $ component [ 'target' ] ) ) ; $ res = $ github -> push ( $ component [ 'target' ] , $ splitBranch ) ; if ( $ res [ 0 ] ) { $ output -> writeln ( sprintf ( '<comment>%s</comment>: Push succeeded.' , $ component [ 'id' ] ) ) ; } else { $ output -> writeln ( sprintf ( '<error>%s</error>: Push failed.' , $ component [ 'id' ] ) ) ; return false ; } $ output -> writeln ( '' ) ; $ output -> writeln ( '<comment>[info]</comment> Creating GitHub tag.' ) ; // @todo once the release builder is refactored, this should generate //       actually useful release notes for the component in question. $ notes = sprintf ( 'For release notes, please see the [associated Google Cloud PHP release](%s).' , $ parentTagSource ) ; $ res = $ github -> createRelease ( $ component [ 'target' ] , $ localVersion , $ component [ 'displayName' ] . ' ' . $ localVersion , $ notes ) ; if ( $ res ) { $ output -> writeln ( sprintf ( '<comment>%s</comment>: Tag succeeded.' , $ component [ 'id' ] ) ) ; } else { $ output -> writeln ( sprintf ( '<error>%s</error>: Tag failed.' , $ component [ 'id' ] ) ) ; return false ; } return true ; }
Process release for a given component.

Checks if the tag exists on the remote target, splits the component,
pushes to the remote target and creates a github release.

@param OutputInterface $output Allows writing to cli.
@param GitHub A GitHub API wrapper.
@param Split A Splitsh wrapper.
@param array $component The component data.
@param string $splitBinaryPath The path to the splitsh binary.
@param string $parentTagSource The URI to the parent tag.
@return bool
Process release for a given component .