Platformsh\Cli\Local\Toolstack\ToolstackBase::copyGitIgnore PHP Method

copyGitIgnore() protected method

Create a default .gitignore file for the app.
protected copyGitIgnore ( string $source )
$source string The path to a default .gitignore file, relative to the 'resources' directory.
    protected function copyGitIgnore($source)
    {
        $source = CLI_ROOT . '/resources/' . $source;
        $gitRoot = $this->gitHelper->getRoot($this->appRoot);
        if (!$gitRoot) {
            return;
        }
        $appGitIgnore = $this->appRoot . '/.gitignore';
        if (!file_exists($appGitIgnore) && !file_exists($gitRoot . '/.gitignore')) {
            $this->output->writeln("Creating a .gitignore file");
            copy($source, $appGitIgnore);
        }
    }