public function setupDrushRemoteAliases()
    {
        $project_root = ProjectX::projectRoot();
        $drush_aliases_dir = "$project_root/drush/site-aliases";

        foreach (ProjectX::getRemoteEnvironments() as $realm => $environment) {
            $file_task = $this
                ->taskWriteToFile("$drush_aliases_dir/$realm.aliases.drushrc.php");

            $has_content = false;
            for ($i = 0; $i < count($environment); $i++) {
                $instance = $environment[$i];

                if (!isset($instance['name'])
                    || !isset($instance['path'])
                    || !isset($instance['uri'])
                    || !isset($instance['ssh_url'])) {
                    continue;
                }
                list($ssh_user, $ssh_host) = explode('@', $instance['ssh_url']);

                $options = [
                    'remote_user' => $ssh_user,
                    'remote_host' => $ssh_host
                ];

                $content = $this->drushAliasFileContent(
                    $instance['name'],
                    $instance['uri'],
                    $instance['path'],
                    $options,
                    $i === 0
                );
                $has_content = true;

                $file_task->line($content);
            }

            if ($has_content) {
                $file_task->run();
            }
        }

        return $this;
    }
public function setupDrushRemoteAliases()
    {
        $project_root = ProjectX::projectRoot();
        $drush_aliases_dir = "$project_root/drush/site-aliases";

        foreach (ProjectX::getRemoteEnvironments() as $realm => $environment) {
            $file_task = $this
                ->taskWriteToFile("$drush_aliases_dir/$realm.aliases.drushrc.php");

            $has_content = false;
            for ($i = 0; $i < count($environment); $i++) {
                $instance = $environment[$i];

                if (!isset($instance['name'])
                    || !isset($instance['path'])
                    || !isset($instance['uri'])
                    || !isset($instance['ssh_url'])) {
                    continue;
                }
                list($ssh_user, $ssh_host) = explode('@', $instance['ssh_url']);

                $options = [
                    'remote_user' => $ssh_user,
                    'remote_host' => $ssh_host
                ];

                $content = $this->drushAliasFileContent(
                    $instance['name'],
                    $instance['uri'],
                    $instance['path'],
                    $options,
                    $i === 0
                );
                $has_content = true;

                $file_task->line($content);
            }

            if ($has_content) {
                $file_task->run();
            }
        }

        return $this;
    }
public function setupDrushRemoteAliases ( ) { $ project_root = ProjectX :: projectRoot ( ) ; $ drush_aliases_dir = "$project_root/drush/site-aliases" ; foreach ( ProjectX :: getRemoteEnvironments ( ) as $ realm => $ environment ) { $ file_task = $ this -> taskWriteToFile ( "$drush_aliases_dir/$realm.aliases.drushrc.php" ) ; $ has_content = false ; for ( $ i = 0 ; $ i < count ( $ environment ) ; $ i ++ ) { $ instance = $ environment [ $ i ] ; if ( ! isset ( $ instance [ 'name' ] ) || ! isset ( $ instance [ 'path' ] ) || ! isset ( $ instance [ 'uri' ] ) || ! isset ( $ instance [ 'ssh_url' ] ) ) { continue ; } list ( $ ssh_user , $ ssh_host ) = explode ( '@' , $ instance [ 'ssh_url' ] ) ; $ options = [ 'remote_user' => $ ssh_user , 'remote_host' => $ ssh_host ] ; $ content = $ this -> drushAliasFileContent ( $ instance [ 'name' ] , $ instance [ 'uri' ] , $ instance [ 'path' ] , $ options , $ i === 0 ) ; $ has_content = true ; $ file_task -> line ( $ content ) ; } if ( $ has_content ) { $ file_task -> run ( ) ; } } return $ this ; }
Setup Drush remote aliases.

The setup process consist of the following:
- Write the remote $aliases[] into a drush alias file; which is
based off the remote realm.

@return self
Setup Drush remote aliases .