function ManageGitIgnore::managementOfGitIgnoreEnabled

Same name in other branches
  1. 9 composer/Plugin/Scaffold/ManageGitIgnore.php \Drupal\Composer\Plugin\Scaffold\ManageGitIgnore::managementOfGitIgnoreEnabled()
  2. 8.9.x composer/Plugin/Scaffold/ManageGitIgnore.php \Drupal\Composer\Plugin\Scaffold\ManageGitIgnore::managementOfGitIgnoreEnabled()
  3. 10 composer/Plugin/Scaffold/ManageGitIgnore.php \Drupal\Composer\Plugin\Scaffold\ManageGitIgnore::managementOfGitIgnoreEnabled()

Determines whether we should manage gitignore files.

Parameters

\Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $options: Configuration options from the composer.json extras section.

Return value

bool Whether or not gitignore files should be managed.

1 call to ManageGitIgnore::managementOfGitIgnoreEnabled()
ManageGitIgnore::manageIgnored in composer/Plugin/Scaffold/ManageGitIgnore.php
Manages gitignore files.

File

composer/Plugin/Scaffold/ManageGitIgnore.php, line 85

Class

ManageGitIgnore
Manage the .gitignore file.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected function managementOfGitIgnoreEnabled(ScaffoldOptions $options) {
    // If the composer.json stipulates whether gitignore is managed or not, then
    // follow its recommendation.
    if ($options->hasGitIgnore()) {
        return $options->gitIgnore();
    }
    // Do not manage .gitignore if there is no repository here.
    if (!Git::isRepository($this->io, $this->dir)) {
        return FALSE;
    }
    // If the composer.json did not specify whether or not .gitignore files
    // should be managed, then manage them if the vendor directory is ignored.
    return Git::checkIgnore($this->io, 'vendor', $this->dir);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.