Run the setup, one task at a time.

@since 0.1.0

@param Event $event The Composer event that is being handled.
173117
public static function run(Event $event)
    {
        $event->getIO()->write('<info>Now running setup tasks...</info>');
        $config = static::getConfig($event);
        $tasks  = static::getSetupTasks($event);
        foreach ($tasks as $task) {
            /** @var SetupTask $taskStep */
            $taskStep = new $task($config, $event);
            $event->getIO()->write(
                sprintf(
                    '<info>Task %1$s</info>',
                    $taskStep->getName()
                )
            );
            $taskStep->complete();
        }
        $event->getIO()->write('<info>Setup tasks complete, cleaning up...</info>');
    }
519201
public function send(Event $event)
    {
        $message = $this->getEventMessage($event);
        $this->flush($message);
    }
1289510
public function startFor(Domain\Event $event) : void
    {
        if (true === $this->started()) {
            throw new Exception\SubscriptionAlreadyStarted($this);
        }

        $this->applyEvent(new SubscriptionStarted($event, $this->clock->now()));
    }
1011092
final private function replayChange(Event $event)
    {
        $this->apply($event->payload());
        $this->lastCommittedEventSequenceNumber = $event->sequenceNumber();
    }
830481
protected function fireEvent($event)
    {
        $this->app['events']->fire(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
    }
749417
public function installHooks(Event $event) : void
    {
        $event->getIO()->write('CaptainHook Composer Plugin');
        if (!$this->isCaptainHookInstalled()) {
            // reload the autoloader to make sure CaptainHook is available
            $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
            require $vendorDir . '/autoload.php';
        }

        if (!$this->isCaptainHookInstalled()) {
            // if CaptainHook is still not available end the plugin execution
            // normally this only happens if CaptainHook gets uninstalled
            $event->getIO()->write(
                '  <info>CaptainHook not properly installed try to run composer update</info>' . PHP_EOL .
                PHP_EOL .
                'If you are uninstalling CaptainHook, we are sad seeing you go, ' .
                'but we would appreciate your feedback on your experience.' . PHP_EOL .
                'Just go to https://github.com/CaptainHookPhp/captainhook/issues to leave your feedback' . PHP_EOL .
                PHP_EOL .
                '<comment>WARNING: Don\'t forget to deactivate the hooks in your .git/hooks directory.</comment>'
            );
            return;
        }
        Cmd::setup($event);
    }
1098586
public function onPostInstallCmd(Event $event)
    {
        $this->bridgeFactory->createBridge($event->getIO())
            ->install($event->getComposer(), $event->isDevMode());
    }
1085050
public function setTaskAsDone(Event $event)
    {
        $this->checkPermission($event);
        if ($event->isTaskDone()) {
            throw new \Exception('This task is already mark as done.');
        }

        $event->setIsTaskDone(true);
        $om = $this->getDoctrine()->getManager();
        $om->flush();

        return new Response();
    }
508098
public function setup($event): void
    {
        $this->userRoles = null;
        $this->events->forget('orchestra.auth: roles');
        $this->events->listen('orchestra.auth: roles', $event);
    }
1071294
private static function runUpdateProjectFromAssets(Event $event)
    {
        if ($event->getName() !== ScriptEvents::POST_UPDATE_CMD) {
            return;
        }

        $updater = new ScriptHandlerUpdater($event);

        if (!$updater->needsUpdate()) {
            return;
        }
        $updater->update();

        static::updateProject($event);
    }
979788
public function onPostInstall(Event $event)
    {
        $lockFile = new JsonFile($this->lockFile);
        if ($lockFile->exists()) {
            $this->loadPackages($lockFile);
        } else {
            $this->scanPackages();
        }
        $this->runAction('install');
    }
669784
private function runFirstInstall(ScriptEvent $event)
    {
        $installer    = Installer::create(
            $event->getIO(),
            // Create a new Composer instance to ensure full processing of the merged files.
            Factory::create($event->getIO(), null, false)
        );

        $installer->setPreferSource($this->isPreferredInstall('source'));
        $installer->setPreferDist($this->isPreferredInstall('dist'));
        $installer->setDevMode($event->isDevMode());
        $installer->setDumpAutoloader($this->state->shouldDumpAutoloader());
        $installer->setOptimizeAutoloader($this->state->shouldOptimizeAutoloader());

        if ($this->state->forceUpdate()) {
            // Force update mode so that new packages are processed rather than just telling
            // the user that composer.json and composer.lock don't match.
            $installer->setUpdate(true);
        }

        $installer->run();
    }
119168
public function runHandler(Event $event)
    {
        if (is_callable($this->handler)) {
            return call_user_func($this->handler, $event);
        }
        return false;
    }
957953
public function runConsoleApplication(Event $event)
    {
        /** @var Router $router */
        $router = Container::get('router');
        if ($router->getBundle() !== 'migrations') {
            return;
        }

        if (!defined('PHINX_VERSION')) {
            define('PHINX_VERSION', (0 === strpos('@PHINX_VERSION@', '@PHINX_VERSION')) ? '0.4.1' : '@PHINX_VERSION@');
        }

        array_shift($_SERVER['argv']);
        if ($_SERVER['argv']) {
            $path = $_SERVER['argv'][0];
            unset($_SERVER['argv'][0]);
            $_SERVER['argv'] = array_merge(explode(':', $path), $_SERVER['argv']);
        }

        $app = new ConsoleApplication('Migrations plugin, based on Phinx by Rob Morgan.', PHINX_VERSION);
        $app->add(new Status());
        $app->add(new Create());
        $app->add(new Migrate());
        $app->add(new Rollback());
        $app->run();
    }
34460
public static function postInstall(Event $event)
    {
        require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';

        static::clearCompiled();
        static::artisanOptimize();
        static::artisanLangJS();
    }
229710
protected function runSingleServerEvent($event)
    {
        if ($this->schedule->serverShouldRun($event, $this->startedAt)) {
            $this->runEvent($event);
        } else {
            $this->line('<info>Skipping command (has already run on another server):</info> '.$event->getSummaryForDisplay());
        }
    }
464451
public static function setup(Event $event) : void
    {
        $extra  = self::getExtraConfig($event);
        $config = self::extract(CH::COMPOSER_CONFIG, $extra, CH::CONFIG);
        $repo   = self::extract(CH::COMPOSER_GIT_DIR, $extra, '.git');
        $app    = self::createApplication($event->getIO(), $config);

        self::configure($app, $config);
        self::install($app, $config, $repo);
    }