Skip to content

Commit

Permalink
Fix pattern usage in InitCommand.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Apr 1, 2016
1 parent 6e209e5 commit a8ac567
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions lib/Drush/Commands/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function initializeDrush($options = [
->textFromFile($example_bashrc)
->addToCollection($collection);
$pattern = basename($drush_bashrc);
$taskUpdateBashrc->appendUnlessMatches($pattern, "# Include Drush bash customizations.\n". $this->bashAddition($drush_bashrc));
$taskUpdateBashrc->appendUnlessMatches("#$pattern#", "# Include Drush bash customizations.\n". $this->bashAddition($drush_bashrc));
}

// If there is no ~/.drush/drush.complete.sh file, then copy it there
Expand All @@ -85,7 +85,7 @@ public function initializeDrush($options = [
->textFromFile($example_complete)
->addToCollection($collection);
$pattern = basename($drush_complete);
$taskUpdateBashrc->appendUnlessMatches($pattern, "# Include Drush completion.\n". $this->bashAddition($drush_complete));
$taskUpdateBashrc->appendUnlessMatches("#$pattern#", "# Include Drush completion.\n". $this->bashAddition($drush_complete));
}

// If there is no ~/.drush/drush.prompt.sh file, then copy
Expand All @@ -95,7 +95,7 @@ public function initializeDrush($options = [
->textFromFile($example_prompt)
->addToCollection($collection);
$pattern = basename($drush_prompt);
$taskUpdateBashrc->appendUnlessMatches($pattern, "# Include Drush prompt customizations.\n". $this->bashAddition($drush_prompt));
$taskUpdateBashrc->appendUnlessMatches("#$pattern#", "# Include Drush prompt customizations.\n". $this->bashAddition($drush_prompt));
}

// If Drush is not in the $PATH, then figure out which
Expand All @@ -104,8 +104,8 @@ public function initializeDrush($options = [
if ((!drush_which("drush") || $add_path) && ($add_path !== FALSE)) {
$drush_path = $this->findPathToDrush($home);
$drush_path = preg_replace("%^" . preg_quote($home) . "/%", '$HOME/', $drush_path);
$pattern = "%$drush_path%";
$taskUpdateBashrc->appendUnlessMatches($pattern, "# Path to Drush, added by 'drush init'.\nexport PATH=\"\$PATH:$drush_path\"\n\n");
$pattern = "$drush_path";
$taskUpdateBashrc->appendUnlessMatches("#$pattern#", "# Path to Drush, added by 'drush init'.\nexport PATH=\"\$PATH:$drush_path\"\n\n");
}

$openEditor = FALSE;
Expand Down

0 comments on commit a8ac567

Please sign in to comment.