repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
list | docstring
stringlengths 3
47.2k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 91
247
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
acquia/blt
|
src/Robo/Common/Executor.php
|
Executor.checkUrl
|
public function checkUrl($url) {
try {
$client = new Client();
$res = $client->request('GET', $url, [
'connection_timeout' => 2,
'timeout' => 2,
'exceptions' => FALSE,
]);
if ($res->getStatusCode() && substr($res->getStatusCode(), 0, 1) != '5') {
return TRUE;
}
else {
$this->logger->debug($res->getBody());
return FALSE;
}
}
catch (\Exception $e) {
$this->logger->debug($e->getMessage());
}
return FALSE;
}
|
php
|
public function checkUrl($url) {
try {
$client = new Client();
$res = $client->request('GET', $url, [
'connection_timeout' => 2,
'timeout' => 2,
'exceptions' => FALSE,
]);
if ($res->getStatusCode() && substr($res->getStatusCode(), 0, 1) != '5') {
return TRUE;
}
else {
$this->logger->debug($res->getBody());
return FALSE;
}
}
catch (\Exception $e) {
$this->logger->debug($e->getMessage());
}
return FALSE;
}
|
[
"public",
"function",
"checkUrl",
"(",
"$",
"url",
")",
"{",
"try",
"{",
"$",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"$",
"res",
"=",
"$",
"client",
"->",
"request",
"(",
"'GET'",
",",
"$",
"url",
",",
"[",
"'connection_timeout'",
"=>",
"2",
",",
"'timeout'",
"=>",
"2",
",",
"'exceptions'",
"=>",
"FALSE",
",",
"]",
")",
";",
"if",
"(",
"$",
"res",
"->",
"getStatusCode",
"(",
")",
"&&",
"substr",
"(",
"$",
"res",
"->",
"getStatusCode",
"(",
")",
",",
"0",
",",
"1",
")",
"!=",
"'5'",
")",
"{",
"return",
"TRUE",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"$",
"res",
"->",
"getBody",
"(",
")",
")",
";",
"return",
"FALSE",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"FALSE",
";",
"}"
] |
Checks a URL for a non-50x response.
@param string $url
The URL to check.
@return bool
TRUE if URL responded with a non-50x response.
|
[
"Checks",
"a",
"URL",
"for",
"a",
"non",
"-",
"50x",
"response",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/Executor.php#L211-L231
|
train
|
acquia/blt
|
src/Robo/Commands/Doctor/DevDesktopCheck.php
|
DevDesktopCheck.checkDevDesktop
|
protected function checkDevDesktop() {
if ($this->getInspector()->isDevDesktopInitialized()) {
if (empty($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'])) {
$this->logProblem(__FUNCTION__, [
"DevDesktop usage is enabled, but \$DEVDESKTOP_DRUPAL_SETTINGS_DIR is not set in your environmental variables.",
"",
"Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\"\$HOME/.acquia/DevDesktop/DrupalSettings\"` to ~/.bash_profile or equivalent for your system.`",
], 'error');
}
elseif (strstr($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'], '~')) {
$this->logProblem(__FUNCTION__, [
"\$DEVDESKTOP_DRUPAL_SETTINGS_DIR contains a '~'. This does not always expand to your home directory.",
"",
"Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\"\$HOME/.acquia/DevDesktop/DrupalSettings\"` to ~/.bash_profile or equivalent for your system.`",
], 'error');
}
$variables_order = ini_get('variables_order');
$php_ini_file = php_ini_loaded_file();
if (!strstr($variables_order, 'E')) {
$this->logProblem(__FUNCTION__, [
"DevDesktop usage is enabled, but variables_order does support environmental variables.",
"",
"Define variables_order = \"EGPCS\" in $php_ini_file",
], 'error');
}
}
}
|
php
|
protected function checkDevDesktop() {
if ($this->getInspector()->isDevDesktopInitialized()) {
if (empty($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'])) {
$this->logProblem(__FUNCTION__, [
"DevDesktop usage is enabled, but \$DEVDESKTOP_DRUPAL_SETTINGS_DIR is not set in your environmental variables.",
"",
"Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\"\$HOME/.acquia/DevDesktop/DrupalSettings\"` to ~/.bash_profile or equivalent for your system.`",
], 'error');
}
elseif (strstr($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'], '~')) {
$this->logProblem(__FUNCTION__, [
"\$DEVDESKTOP_DRUPAL_SETTINGS_DIR contains a '~'. This does not always expand to your home directory.",
"",
"Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\"\$HOME/.acquia/DevDesktop/DrupalSettings\"` to ~/.bash_profile or equivalent for your system.`",
], 'error');
}
$variables_order = ini_get('variables_order');
$php_ini_file = php_ini_loaded_file();
if (!strstr($variables_order, 'E')) {
$this->logProblem(__FUNCTION__, [
"DevDesktop usage is enabled, but variables_order does support environmental variables.",
"",
"Define variables_order = \"EGPCS\" in $php_ini_file",
], 'error');
}
}
}
|
[
"protected",
"function",
"checkDevDesktop",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getInspector",
"(",
")",
"->",
"isDevDesktopInitialized",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_ENV",
"[",
"'DEVDESKTOP_DRUPAL_SETTINGS_DIR'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"DevDesktop usage is enabled, but \\$DEVDESKTOP_DRUPAL_SETTINGS_DIR is not set in your environmental variables.\"",
",",
"\"\"",
",",
"\"Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\\\"\\$HOME/.acquia/DevDesktop/DrupalSettings\\\"` to ~/.bash_profile or equivalent for your system.`\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"elseif",
"(",
"strstr",
"(",
"$",
"_ENV",
"[",
"'DEVDESKTOP_DRUPAL_SETTINGS_DIR'",
"]",
",",
"'~'",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"\\$DEVDESKTOP_DRUPAL_SETTINGS_DIR contains a '~'. This does not always expand to your home directory.\"",
",",
"\"\"",
",",
"\"Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\\\"\\$HOME/.acquia/DevDesktop/DrupalSettings\\\"` to ~/.bash_profile or equivalent for your system.`\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"$",
"variables_order",
"=",
"ini_get",
"(",
"'variables_order'",
")",
";",
"$",
"php_ini_file",
"=",
"php_ini_loaded_file",
"(",
")",
";",
"if",
"(",
"!",
"strstr",
"(",
"$",
"variables_order",
",",
"'E'",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"DevDesktop usage is enabled, but variables_order does support environmental variables.\"",
",",
"\"\"",
",",
"\"Define variables_order = \\\"EGPCS\\\" in $php_ini_file\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"}",
"}"
] |
Checks that Dev Desktop is configured correctly.
|
[
"Checks",
"that",
"Dev",
"Desktop",
"is",
"configured",
"correctly",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Doctor/DevDesktopCheck.php#L17-L44
|
train
|
acquia/blt
|
src/Robo/Filesets/FilesetManager.php
|
FilesetManager.registerFilesets
|
public function registerFilesets() {
// @todo Assert that filesets from \Acquia\Blt\Custom\Filesets override
// those from \Acquia\Blt\Custom\Filesets.
$classes = [
// @codingStandardsIgnoreStart
\Acquia\Blt\Robo\Filesets\Filesets::class,
\Acquia\Blt\Custom\Filesets::class,
// @codingStandardsIgnoreEnd
];
$fileset_annotations = $this->getAllFilesetAnnotations($classes);
$filesets = $this->getFilesetsFromAnnotations($fileset_annotations);
$this->filesets = $filesets;
}
|
php
|
public function registerFilesets() {
// @todo Assert that filesets from \Acquia\Blt\Custom\Filesets override
// those from \Acquia\Blt\Custom\Filesets.
$classes = [
// @codingStandardsIgnoreStart
\Acquia\Blt\Robo\Filesets\Filesets::class,
\Acquia\Blt\Custom\Filesets::class,
// @codingStandardsIgnoreEnd
];
$fileset_annotations = $this->getAllFilesetAnnotations($classes);
$filesets = $this->getFilesetsFromAnnotations($fileset_annotations);
$this->filesets = $filesets;
}
|
[
"public",
"function",
"registerFilesets",
"(",
")",
"{",
"// @todo Assert that filesets from \\Acquia\\Blt\\Custom\\Filesets override",
"// those from \\Acquia\\Blt\\Custom\\Filesets.",
"$",
"classes",
"=",
"[",
"// @codingStandardsIgnoreStart",
"\\",
"Acquia",
"\\",
"Blt",
"\\",
"Robo",
"\\",
"Filesets",
"\\",
"Filesets",
"::",
"class",
",",
"\\",
"Acquia",
"\\",
"Blt",
"\\",
"Custom",
"\\",
"Filesets",
"::",
"class",
",",
"// @codingStandardsIgnoreEnd",
"]",
";",
"$",
"fileset_annotations",
"=",
"$",
"this",
"->",
"getAllFilesetAnnotations",
"(",
"$",
"classes",
")",
";",
"$",
"filesets",
"=",
"$",
"this",
"->",
"getFilesetsFromAnnotations",
"(",
"$",
"fileset_annotations",
")",
";",
"$",
"this",
"->",
"filesets",
"=",
"$",
"filesets",
";",
"}"
] |
Registers filesets.
Finds and instantiates all filesets by scanning $classes for @fileset
annotations.
|
[
"Registers",
"filesets",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Filesets/FilesetManager.php#L50-L63
|
train
|
acquia/blt
|
src/Robo/Filesets/FilesetManager.php
|
FilesetManager.getFilesetsFromAnnotations
|
protected function getFilesetsFromAnnotations($fileset_annotations) {
$filesets = [];
$this->logger->debug("Gathering filesets from annotated methods...");;
foreach ($fileset_annotations as $class => $fileset) {
if (class_exists($class)) {
$fileset_class = new $class();
$fileset_class->setConfig($this->config);
foreach ($fileset as $id => $method_name) {
$this->logger->debug("Calling $method_name on $class object...");
if (method_exists($fileset_class, $method_name)) {
$filesets[$id] = call_user_func_array([$fileset_class, $method_name],
[]);
}
}
}
}
return $filesets;
}
|
php
|
protected function getFilesetsFromAnnotations($fileset_annotations) {
$filesets = [];
$this->logger->debug("Gathering filesets from annotated methods...");;
foreach ($fileset_annotations as $class => $fileset) {
if (class_exists($class)) {
$fileset_class = new $class();
$fileset_class->setConfig($this->config);
foreach ($fileset as $id => $method_name) {
$this->logger->debug("Calling $method_name on $class object...");
if (method_exists($fileset_class, $method_name)) {
$filesets[$id] = call_user_func_array([$fileset_class, $method_name],
[]);
}
}
}
}
return $filesets;
}
|
[
"protected",
"function",
"getFilesetsFromAnnotations",
"(",
"$",
"fileset_annotations",
")",
"{",
"$",
"filesets",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"\"Gathering filesets from annotated methods...\"",
")",
";",
";",
"foreach",
"(",
"$",
"fileset_annotations",
"as",
"$",
"class",
"=>",
"$",
"fileset",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"$",
"fileset_class",
"=",
"new",
"$",
"class",
"(",
")",
";",
"$",
"fileset_class",
"->",
"setConfig",
"(",
"$",
"this",
"->",
"config",
")",
";",
"foreach",
"(",
"$",
"fileset",
"as",
"$",
"id",
"=>",
"$",
"method_name",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"\"Calling $method_name on $class object...\"",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"fileset_class",
",",
"$",
"method_name",
")",
")",
"{",
"$",
"filesets",
"[",
"$",
"id",
"]",
"=",
"call_user_func_array",
"(",
"[",
"$",
"fileset_class",
",",
"$",
"method_name",
"]",
",",
"[",
"]",
")",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"filesets",
";",
"}"
] |
Gets an array of instantiated filesets, given an array of annotations.
@param array $fileset_annotations
An array of fileset annotations, as returned by
$this->getAllFilesetAnnotations().
@return \Symfony\Component\Finder\Finder[]
An array of instantiated filesets.
|
[
"Gets",
"an",
"array",
"of",
"instantiated",
"filesets",
"given",
"an",
"array",
"of",
"annotations",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Filesets/FilesetManager.php#L169-L186
|
train
|
acquia/blt
|
src/Robo/Common/IO.php
|
IO.yell
|
protected function yell($text, $length = 40, $color = 'green') {
$format = "<fg=white;bg=$color;options=bold>%s</fg=white;bg=$color;options=bold>";
$this->formattedOutput($text, $length, $format);
}
|
php
|
protected function yell($text, $length = 40, $color = 'green') {
$format = "<fg=white;bg=$color;options=bold>%s</fg=white;bg=$color;options=bold>";
$this->formattedOutput($text, $length, $format);
}
|
[
"protected",
"function",
"yell",
"(",
"$",
"text",
",",
"$",
"length",
"=",
"40",
",",
"$",
"color",
"=",
"'green'",
")",
"{",
"$",
"format",
"=",
"\"<fg=white;bg=$color;options=bold>%s</fg=white;bg=$color;options=bold>\"",
";",
"$",
"this",
"->",
"formattedOutput",
"(",
"$",
"text",
",",
"$",
"length",
",",
"$",
"format",
")",
";",
"}"
] |
Writes text to screen with big, loud decoration.
@param string $text
The text to write.
@param int $length
The length at which text should be wrapped.
@param string $color
The color of the text.
|
[
"Writes",
"text",
"to",
"screen",
"with",
"big",
"loud",
"decoration",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/IO.php#L38-L41
|
train
|
acquia/blt
|
src/Robo/Common/IO.php
|
IO.askChoice
|
protected function askChoice($question, $options, $default = NULL) {
return $this->doAsk(new ChoiceQuestion($this->formatQuestion($question),
$options, $default));
}
|
php
|
protected function askChoice($question, $options, $default = NULL) {
return $this->doAsk(new ChoiceQuestion($this->formatQuestion($question),
$options, $default));
}
|
[
"protected",
"function",
"askChoice",
"(",
"$",
"question",
",",
"$",
"options",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"return",
"$",
"this",
"->",
"doAsk",
"(",
"new",
"ChoiceQuestion",
"(",
"$",
"this",
"->",
"formatQuestion",
"(",
"$",
"question",
")",
",",
"$",
"options",
",",
"$",
"default",
")",
")",
";",
"}"
] |
Asks the user a multiple-choice question.
@param string $question
The question text.
@param array $options
An array of available options.
@return string
The chosen option.
|
[
"Asks",
"the",
"user",
"a",
"multiple",
"-",
"choice",
"question",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/IO.php#L82-L85
|
train
|
acquia/blt
|
src/Robo/Common/IO.php
|
IO.askRequired
|
protected function askRequired($message) {
$question = new Question($this->formatQuestion($message));
$question->setValidator(function ($answer) {
if (empty($answer)) {
throw new \RuntimeException(
'You must enter a value!'
);
}
return $answer;
});
return $this->doAsk($question);
}
|
php
|
protected function askRequired($message) {
$question = new Question($this->formatQuestion($message));
$question->setValidator(function ($answer) {
if (empty($answer)) {
throw new \RuntimeException(
'You must enter a value!'
);
}
return $answer;
});
return $this->doAsk($question);
}
|
[
"protected",
"function",
"askRequired",
"(",
"$",
"message",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"$",
"this",
"->",
"formatQuestion",
"(",
"$",
"message",
")",
")",
";",
"$",
"question",
"->",
"setValidator",
"(",
"function",
"(",
"$",
"answer",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"answer",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'You must enter a value!'",
")",
";",
"}",
"return",
"$",
"answer",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"doAsk",
"(",
"$",
"question",
")",
";",
"}"
] |
Asks a required question.
@param string $message
The question text.
@return string
The response.
|
[
"Asks",
"a",
"required",
"question",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/IO.php#L96-L108
|
train
|
acquia/blt
|
src/Robo/Common/IO.php
|
IO.printArrayAsTable
|
protected function printArrayAsTable(
array $array,
array $headers = ['Property', 'Value']
) {
$table = new Table($this->output);
$table->setHeaders($headers)
->setRows(ArrayManipulator::convertArrayToFlatTextArray($array))
->render();
}
|
php
|
protected function printArrayAsTable(
array $array,
array $headers = ['Property', 'Value']
) {
$table = new Table($this->output);
$table->setHeaders($headers)
->setRows(ArrayManipulator::convertArrayToFlatTextArray($array))
->render();
}
|
[
"protected",
"function",
"printArrayAsTable",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"headers",
"=",
"[",
"'Property'",
",",
"'Value'",
"]",
")",
"{",
"$",
"table",
"=",
"new",
"Table",
"(",
"$",
"this",
"->",
"output",
")",
";",
"$",
"table",
"->",
"setHeaders",
"(",
"$",
"headers",
")",
"->",
"setRows",
"(",
"ArrayManipulator",
"::",
"convertArrayToFlatTextArray",
"(",
"$",
"array",
")",
")",
"->",
"render",
"(",
")",
";",
"}"
] |
Writes an array to the screen as a formatted table.
@param array $array
The unformatted array.
@param array $headers
The headers for the array. Defaults to ['Property','Value'].
|
[
"Writes",
"an",
"array",
"to",
"the",
"screen",
"as",
"a",
"formatted",
"table",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/IO.php#L118-L126
|
train
|
acquia/blt
|
src/Robo/Common/IO.php
|
IO.logConfig
|
protected function logConfig(array $array, $prefix = '', $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) {
if ($this->output()->getVerbosity() >= $verbosity) {
if ($prefix) {
$this->output()->writeln("<comment>Configuration for $prefix:</comment>");
foreach ($array as $key => $value) {
$array["$prefix.$key"] = $value;
unset($array[$key]);
}
}
$this->printArrayAsTable($array);
}
}
|
php
|
protected function logConfig(array $array, $prefix = '', $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) {
if ($this->output()->getVerbosity() >= $verbosity) {
if ($prefix) {
$this->output()->writeln("<comment>Configuration for $prefix:</comment>");
foreach ($array as $key => $value) {
$array["$prefix.$key"] = $value;
unset($array[$key]);
}
}
$this->printArrayAsTable($array);
}
}
|
[
"protected",
"function",
"logConfig",
"(",
"array",
"$",
"array",
",",
"$",
"prefix",
"=",
"''",
",",
"$",
"verbosity",
"=",
"OutputInterface",
"::",
"VERBOSITY_VERY_VERBOSE",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"output",
"(",
")",
"->",
"getVerbosity",
"(",
")",
">=",
"$",
"verbosity",
")",
"{",
"if",
"(",
"$",
"prefix",
")",
"{",
"$",
"this",
"->",
"output",
"(",
")",
"->",
"writeln",
"(",
"\"<comment>Configuration for $prefix:</comment>\"",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"array",
"[",
"\"$prefix.$key\"",
"]",
"=",
"$",
"value",
";",
"unset",
"(",
"$",
"array",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"$",
"this",
"->",
"printArrayAsTable",
"(",
"$",
"array",
")",
";",
"}",
"}"
] |
Writes a particular configuration key's value to the log.
@param array $array
The configuration.
@param string $prefix
A prefix to add to each row in the configuration.
@param int $verbosity
The verbosity level at which to display the logged message.
|
[
"Writes",
"a",
"particular",
"configuration",
"key",
"s",
"value",
"to",
"the",
"log",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Common/IO.php#L138-L149
|
train
|
acquia/blt
|
src/Robo/Blt.php
|
Blt.addBuiltInCommandsAndHooks
|
private function addBuiltInCommandsAndHooks() {
$commands = $this->getCommands([
'path' => __DIR__ . '/Commands',
'namespace' => 'Acquia\Blt\Robo\Commands',
]);
$hooks = $this->getHooks([
'path' => __DIR__ . '/Hooks',
'namespace' => 'Acquia\Blt\Robo\Hooks',
]);
$this->commands = array_merge($commands, $hooks);
}
|
php
|
private function addBuiltInCommandsAndHooks() {
$commands = $this->getCommands([
'path' => __DIR__ . '/Commands',
'namespace' => 'Acquia\Blt\Robo\Commands',
]);
$hooks = $this->getHooks([
'path' => __DIR__ . '/Hooks',
'namespace' => 'Acquia\Blt\Robo\Hooks',
]);
$this->commands = array_merge($commands, $hooks);
}
|
[
"private",
"function",
"addBuiltInCommandsAndHooks",
"(",
")",
"{",
"$",
"commands",
"=",
"$",
"this",
"->",
"getCommands",
"(",
"[",
"'path'",
"=>",
"__DIR__",
".",
"'/Commands'",
",",
"'namespace'",
"=>",
"'Acquia\\Blt\\Robo\\Commands'",
",",
"]",
")",
";",
"$",
"hooks",
"=",
"$",
"this",
"->",
"getHooks",
"(",
"[",
"'path'",
"=>",
"__DIR__",
".",
"'/Hooks'",
",",
"'namespace'",
"=>",
"'Acquia\\Blt\\Robo\\Hooks'",
",",
"]",
")",
";",
"$",
"this",
"->",
"commands",
"=",
"array_merge",
"(",
"$",
"commands",
",",
"$",
"hooks",
")",
";",
"}"
] |
Add the commands and hooks which are shipped with core BLT.
|
[
"Add",
"the",
"commands",
"and",
"hooks",
"which",
"are",
"shipped",
"with",
"core",
"BLT",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Blt.php#L96-L106
|
train
|
acquia/blt
|
src/Robo/Blt.php
|
Blt.getCommands
|
private function getCommands(
array $options = ['path' => NULL, 'namespace' => NULL]
) {
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*Command.php')
->setSearchLocations([])
->addExclude('Internal');
return $discovery->discover($options['path'], $options['namespace']);
}
|
php
|
private function getCommands(
array $options = ['path' => NULL, 'namespace' => NULL]
) {
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*Command.php')
->setSearchLocations([])
->addExclude('Internal');
return $discovery->discover($options['path'], $options['namespace']);
}
|
[
"private",
"function",
"getCommands",
"(",
"array",
"$",
"options",
"=",
"[",
"'path'",
"=>",
"NULL",
",",
"'namespace'",
"=>",
"NULL",
"]",
")",
"{",
"$",
"discovery",
"=",
"new",
"CommandFileDiscovery",
"(",
")",
";",
"$",
"discovery",
"->",
"setSearchPattern",
"(",
"'*Command.php'",
")",
"->",
"setSearchLocations",
"(",
"[",
"]",
")",
"->",
"addExclude",
"(",
"'Internal'",
")",
";",
"return",
"$",
"discovery",
"->",
"discover",
"(",
"$",
"options",
"[",
"'path'",
"]",
",",
"$",
"options",
"[",
"'namespace'",
"]",
")",
";",
"}"
] |
Discovers command classes using CommandFileDiscovery.
@param string[] $options
Elements as follow
string path The full path to the directory to search for commands
string namespace The full namespace for the command directory.
@return array
An array of Command classes
|
[
"Discovers",
"command",
"classes",
"using",
"CommandFileDiscovery",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Blt.php#L119-L128
|
train
|
acquia/blt
|
src/Robo/Blt.php
|
Blt.getHooks
|
private function getHooks(
array $options = ['path' => NULL, 'namespace' => NULL]
) {
$discovery = new CommandFileDiscovery();
$discovery->setSearchPattern('*Hook.php')->setSearchLocations([]);
return $discovery->discover($options['path'], $options['namespace']);
}
|
php
|
private function getHooks(
array $options = ['path' => NULL, 'namespace' => NULL]
) {
$discovery = new CommandFileDiscovery();
$discovery->setSearchPattern('*Hook.php')->setSearchLocations([]);
return $discovery->discover($options['path'], $options['namespace']);
}
|
[
"private",
"function",
"getHooks",
"(",
"array",
"$",
"options",
"=",
"[",
"'path'",
"=>",
"NULL",
",",
"'namespace'",
"=>",
"NULL",
"]",
")",
"{",
"$",
"discovery",
"=",
"new",
"CommandFileDiscovery",
"(",
")",
";",
"$",
"discovery",
"->",
"setSearchPattern",
"(",
"'*Hook.php'",
")",
"->",
"setSearchLocations",
"(",
"[",
"]",
")",
";",
"return",
"$",
"discovery",
"->",
"discover",
"(",
"$",
"options",
"[",
"'path'",
"]",
",",
"$",
"options",
"[",
"'namespace'",
"]",
")",
";",
"}"
] |
Discovers hooks using CommandFileDiscovery.
@param string[] $options
Elements as follow
string path The full path to the directory to search for commands
string namespace The full namespace for the command directory.
@return array
An array of Hook classes
|
[
"Discovers",
"hooks",
"using",
"CommandFileDiscovery",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Blt.php#L141-L147
|
train
|
acquia/blt
|
src/Robo/Blt.php
|
Blt.addDefaultArgumentsAndOptions
|
private function addDefaultArgumentsAndOptions(Application $app) {
$app->getDefinition()
->addOption(
new InputOption('--define', '-D', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Define a configuration item value.', [])
);
$app->getDefinition()
->addOption(
new InputOption('--environment', NULL, InputOption::VALUE_REQUIRED, 'Set the environment to load config from blt/[env].yml file.', [])
);
$app->getDefinition()
->addOption(
new InputOption('--site', NULL, InputOption::VALUE_REQUIRED, 'The multisite to execute this command against.', [])
);
}
|
php
|
private function addDefaultArgumentsAndOptions(Application $app) {
$app->getDefinition()
->addOption(
new InputOption('--define', '-D', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Define a configuration item value.', [])
);
$app->getDefinition()
->addOption(
new InputOption('--environment', NULL, InputOption::VALUE_REQUIRED, 'Set the environment to load config from blt/[env].yml file.', [])
);
$app->getDefinition()
->addOption(
new InputOption('--site', NULL, InputOption::VALUE_REQUIRED, 'The multisite to execute this command against.', [])
);
}
|
[
"private",
"function",
"addDefaultArgumentsAndOptions",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"app",
"->",
"getDefinition",
"(",
")",
"->",
"addOption",
"(",
"new",
"InputOption",
"(",
"'--define'",
",",
"'-D'",
",",
"InputOption",
"::",
"VALUE_REQUIRED",
"|",
"InputOption",
"::",
"VALUE_IS_ARRAY",
",",
"'Define a configuration item value.'",
",",
"[",
"]",
")",
")",
";",
"$",
"app",
"->",
"getDefinition",
"(",
")",
"->",
"addOption",
"(",
"new",
"InputOption",
"(",
"'--environment'",
",",
"NULL",
",",
"InputOption",
"::",
"VALUE_REQUIRED",
",",
"'Set the environment to load config from blt/[env].yml file.'",
",",
"[",
"]",
")",
")",
";",
"$",
"app",
"->",
"getDefinition",
"(",
")",
"->",
"addOption",
"(",
"new",
"InputOption",
"(",
"'--site'",
",",
"NULL",
",",
"InputOption",
"::",
"VALUE_REQUIRED",
",",
"'The multisite to execute this command against.'",
",",
"[",
"]",
")",
")",
";",
"}"
] |
Add any global arguments or options that apply to all commands.
@param \Acquia\Blt\Robo\Application $app
The Symfony application.
|
[
"Add",
"any",
"global",
"arguments",
"or",
"options",
"that",
"apply",
"to",
"all",
"commands",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Blt.php#L155-L168
|
train
|
acquia/blt
|
src/Robo/Blt.php
|
Blt.configureContainer
|
public function configureContainer($container) {
$container->share('logStyler', BltLogStyle::class);
// We create our own builder so that non-command classes are able to
// implement task methods, like taskExec(). Yes, there are now two builders
// in the container. "collectionBuilder" used for the actual command that
// was executed, and "builder" to be used with non-command classes.
$blt_tasks = new BltTasks();
$builder = new CollectionBuilder($blt_tasks);
$blt_tasks->setBuilder($builder);
$container->add('builder', $builder);
$container->add('executor', Executor::class)
->withArgument('builder');
$container->share('inspector', Inspector::class)
->withArgument('executor');
$container->inflector(InspectorAwareInterface::class)
->invokeMethod('setInspector', ['inspector']);
$container->add(SetupWizard::class)
->withArgument('executor');
$container->add(TestsWizard::class)
->withArgument('executor');
$container->share('filesetManager', FilesetManager::class);
$updater = new Updater('Acquia\Blt\Update\Updates', $this->getConfig()->get('repo.root'));
$container->share('updater', $updater);
/** @var \Consolidation\AnnotatedCommand\AnnotatedCommandFactory $factory */
$factory = $container->get('commandFactory');
// Tell the command loader to only allow command functions that have a
// name/alias.
$factory->setIncludeAllPublicMethods(FALSE);
$factory->addCommandInfoAlterer(new BltCommandInfoAlterer());
}
|
php
|
public function configureContainer($container) {
$container->share('logStyler', BltLogStyle::class);
// We create our own builder so that non-command classes are able to
// implement task methods, like taskExec(). Yes, there are now two builders
// in the container. "collectionBuilder" used for the actual command that
// was executed, and "builder" to be used with non-command classes.
$blt_tasks = new BltTasks();
$builder = new CollectionBuilder($blt_tasks);
$blt_tasks->setBuilder($builder);
$container->add('builder', $builder);
$container->add('executor', Executor::class)
->withArgument('builder');
$container->share('inspector', Inspector::class)
->withArgument('executor');
$container->inflector(InspectorAwareInterface::class)
->invokeMethod('setInspector', ['inspector']);
$container->add(SetupWizard::class)
->withArgument('executor');
$container->add(TestsWizard::class)
->withArgument('executor');
$container->share('filesetManager', FilesetManager::class);
$updater = new Updater('Acquia\Blt\Update\Updates', $this->getConfig()->get('repo.root'));
$container->share('updater', $updater);
/** @var \Consolidation\AnnotatedCommand\AnnotatedCommandFactory $factory */
$factory = $container->get('commandFactory');
// Tell the command loader to only allow command functions that have a
// name/alias.
$factory->setIncludeAllPublicMethods(FALSE);
$factory->addCommandInfoAlterer(new BltCommandInfoAlterer());
}
|
[
"public",
"function",
"configureContainer",
"(",
"$",
"container",
")",
"{",
"$",
"container",
"->",
"share",
"(",
"'logStyler'",
",",
"BltLogStyle",
"::",
"class",
")",
";",
"// We create our own builder so that non-command classes are able to",
"// implement task methods, like taskExec(). Yes, there are now two builders",
"// in the container. \"collectionBuilder\" used for the actual command that",
"// was executed, and \"builder\" to be used with non-command classes.",
"$",
"blt_tasks",
"=",
"new",
"BltTasks",
"(",
")",
";",
"$",
"builder",
"=",
"new",
"CollectionBuilder",
"(",
"$",
"blt_tasks",
")",
";",
"$",
"blt_tasks",
"->",
"setBuilder",
"(",
"$",
"builder",
")",
";",
"$",
"container",
"->",
"add",
"(",
"'builder'",
",",
"$",
"builder",
")",
";",
"$",
"container",
"->",
"add",
"(",
"'executor'",
",",
"Executor",
"::",
"class",
")",
"->",
"withArgument",
"(",
"'builder'",
")",
";",
"$",
"container",
"->",
"share",
"(",
"'inspector'",
",",
"Inspector",
"::",
"class",
")",
"->",
"withArgument",
"(",
"'executor'",
")",
";",
"$",
"container",
"->",
"inflector",
"(",
"InspectorAwareInterface",
"::",
"class",
")",
"->",
"invokeMethod",
"(",
"'setInspector'",
",",
"[",
"'inspector'",
"]",
")",
";",
"$",
"container",
"->",
"add",
"(",
"SetupWizard",
"::",
"class",
")",
"->",
"withArgument",
"(",
"'executor'",
")",
";",
"$",
"container",
"->",
"add",
"(",
"TestsWizard",
"::",
"class",
")",
"->",
"withArgument",
"(",
"'executor'",
")",
";",
"$",
"container",
"->",
"share",
"(",
"'filesetManager'",
",",
"FilesetManager",
"::",
"class",
")",
";",
"$",
"updater",
"=",
"new",
"Updater",
"(",
"'Acquia\\Blt\\Update\\Updates'",
",",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"'repo.root'",
")",
")",
";",
"$",
"container",
"->",
"share",
"(",
"'updater'",
",",
"$",
"updater",
")",
";",
"/** @var \\Consolidation\\AnnotatedCommand\\AnnotatedCommandFactory $factory */",
"$",
"factory",
"=",
"$",
"container",
"->",
"get",
"(",
"'commandFactory'",
")",
";",
"// Tell the command loader to only allow command functions that have a",
"// name/alias.",
"$",
"factory",
"->",
"setIncludeAllPublicMethods",
"(",
"FALSE",
")",
";",
"$",
"factory",
"->",
"addCommandInfoAlterer",
"(",
"new",
"BltCommandInfoAlterer",
"(",
")",
")",
";",
"}"
] |
Register the necessary classes for BLT.
|
[
"Register",
"the",
"necessary",
"classes",
"for",
"BLT",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Blt.php#L173-L209
|
train
|
acquia/blt
|
src/Robo/Blt.php
|
Blt.run
|
public function run(InputInterface $input, OutputInterface $output) {
$application = $this->getContainer()->get('application');
$status_code = $this->runner->run($input, $output, $application, $this->commands);
return $status_code;
}
|
php
|
public function run(InputInterface $input, OutputInterface $output) {
$application = $this->getContainer()->get('application');
$status_code = $this->runner->run($input, $output, $application, $this->commands);
return $status_code;
}
|
[
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"application",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'application'",
")",
";",
"$",
"status_code",
"=",
"$",
"this",
"->",
"runner",
"->",
"run",
"(",
"$",
"input",
",",
"$",
"output",
",",
"$",
"application",
",",
"$",
"this",
"->",
"commands",
")",
";",
"return",
"$",
"status_code",
";",
"}"
] |
Runs the instantiated BLT application.
@param \Symfony\Component\Console\Input\InputInterface $input
An input object to run the application with.
@param \Symfony\Component\Console\Output\OutputInterface $output
An output object to run the application with.
@return int
The exiting status code of the application
|
[
"Runs",
"the",
"instantiated",
"BLT",
"application",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Blt.php#L222-L227
|
train
|
acquia/blt
|
src/Robo/Config/BltConfig.php
|
BltConfig.expandFileProperties
|
public function expandFileProperties($filename) {
$expanded_contents = Expander::expandArrayProperties(file($filename), $this->export());
file_put_contents($filename, implode("", $expanded_contents));
}
|
php
|
public function expandFileProperties($filename) {
$expanded_contents = Expander::expandArrayProperties(file($filename), $this->export());
file_put_contents($filename, implode("", $expanded_contents));
}
|
[
"public",
"function",
"expandFileProperties",
"(",
"$",
"filename",
")",
"{",
"$",
"expanded_contents",
"=",
"Expander",
"::",
"expandArrayProperties",
"(",
"file",
"(",
"$",
"filename",
")",
",",
"$",
"this",
"->",
"export",
"(",
")",
")",
";",
"file_put_contents",
"(",
"$",
"filename",
",",
"implode",
"(",
"\"\"",
",",
"$",
"expanded_contents",
")",
")",
";",
"}"
] |
Expands YAML placeholders in a given file, using config object.
@param string $filename
The file in which placeholders should be expanded.
|
[
"Expands",
"YAML",
"placeholders",
"in",
"a",
"given",
"file",
"using",
"config",
"object",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Config/BltConfig.php#L19-L22
|
train
|
acquia/blt
|
src/Robo/Config/BltConfig.php
|
BltConfig.set
|
public function set($key, $value) {
if ($value === 'false') {
$value = FALSE;
}
elseif ($value === 'true') {
$value = TRUE;
}
// Expand properties in string. We do this here so that one can pass
// -D drush.alias=${drush.ci.aliases} at runtime and still expand
// properties.
if (is_string($value) && strstr($value, '$')) {
$expanded = Expander::expandArrayProperties([$value], $this->export());
$value = $expanded[0];
}
return parent::set($key, $value);
}
|
php
|
public function set($key, $value) {
if ($value === 'false') {
$value = FALSE;
}
elseif ($value === 'true') {
$value = TRUE;
}
// Expand properties in string. We do this here so that one can pass
// -D drush.alias=${drush.ci.aliases} at runtime and still expand
// properties.
if (is_string($value) && strstr($value, '$')) {
$expanded = Expander::expandArrayProperties([$value], $this->export());
$value = $expanded[0];
}
return parent::set($key, $value);
}
|
[
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"'false'",
")",
"{",
"$",
"value",
"=",
"FALSE",
";",
"}",
"elseif",
"(",
"$",
"value",
"===",
"'true'",
")",
"{",
"$",
"value",
"=",
"TRUE",
";",
"}",
"// Expand properties in string. We do this here so that one can pass",
"// -D drush.alias=${drush.ci.aliases} at runtime and still expand",
"// properties.",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"strstr",
"(",
"$",
"value",
",",
"'$'",
")",
")",
"{",
"$",
"expanded",
"=",
"Expander",
"::",
"expandArrayProperties",
"(",
"[",
"$",
"value",
"]",
",",
"$",
"this",
"->",
"export",
"(",
")",
")",
";",
"$",
"value",
"=",
"$",
"expanded",
"[",
"0",
"]",
";",
"}",
"return",
"parent",
"::",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] |
Set a config value.
@param string $key
The config key.
@param mixed $value
The config value.
@return $this
|
[
"Set",
"a",
"config",
"value",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Config/BltConfig.php#L34-L52
|
train
|
acquia/blt
|
src/Robo/Config/BltConfig.php
|
BltConfig.get
|
public function get($key, $defaultOverride = NULL) {
$value = parent::get($key, $defaultOverride);
// Last ditch effort to expand properties that may not have been processed.
if (is_string($value) && strstr($value, '$')) {
$expanded = Expander::expandArrayProperties([$value], $this->export());
$value = $expanded[0];
}
return $value;
}
|
php
|
public function get($key, $defaultOverride = NULL) {
$value = parent::get($key, $defaultOverride);
// Last ditch effort to expand properties that may not have been processed.
if (is_string($value) && strstr($value, '$')) {
$expanded = Expander::expandArrayProperties([$value], $this->export());
$value = $expanded[0];
}
return $value;
}
|
[
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"defaultOverride",
"=",
"NULL",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"get",
"(",
"$",
"key",
",",
"$",
"defaultOverride",
")",
";",
"// Last ditch effort to expand properties that may not have been processed.",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"strstr",
"(",
"$",
"value",
",",
"'$'",
")",
")",
"{",
"$",
"expanded",
"=",
"Expander",
"::",
"expandArrayProperties",
"(",
"[",
"$",
"value",
"]",
",",
"$",
"this",
"->",
"export",
"(",
")",
")",
";",
"$",
"value",
"=",
"$",
"expanded",
"[",
"0",
"]",
";",
"}",
"return",
"$",
"value",
";",
"}"
] |
Fetch a configuration value.
@param string $key
Which config item to look up.
@param string|null $defaultOverride
Override usual default value with a different default. Deprecated;
provide defaults to the config processor instead.
@return mixed
|
[
"Fetch",
"a",
"configuration",
"value",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Config/BltConfig.php#L65-L75
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.deploy
|
public function deploy($options = [
'branch' => InputOption::VALUE_REQUIRED,
'tag' => InputOption::VALUE_REQUIRED,
'commit-msg' => InputOption::VALUE_REQUIRED,
'ignore-dirty' => FALSE,
'dry-run' => FALSE,
'ignore-platform-reqs' => FALSE,
]) {
if ($options['dry-run']) {
$this->logger->warning("This will be a dry run, the artifact will not be pushed.");
}
$this->checkDirty($options);
if (isset($options['ignore-platform-reqs'])) {
$this->ignorePlatformReqs = $options['ignore-platform-reqs'];
}
if (!$options['tag'] && !$options['branch']) {
$this->createTag = $this->confirm("Would you like to create a tag?", $this->createTag);
}
$this->commitMessage = $this->getCommitMessage($options);
if ($options['tag'] || $this->createTag) {
// Warn if they're creating a tag and we won't tag the source for them.
if (!$this->tagSource) {
$this->say("Config option deploy.tag_source if FALSE. The source repo will not be tagged.");
}
$this->deployToTag($options);
}
else {
$this->deployToBranch($options);
}
}
|
php
|
public function deploy($options = [
'branch' => InputOption::VALUE_REQUIRED,
'tag' => InputOption::VALUE_REQUIRED,
'commit-msg' => InputOption::VALUE_REQUIRED,
'ignore-dirty' => FALSE,
'dry-run' => FALSE,
'ignore-platform-reqs' => FALSE,
]) {
if ($options['dry-run']) {
$this->logger->warning("This will be a dry run, the artifact will not be pushed.");
}
$this->checkDirty($options);
if (isset($options['ignore-platform-reqs'])) {
$this->ignorePlatformReqs = $options['ignore-platform-reqs'];
}
if (!$options['tag'] && !$options['branch']) {
$this->createTag = $this->confirm("Would you like to create a tag?", $this->createTag);
}
$this->commitMessage = $this->getCommitMessage($options);
if ($options['tag'] || $this->createTag) {
// Warn if they're creating a tag and we won't tag the source for them.
if (!$this->tagSource) {
$this->say("Config option deploy.tag_source if FALSE. The source repo will not be tagged.");
}
$this->deployToTag($options);
}
else {
$this->deployToBranch($options);
}
}
|
[
"public",
"function",
"deploy",
"(",
"$",
"options",
"=",
"[",
"'branch'",
"=>",
"InputOption",
"::",
"VALUE_REQUIRED",
",",
"'tag'",
"=>",
"InputOption",
"::",
"VALUE_REQUIRED",
",",
"'commit-msg'",
"=>",
"InputOption",
"::",
"VALUE_REQUIRED",
",",
"'ignore-dirty'",
"=>",
"FALSE",
",",
"'dry-run'",
"=>",
"FALSE",
",",
"'ignore-platform-reqs'",
"=>",
"FALSE",
",",
"]",
")",
"{",
"if",
"(",
"$",
"options",
"[",
"'dry-run'",
"]",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"\"This will be a dry run, the artifact will not be pushed.\"",
")",
";",
"}",
"$",
"this",
"->",
"checkDirty",
"(",
"$",
"options",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'ignore-platform-reqs'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"ignorePlatformReqs",
"=",
"$",
"options",
"[",
"'ignore-platform-reqs'",
"]",
";",
"}",
"if",
"(",
"!",
"$",
"options",
"[",
"'tag'",
"]",
"&&",
"!",
"$",
"options",
"[",
"'branch'",
"]",
")",
"{",
"$",
"this",
"->",
"createTag",
"=",
"$",
"this",
"->",
"confirm",
"(",
"\"Would you like to create a tag?\"",
",",
"$",
"this",
"->",
"createTag",
")",
";",
"}",
"$",
"this",
"->",
"commitMessage",
"=",
"$",
"this",
"->",
"getCommitMessage",
"(",
"$",
"options",
")",
";",
"if",
"(",
"$",
"options",
"[",
"'tag'",
"]",
"||",
"$",
"this",
"->",
"createTag",
")",
"{",
"// Warn if they're creating a tag and we won't tag the source for them.",
"if",
"(",
"!",
"$",
"this",
"->",
"tagSource",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Config option deploy.tag_source if FALSE. The source repo will not be tagged.\"",
")",
";",
"}",
"$",
"this",
"->",
"deployToTag",
"(",
"$",
"options",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"deployToBranch",
"(",
"$",
"options",
")",
";",
"}",
"}"
] |
Builds separate artifact and pushes to git.remotes defined blt.yml.
@command artifact:deploy
@aliases ad deploy
@validateGitConfig
@param array $options
Options that can be passed via the CLI.
@throws BltException
|
[
"Builds",
"separate",
"artifact",
"and",
"pushes",
"to",
"git",
".",
"remotes",
"defined",
"blt",
".",
"yml",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L49-L81
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.getCommitMessage
|
protected function getCommitMessage($options) {
if (!$options['commit-msg']) {
chdir($this->getConfigValue('repo.root'));
$log = explode(' ', shell_exec("git log --oneline -1"), 2);
$git_last_commit_message = trim($log[1]);
return $this->askDefault('Enter a valid commit message', $git_last_commit_message);
}
else {
$this->say("Commit message is set to <comment>{$options['commit-msg']}</comment>.");
return $options['commit-msg'];
}
}
|
php
|
protected function getCommitMessage($options) {
if (!$options['commit-msg']) {
chdir($this->getConfigValue('repo.root'));
$log = explode(' ', shell_exec("git log --oneline -1"), 2);
$git_last_commit_message = trim($log[1]);
return $this->askDefault('Enter a valid commit message', $git_last_commit_message);
}
else {
$this->say("Commit message is set to <comment>{$options['commit-msg']}</comment>.");
return $options['commit-msg'];
}
}
|
[
"protected",
"function",
"getCommitMessage",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"options",
"[",
"'commit-msg'",
"]",
")",
"{",
"chdir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
")",
";",
"$",
"log",
"=",
"explode",
"(",
"' '",
",",
"shell_exec",
"(",
"\"git log --oneline -1\"",
")",
",",
"2",
")",
";",
"$",
"git_last_commit_message",
"=",
"trim",
"(",
"$",
"log",
"[",
"1",
"]",
")",
";",
"return",
"$",
"this",
"->",
"askDefault",
"(",
"'Enter a valid commit message'",
",",
"$",
"git_last_commit_message",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Commit message is set to <comment>{$options['commit-msg']}</comment>.\"",
")",
";",
"return",
"$",
"options",
"[",
"'commit-msg'",
"]",
";",
"}",
"}"
] |
Gets the commit message to be used for committing deployment artifact.
Defaults to the last commit message on the source branch.
@return string
The commit message.
|
[
"Gets",
"the",
"commit",
"message",
"to",
"be",
"used",
"for",
"committing",
"deployment",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L123-L135
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.getBranchName
|
protected function getBranchName($options) {
if ($options['branch']) {
$this->say("Branch is set to <comment>{$options['branch']}</comment>.");
return $options['branch'];
}
else {
return $this->askDefault('Enter the branch name for the deployment artifact', $this->getDefaultBranchName());
}
}
|
php
|
protected function getBranchName($options) {
if ($options['branch']) {
$this->say("Branch is set to <comment>{$options['branch']}</comment>.");
return $options['branch'];
}
else {
return $this->askDefault('Enter the branch name for the deployment artifact', $this->getDefaultBranchName());
}
}
|
[
"protected",
"function",
"getBranchName",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"options",
"[",
"'branch'",
"]",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Branch is set to <comment>{$options['branch']}</comment>.\"",
")",
";",
"return",
"$",
"options",
"[",
"'branch'",
"]",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"askDefault",
"(",
"'Enter the branch name for the deployment artifact'",
",",
"$",
"this",
"->",
"getDefaultBranchName",
"(",
")",
")",
";",
"}",
"}"
] |
Gets the branch name for the deployment artifact.
Defaults to [current-branch]-build.
@return string
The branch name.
|
[
"Gets",
"the",
"branch",
"name",
"for",
"the",
"deployment",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L145-L153
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.getTagName
|
protected function getTagName($options) {
if ($options['tag']) {
$tag_name = $options['tag'];
}
else {
$tag_name = $this->ask('Enter the tag name for the deployment artifact, e.g., 1.0.0-build');
}
if (empty($tag_name)) {
// @todo Validate tag name is valid, e.g., no spaces or special characters.
throw new BltException("You must enter a valid tag name.");
}
else {
$this->say("Tag is set to <comment>$tag_name</comment>.");
}
return $tag_name;
}
|
php
|
protected function getTagName($options) {
if ($options['tag']) {
$tag_name = $options['tag'];
}
else {
$tag_name = $this->ask('Enter the tag name for the deployment artifact, e.g., 1.0.0-build');
}
if (empty($tag_name)) {
// @todo Validate tag name is valid, e.g., no spaces or special characters.
throw new BltException("You must enter a valid tag name.");
}
else {
$this->say("Tag is set to <comment>$tag_name</comment>.");
}
return $tag_name;
}
|
[
"protected",
"function",
"getTagName",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"options",
"[",
"'tag'",
"]",
")",
"{",
"$",
"tag_name",
"=",
"$",
"options",
"[",
"'tag'",
"]",
";",
"}",
"else",
"{",
"$",
"tag_name",
"=",
"$",
"this",
"->",
"ask",
"(",
"'Enter the tag name for the deployment artifact, e.g., 1.0.0-build'",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"tag_name",
")",
")",
"{",
"// @todo Validate tag name is valid, e.g., no spaces or special characters.",
"throw",
"new",
"BltException",
"(",
"\"You must enter a valid tag name.\"",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Tag is set to <comment>$tag_name</comment>.\"",
")",
";",
"}",
"return",
"$",
"tag_name",
";",
"}"
] |
Gets the name of the tag to cut.
@param $options
@return string
@throws \Exception
|
[
"Gets",
"the",
"name",
"of",
"the",
"tag",
"to",
"cut",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L164-L181
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.getDefaultBranchName
|
protected function getDefaultBranchName() {
chdir($this->getConfigValue('repo.root'));
$git_current_branch = trim(shell_exec("git rev-parse --abbrev-ref HEAD"));
$default_branch = $git_current_branch . '-build';
return $default_branch;
}
|
php
|
protected function getDefaultBranchName() {
chdir($this->getConfigValue('repo.root'));
$git_current_branch = trim(shell_exec("git rev-parse --abbrev-ref HEAD"));
$default_branch = $git_current_branch . '-build';
return $default_branch;
}
|
[
"protected",
"function",
"getDefaultBranchName",
"(",
")",
"{",
"chdir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
")",
";",
"$",
"git_current_branch",
"=",
"trim",
"(",
"shell_exec",
"(",
"\"git rev-parse --abbrev-ref HEAD\"",
")",
")",
";",
"$",
"default_branch",
"=",
"$",
"git_current_branch",
".",
"'-build'",
";",
"return",
"$",
"default_branch",
";",
"}"
] |
Gets the default branch name for the deployment artifact.
|
[
"Gets",
"the",
"default",
"branch",
"name",
"for",
"the",
"deployment",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L186-L192
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.deployToTag
|
protected function deployToTag($options) {
$this->tagName = $this->getTagName($options);
// If we are building a tag, then we assume that we will NOT be pushing the
// build branch from which the tag is created. However, we must still have a
// local branch from which to cut the tag, so we create a temporary one.
$this->branchName = $this->getDefaultBranchName() . '-temp';
$this->prepareDir();
$this->addGitRemotes();
$this->checkoutLocalDeployBranch();
$this->build();
$this->commit();
$this->cutTag('build');
// Check the deploy.tag_source config value and also tag the source repo if
// it is set to TRUE (the default).
if ($this->tagSource) {
$this->cutTag('source');
}
$this->push($this->tagName, $options);
}
|
php
|
protected function deployToTag($options) {
$this->tagName = $this->getTagName($options);
// If we are building a tag, then we assume that we will NOT be pushing the
// build branch from which the tag is created. However, we must still have a
// local branch from which to cut the tag, so we create a temporary one.
$this->branchName = $this->getDefaultBranchName() . '-temp';
$this->prepareDir();
$this->addGitRemotes();
$this->checkoutLocalDeployBranch();
$this->build();
$this->commit();
$this->cutTag('build');
// Check the deploy.tag_source config value and also tag the source repo if
// it is set to TRUE (the default).
if ($this->tagSource) {
$this->cutTag('source');
}
$this->push($this->tagName, $options);
}
|
[
"protected",
"function",
"deployToTag",
"(",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"tagName",
"=",
"$",
"this",
"->",
"getTagName",
"(",
"$",
"options",
")",
";",
"// If we are building a tag, then we assume that we will NOT be pushing the",
"// build branch from which the tag is created. However, we must still have a",
"// local branch from which to cut the tag, so we create a temporary one.",
"$",
"this",
"->",
"branchName",
"=",
"$",
"this",
"->",
"getDefaultBranchName",
"(",
")",
".",
"'-temp'",
";",
"$",
"this",
"->",
"prepareDir",
"(",
")",
";",
"$",
"this",
"->",
"addGitRemotes",
"(",
")",
";",
"$",
"this",
"->",
"checkoutLocalDeployBranch",
"(",
")",
";",
"$",
"this",
"->",
"build",
"(",
")",
";",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"$",
"this",
"->",
"cutTag",
"(",
"'build'",
")",
";",
"// Check the deploy.tag_source config value and also tag the source repo if",
"// it is set to TRUE (the default).",
"if",
"(",
"$",
"this",
"->",
"tagSource",
")",
"{",
"$",
"this",
"->",
"cutTag",
"(",
"'source'",
")",
";",
"}",
"$",
"this",
"->",
"push",
"(",
"$",
"this",
"->",
"tagName",
",",
"$",
"options",
")",
";",
"}"
] |
Creates artifact, cuts new tag, and pushes.
|
[
"Creates",
"artifact",
"cuts",
"new",
"tag",
"and",
"pushes",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L197-L218
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.deployToBranch
|
protected function deployToBranch($options) {
$this->branchName = $this->getBranchName($options);
$this->prepareDir();
$this->addGitRemotes();
$this->checkoutLocalDeployBranch();
$this->mergeUpstreamChanges();
$this->build();
$this->commit();
$this->push($this->branchName, $options);
}
|
php
|
protected function deployToBranch($options) {
$this->branchName = $this->getBranchName($options);
$this->prepareDir();
$this->addGitRemotes();
$this->checkoutLocalDeployBranch();
$this->mergeUpstreamChanges();
$this->build();
$this->commit();
$this->push($this->branchName, $options);
}
|
[
"protected",
"function",
"deployToBranch",
"(",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"branchName",
"=",
"$",
"this",
"->",
"getBranchName",
"(",
"$",
"options",
")",
";",
"$",
"this",
"->",
"prepareDir",
"(",
")",
";",
"$",
"this",
"->",
"addGitRemotes",
"(",
")",
";",
"$",
"this",
"->",
"checkoutLocalDeployBranch",
"(",
")",
";",
"$",
"this",
"->",
"mergeUpstreamChanges",
"(",
")",
";",
"$",
"this",
"->",
"build",
"(",
")",
";",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"$",
"this",
"->",
"push",
"(",
"$",
"this",
"->",
"branchName",
",",
"$",
"options",
")",
";",
"}"
] |
Creates artifact on branch and pushes.
|
[
"Creates",
"artifact",
"on",
"branch",
"and",
"pushes",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L223-L232
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.prepareDir
|
protected function prepareDir() {
$this->say("Preparing artifact directory...");
$deploy_dir = $this->deployDir;
$this->taskDeleteDir($deploy_dir)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
$this->taskFilesystemStack()
->mkdir($this->deployDir)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail()
->run();
$this->taskExecStack()
->dir($deploy_dir)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail()
->exec("git init")
->exec("git config --local core.excludesfile false")
->exec("git config --local core.fileMode true")
->run();
$this->say("Global .gitignore file is being disabled for this repository to prevent unexpected behavior.");
}
|
php
|
protected function prepareDir() {
$this->say("Preparing artifact directory...");
$deploy_dir = $this->deployDir;
$this->taskDeleteDir($deploy_dir)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
$this->taskFilesystemStack()
->mkdir($this->deployDir)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail()
->run();
$this->taskExecStack()
->dir($deploy_dir)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail()
->exec("git init")
->exec("git config --local core.excludesfile false")
->exec("git config --local core.fileMode true")
->run();
$this->say("Global .gitignore file is being disabled for this repository to prevent unexpected behavior.");
}
|
[
"protected",
"function",
"prepareDir",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Preparing artifact directory...\"",
")",
";",
"$",
"deploy_dir",
"=",
"$",
"this",
"->",
"deployDir",
";",
"$",
"this",
"->",
"taskDeleteDir",
"(",
"$",
"deploy_dir",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"mkdir",
"(",
"$",
"this",
"->",
"deployDir",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"deploy_dir",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"exec",
"(",
"\"git init\"",
")",
"->",
"exec",
"(",
"\"git config --local core.excludesfile false\"",
")",
"->",
"exec",
"(",
"\"git config --local core.fileMode true\"",
")",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Global .gitignore file is being disabled for this repository to prevent unexpected behavior.\"",
")",
";",
"}"
] |
Deletes the existing deploy directory and initializes git repo.
|
[
"Deletes",
"the",
"existing",
"deploy",
"directory",
"and",
"initializes",
"git",
"repo",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L237-L257
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.checkoutLocalDeployBranch
|
protected function checkoutLocalDeployBranch() {
$this->taskExecStack()
->dir($this->deployDir)
// Create new branch locally.We intentionally use stopOnFail(FALSE) in
// case the branch already exists. `git checkout -B` does not seem to work
// as advertised.
// @todo perform this in a way that avoid errors completely.
->stopOnFail(FALSE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->exec("git checkout -b {$this->branchName}")
->run();
}
|
php
|
protected function checkoutLocalDeployBranch() {
$this->taskExecStack()
->dir($this->deployDir)
// Create new branch locally.We intentionally use stopOnFail(FALSE) in
// case the branch already exists. `git checkout -B` does not seem to work
// as advertised.
// @todo perform this in a way that avoid errors completely.
->stopOnFail(FALSE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->exec("git checkout -b {$this->branchName}")
->run();
}
|
[
"protected",
"function",
"checkoutLocalDeployBranch",
"(",
")",
"{",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"deployDir",
")",
"// Create new branch locally.We intentionally use stopOnFail(FALSE) in",
"// case the branch already exists. `git checkout -B` does not seem to work",
"// as advertised.",
"// @todo perform this in a way that avoid errors completely.",
"->",
"stopOnFail",
"(",
"FALSE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"exec",
"(",
"\"git checkout -b {$this->branchName}\"",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Checks out a new, local branch for artifact.
|
[
"Checks",
"out",
"a",
"new",
"local",
"branch",
"for",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L291-L302
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.mergeUpstreamChanges
|
protected function mergeUpstreamChanges() {
$git_remotes = $this->getConfigValue('git.remotes');
$remote_url = reset($git_remotes);
$remote_name = md5($remote_url);
$this->say("Merging upstream changes into local artifact...");
$this->taskExecStack()
->dir($this->deployDir)
// This branch may not exist upstream, so we do not fail the build if a
// merge fails.
->stopOnFail(FALSE)
->exec("git fetch $remote_name {$this->branchName} --depth=1")
->exec("git merge $remote_name/{$this->branchName}")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
php
|
protected function mergeUpstreamChanges() {
$git_remotes = $this->getConfigValue('git.remotes');
$remote_url = reset($git_remotes);
$remote_name = md5($remote_url);
$this->say("Merging upstream changes into local artifact...");
$this->taskExecStack()
->dir($this->deployDir)
// This branch may not exist upstream, so we do not fail the build if a
// merge fails.
->stopOnFail(FALSE)
->exec("git fetch $remote_name {$this->branchName} --depth=1")
->exec("git merge $remote_name/{$this->branchName}")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
[
"protected",
"function",
"mergeUpstreamChanges",
"(",
")",
"{",
"$",
"git_remotes",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'git.remotes'",
")",
";",
"$",
"remote_url",
"=",
"reset",
"(",
"$",
"git_remotes",
")",
";",
"$",
"remote_name",
"=",
"md5",
"(",
"$",
"remote_url",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Merging upstream changes into local artifact...\"",
")",
";",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"deployDir",
")",
"// This branch may not exist upstream, so we do not fail the build if a",
"// merge fails.",
"->",
"stopOnFail",
"(",
"FALSE",
")",
"->",
"exec",
"(",
"\"git fetch $remote_name {$this->branchName} --depth=1\"",
")",
"->",
"exec",
"(",
"\"git merge $remote_name/{$this->branchName}\"",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Merges upstream changes into deploy branch.
|
[
"Merges",
"upstream",
"changes",
"into",
"deploy",
"branch",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L307-L322
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.build
|
public function build() {
$this->say("Generating build artifact...");
$this->say("For more detailed output, use the -v flag.");
$commands = [
// Execute `blt source:build:frontend` to ensure that frontend artifact
// are generated in source repo.
'source:build:frontend',
// Execute `drupal:hash-salt:init` to ensure that salt.txt exists.
// There's a slim chance this has never been generated.
'drupal:hash-salt:init',
];
if (!empty($this->tagName)) {
$commands['drupal:deployment-identifier:init'] = ['--id' => $this->tagName];
}
else {
$commands[] = 'drupal:deployment-identifier:init';
}
$this->invokeCommands($commands);
$this->buildCopy();
$this->composerInstall();
$this->sanitize();
$this->deploySamlConfig();
$this->invokeHook("post-deploy-build");
$this->say("<info>The deployment artifact was generated at {$this->deployDir}.</info>");
}
|
php
|
public function build() {
$this->say("Generating build artifact...");
$this->say("For more detailed output, use the -v flag.");
$commands = [
// Execute `blt source:build:frontend` to ensure that frontend artifact
// are generated in source repo.
'source:build:frontend',
// Execute `drupal:hash-salt:init` to ensure that salt.txt exists.
// There's a slim chance this has never been generated.
'drupal:hash-salt:init',
];
if (!empty($this->tagName)) {
$commands['drupal:deployment-identifier:init'] = ['--id' => $this->tagName];
}
else {
$commands[] = 'drupal:deployment-identifier:init';
}
$this->invokeCommands($commands);
$this->buildCopy();
$this->composerInstall();
$this->sanitize();
$this->deploySamlConfig();
$this->invokeHook("post-deploy-build");
$this->say("<info>The deployment artifact was generated at {$this->deployDir}.</info>");
}
|
[
"public",
"function",
"build",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Generating build artifact...\"",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"For more detailed output, use the -v flag.\"",
")",
";",
"$",
"commands",
"=",
"[",
"// Execute `blt source:build:frontend` to ensure that frontend artifact",
"// are generated in source repo.",
"'source:build:frontend'",
",",
"// Execute `drupal:hash-salt:init` to ensure that salt.txt exists.",
"// There's a slim chance this has never been generated.",
"'drupal:hash-salt:init'",
",",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"tagName",
")",
")",
"{",
"$",
"commands",
"[",
"'drupal:deployment-identifier:init'",
"]",
"=",
"[",
"'--id'",
"=>",
"$",
"this",
"->",
"tagName",
"]",
";",
"}",
"else",
"{",
"$",
"commands",
"[",
"]",
"=",
"'drupal:deployment-identifier:init'",
";",
"}",
"$",
"this",
"->",
"invokeCommands",
"(",
"$",
"commands",
")",
";",
"$",
"this",
"->",
"buildCopy",
"(",
")",
";",
"$",
"this",
"->",
"composerInstall",
"(",
")",
";",
"$",
"this",
"->",
"sanitize",
"(",
")",
";",
"$",
"this",
"->",
"deploySamlConfig",
"(",
")",
";",
"$",
"this",
"->",
"invokeHook",
"(",
"\"post-deploy-build\"",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"<info>The deployment artifact was generated at {$this->deployDir}.</info>\"",
")",
";",
"}"
] |
Builds deployment artifact.
@command artifact:build
@aliases ab deploy:build
|
[
"Builds",
"deployment",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L330-L356
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.buildCopy
|
protected function buildCopy() {
$exclude_list_file = $this->getExcludeListFile();
$source = $this->getConfigValue('repo.root');
$dest = $this->deployDir;
$this->setMultisiteFilePermissions(0777);
$this->say("Rsyncing files from source repo into the build artifact...");
$this->taskExecStack()->exec("rsync -a --no-g --delete --delete-excluded --exclude-from='$exclude_list_file' '$source/' '$dest/' --filter 'protect /.git/'")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail()
->dir($this->getConfigValue('repo.root'))
->run();
$this->setMultisiteFilePermissions(0755);
// Remove temporary file that may have been created by
// $this->getExcludeListFile().
$this->taskFilesystemStack()
->remove($this->excludeFileTemp)
->copy(
$this->getConfigValue('deploy.gitignore_file'),
$this->deployDir . '/.gitignore', TRUE
)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
php
|
protected function buildCopy() {
$exclude_list_file = $this->getExcludeListFile();
$source = $this->getConfigValue('repo.root');
$dest = $this->deployDir;
$this->setMultisiteFilePermissions(0777);
$this->say("Rsyncing files from source repo into the build artifact...");
$this->taskExecStack()->exec("rsync -a --no-g --delete --delete-excluded --exclude-from='$exclude_list_file' '$source/' '$dest/' --filter 'protect /.git/'")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail()
->dir($this->getConfigValue('repo.root'))
->run();
$this->setMultisiteFilePermissions(0755);
// Remove temporary file that may have been created by
// $this->getExcludeListFile().
$this->taskFilesystemStack()
->remove($this->excludeFileTemp)
->copy(
$this->getConfigValue('deploy.gitignore_file'),
$this->deployDir . '/.gitignore', TRUE
)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
}
|
[
"protected",
"function",
"buildCopy",
"(",
")",
"{",
"$",
"exclude_list_file",
"=",
"$",
"this",
"->",
"getExcludeListFile",
"(",
")",
";",
"$",
"source",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
";",
"$",
"dest",
"=",
"$",
"this",
"->",
"deployDir",
";",
"$",
"this",
"->",
"setMultisiteFilePermissions",
"(",
"0777",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Rsyncing files from source repo into the build artifact...\"",
")",
";",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"exec",
"(",
"\"rsync -a --no-g --delete --delete-excluded --exclude-from='$exclude_list_file' '$source/' '$dest/' --filter 'protect /.git/'\"",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
")",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"setMultisiteFilePermissions",
"(",
"0755",
")",
";",
"// Remove temporary file that may have been created by",
"// $this->getExcludeListFile().",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"remove",
"(",
"$",
"this",
"->",
"excludeFileTemp",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'deploy.gitignore_file'",
")",
",",
"$",
"this",
"->",
"deployDir",
".",
"'/.gitignore'",
",",
"TRUE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Copies files from source repo into artifact.
|
[
"Copies",
"files",
"from",
"source",
"repo",
"into",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L361-L386
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.composerInstall
|
protected function composerInstall() {
if (!$this->getConfigValue('deploy.build-dependencies')) {
$this->logger->warning("Dependencies will not be built because deploy.build-dependencies is not enabled");
$this->logger->warning("You should define a custom deploy.exclude_file to ensure that dependencies are copied from the root repository.");
return FALSE;
}
$this->say("Rebuilding composer dependencies for production...");
$this->taskDeleteDir([$this->deployDir . '/vendor'])
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
$this->taskFilesystemStack()
->copy($this->getConfigValue('repo.root') . '/composer.json', $this->deployDir . '/composer.json', TRUE)
->copy($this->getConfigValue('repo.root') . '/composer.lock', $this->deployDir . '/composer.lock', TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
$command = 'composer install --no-dev --no-interaction --optimize-autoloader';
if ($this->ignorePlatformReqs) {
$command .= ' --ignore-platform-reqs';
}
$this->taskExecStack()->exec($command)
->stopOnFail()
->dir($this->deployDir)
->run();
}
|
php
|
protected function composerInstall() {
if (!$this->getConfigValue('deploy.build-dependencies')) {
$this->logger->warning("Dependencies will not be built because deploy.build-dependencies is not enabled");
$this->logger->warning("You should define a custom deploy.exclude_file to ensure that dependencies are copied from the root repository.");
return FALSE;
}
$this->say("Rebuilding composer dependencies for production...");
$this->taskDeleteDir([$this->deployDir . '/vendor'])
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
$this->taskFilesystemStack()
->copy($this->getConfigValue('repo.root') . '/composer.json', $this->deployDir . '/composer.json', TRUE)
->copy($this->getConfigValue('repo.root') . '/composer.lock', $this->deployDir . '/composer.lock', TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
$command = 'composer install --no-dev --no-interaction --optimize-autoloader';
if ($this->ignorePlatformReqs) {
$command .= ' --ignore-platform-reqs';
}
$this->taskExecStack()->exec($command)
->stopOnFail()
->dir($this->deployDir)
->run();
}
|
[
"protected",
"function",
"composerInstall",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getConfigValue",
"(",
"'deploy.build-dependencies'",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"\"Dependencies will not be built because deploy.build-dependencies is not enabled\"",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"\"You should define a custom deploy.exclude_file to ensure that dependencies are copied from the root repository.\"",
")",
";",
"return",
"FALSE",
";",
"}",
"$",
"this",
"->",
"say",
"(",
"\"Rebuilding composer dependencies for production...\"",
")",
";",
"$",
"this",
"->",
"taskDeleteDir",
"(",
"[",
"$",
"this",
"->",
"deployDir",
".",
"'/vendor'",
"]",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/composer.json'",
",",
"$",
"this",
"->",
"deployDir",
".",
"'/composer.json'",
",",
"TRUE",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/composer.lock'",
",",
"$",
"this",
"->",
"deployDir",
".",
"'/composer.lock'",
",",
"TRUE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"$",
"command",
"=",
"'composer install --no-dev --no-interaction --optimize-autoloader'",
";",
"if",
"(",
"$",
"this",
"->",
"ignorePlatformReqs",
")",
"{",
"$",
"command",
".=",
"' --ignore-platform-reqs'",
";",
"}",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"exec",
"(",
"$",
"command",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"deployDir",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Installs composer dependencies for artifact.
@param array $options
@return bool
@throws \Robo\Exception\TaskException
|
[
"Installs",
"composer",
"dependencies",
"for",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L394-L418
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.sanitize
|
protected function sanitize() {
$this->say("Sanitizing artifact...");
$this->logger->info("Find Drupal core text files...");
$sanitizeFinder = Finder::create()
->files()
->name('*.txt')
->notName('LICENSE.txt')
->in("{$this->deployDir}/docroot/core");
$this->logger->info('Find VCS directories...');
$vcsFinder = Finder::create()
->ignoreDotFiles(FALSE)
->ignoreVCS(FALSE)
->directories()
->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
->name('.git');
if ($vcsFinder->hasResults()) {
$sanitizeFinder->append($vcsFinder);
}
$this->logger->info("Find Github directories...");
$githubFinder = Finder::create()
->ignoreDotFiles(FALSE)
->directories()
->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
->name('.github');
if ($githubFinder->hasResults()) {
$sanitizeFinder->append($githubFinder);
}
$this->logger->info('Find INSTALL database text files...');
$dbInstallFinder = Finder::create()
->files()
->in(["{$this->deployDir}/docroot"])
->name('/INSTALL\.[a-z]+\.(md|txt)$/');
if ($dbInstallFinder->hasResults()) {
$sanitizeFinder->append($dbInstallFinder);
}
$this->logger->info('Find other common text files...');
$filenames = [
'AUTHORS',
'CHANGELOG',
'CONDUCT',
'CONTRIBUTING',
'INSTALL',
'MAINTAINERS',
'PATCHES',
'TESTING',
'UPDATE',
];
$textFileFinder = Finder::create()
->files()
->in(["{$this->deployDir}/docroot"])
->name('/(' . implode('|', $filenames) . ')\.(md|txt)$/');
if ($textFileFinder->hasResults()) {
$sanitizeFinder->append($textFileFinder);
}
$this->logger->info("Remove sanitized files from build...");
$taskFilesystemStack = $this->taskFilesystemStack()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE);
foreach ($sanitizeFinder->getIterator() as $fileInfo) {
$taskFilesystemStack->remove($fileInfo->getRealPath());
}
$taskFilesystemStack->run();
}
|
php
|
protected function sanitize() {
$this->say("Sanitizing artifact...");
$this->logger->info("Find Drupal core text files...");
$sanitizeFinder = Finder::create()
->files()
->name('*.txt')
->notName('LICENSE.txt')
->in("{$this->deployDir}/docroot/core");
$this->logger->info('Find VCS directories...');
$vcsFinder = Finder::create()
->ignoreDotFiles(FALSE)
->ignoreVCS(FALSE)
->directories()
->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
->name('.git');
if ($vcsFinder->hasResults()) {
$sanitizeFinder->append($vcsFinder);
}
$this->logger->info("Find Github directories...");
$githubFinder = Finder::create()
->ignoreDotFiles(FALSE)
->directories()
->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
->name('.github');
if ($githubFinder->hasResults()) {
$sanitizeFinder->append($githubFinder);
}
$this->logger->info('Find INSTALL database text files...');
$dbInstallFinder = Finder::create()
->files()
->in(["{$this->deployDir}/docroot"])
->name('/INSTALL\.[a-z]+\.(md|txt)$/');
if ($dbInstallFinder->hasResults()) {
$sanitizeFinder->append($dbInstallFinder);
}
$this->logger->info('Find other common text files...');
$filenames = [
'AUTHORS',
'CHANGELOG',
'CONDUCT',
'CONTRIBUTING',
'INSTALL',
'MAINTAINERS',
'PATCHES',
'TESTING',
'UPDATE',
];
$textFileFinder = Finder::create()
->files()
->in(["{$this->deployDir}/docroot"])
->name('/(' . implode('|', $filenames) . ')\.(md|txt)$/');
if ($textFileFinder->hasResults()) {
$sanitizeFinder->append($textFileFinder);
}
$this->logger->info("Remove sanitized files from build...");
$taskFilesystemStack = $this->taskFilesystemStack()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE);
foreach ($sanitizeFinder->getIterator() as $fileInfo) {
$taskFilesystemStack->remove($fileInfo->getRealPath());
}
$taskFilesystemStack->run();
}
|
[
"protected",
"function",
"sanitize",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Sanitizing artifact...\"",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"Find Drupal core text files...\"",
")",
";",
"$",
"sanitizeFinder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"files",
"(",
")",
"->",
"name",
"(",
"'*.txt'",
")",
"->",
"notName",
"(",
"'LICENSE.txt'",
")",
"->",
"in",
"(",
"\"{$this->deployDir}/docroot/core\"",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"'Find VCS directories...'",
")",
";",
"$",
"vcsFinder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"ignoreDotFiles",
"(",
"FALSE",
")",
"->",
"ignoreVCS",
"(",
"FALSE",
")",
"->",
"directories",
"(",
")",
"->",
"in",
"(",
"[",
"\"{$this->deployDir}/docroot\"",
",",
"\"{$this->deployDir}/vendor\"",
"]",
")",
"->",
"name",
"(",
"'.git'",
")",
";",
"if",
"(",
"$",
"vcsFinder",
"->",
"hasResults",
"(",
")",
")",
"{",
"$",
"sanitizeFinder",
"->",
"append",
"(",
"$",
"vcsFinder",
")",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"Find Github directories...\"",
")",
";",
"$",
"githubFinder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"ignoreDotFiles",
"(",
"FALSE",
")",
"->",
"directories",
"(",
")",
"->",
"in",
"(",
"[",
"\"{$this->deployDir}/docroot\"",
",",
"\"{$this->deployDir}/vendor\"",
"]",
")",
"->",
"name",
"(",
"'.github'",
")",
";",
"if",
"(",
"$",
"githubFinder",
"->",
"hasResults",
"(",
")",
")",
"{",
"$",
"sanitizeFinder",
"->",
"append",
"(",
"$",
"githubFinder",
")",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"'Find INSTALL database text files...'",
")",
";",
"$",
"dbInstallFinder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"files",
"(",
")",
"->",
"in",
"(",
"[",
"\"{$this->deployDir}/docroot\"",
"]",
")",
"->",
"name",
"(",
"'/INSTALL\\.[a-z]+\\.(md|txt)$/'",
")",
";",
"if",
"(",
"$",
"dbInstallFinder",
"->",
"hasResults",
"(",
")",
")",
"{",
"$",
"sanitizeFinder",
"->",
"append",
"(",
"$",
"dbInstallFinder",
")",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"'Find other common text files...'",
")",
";",
"$",
"filenames",
"=",
"[",
"'AUTHORS'",
",",
"'CHANGELOG'",
",",
"'CONDUCT'",
",",
"'CONTRIBUTING'",
",",
"'INSTALL'",
",",
"'MAINTAINERS'",
",",
"'PATCHES'",
",",
"'TESTING'",
",",
"'UPDATE'",
",",
"]",
";",
"$",
"textFileFinder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"files",
"(",
")",
"->",
"in",
"(",
"[",
"\"{$this->deployDir}/docroot\"",
"]",
")",
"->",
"name",
"(",
"'/('",
".",
"implode",
"(",
"'|'",
",",
"$",
"filenames",
")",
".",
"')\\.(md|txt)$/'",
")",
";",
"if",
"(",
"$",
"textFileFinder",
"->",
"hasResults",
"(",
")",
")",
"{",
"$",
"sanitizeFinder",
"->",
"append",
"(",
"$",
"textFileFinder",
")",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"Remove sanitized files from build...\"",
")",
";",
"$",
"taskFilesystemStack",
"=",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
";",
"foreach",
"(",
"$",
"sanitizeFinder",
"->",
"getIterator",
"(",
")",
"as",
"$",
"fileInfo",
")",
"{",
"$",
"taskFilesystemStack",
"->",
"remove",
"(",
"$",
"fileInfo",
"->",
"getRealPath",
"(",
")",
")",
";",
"}",
"$",
"taskFilesystemStack",
"->",
"run",
"(",
")",
";",
"}"
] |
Removes sensitive files from the deploy dir.
|
[
"Removes",
"sensitive",
"files",
"from",
"the",
"deploy",
"dir",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L423-L490
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.getExcludeListFile
|
protected function getExcludeListFile() {
$exclude_file = $this->getConfigValue('deploy.exclude_file');
$exclude_additions = $this->getConfigValue('deploy.exclude_additions_file');
if (file_exists($exclude_additions)) {
$this->say("Combining exclusions from deploy.deploy-exclude-additions and deploy.deploy-exclude files...");
$exclude_file = $this->mungeExcludeLists($exclude_file, $exclude_additions);
}
return $exclude_file;
}
|
php
|
protected function getExcludeListFile() {
$exclude_file = $this->getConfigValue('deploy.exclude_file');
$exclude_additions = $this->getConfigValue('deploy.exclude_additions_file');
if (file_exists($exclude_additions)) {
$this->say("Combining exclusions from deploy.deploy-exclude-additions and deploy.deploy-exclude files...");
$exclude_file = $this->mungeExcludeLists($exclude_file, $exclude_additions);
}
return $exclude_file;
}
|
[
"protected",
"function",
"getExcludeListFile",
"(",
")",
"{",
"$",
"exclude_file",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'deploy.exclude_file'",
")",
";",
"$",
"exclude_additions",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'deploy.exclude_additions_file'",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"exclude_additions",
")",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Combining exclusions from deploy.deploy-exclude-additions and deploy.deploy-exclude files...\"",
")",
";",
"$",
"exclude_file",
"=",
"$",
"this",
"->",
"mungeExcludeLists",
"(",
"$",
"exclude_file",
",",
"$",
"exclude_additions",
")",
";",
"}",
"return",
"$",
"exclude_file",
";",
"}"
] |
Gets the file that lists the excludes for the artifact.
|
[
"Gets",
"the",
"file",
"that",
"lists",
"the",
"excludes",
"for",
"the",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L495-L504
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.mungeExcludeLists
|
protected function mungeExcludeLists($file1, $file2) {
$file1_contents = file($file1);
$file2_contents = file($file2);
$merged = array_merge($file1_contents, $file2_contents);
$merged_without_dups = array_unique($merged);
file_put_contents($this->excludeFileTemp, $merged_without_dups);
return $this->excludeFileTemp;
}
|
php
|
protected function mungeExcludeLists($file1, $file2) {
$file1_contents = file($file1);
$file2_contents = file($file2);
$merged = array_merge($file1_contents, $file2_contents);
$merged_without_dups = array_unique($merged);
file_put_contents($this->excludeFileTemp, $merged_without_dups);
return $this->excludeFileTemp;
}
|
[
"protected",
"function",
"mungeExcludeLists",
"(",
"$",
"file1",
",",
"$",
"file2",
")",
"{",
"$",
"file1_contents",
"=",
"file",
"(",
"$",
"file1",
")",
";",
"$",
"file2_contents",
"=",
"file",
"(",
"$",
"file2",
")",
";",
"$",
"merged",
"=",
"array_merge",
"(",
"$",
"file1_contents",
",",
"$",
"file2_contents",
")",
";",
"$",
"merged_without_dups",
"=",
"array_unique",
"(",
"$",
"merged",
")",
";",
"file_put_contents",
"(",
"$",
"this",
"->",
"excludeFileTemp",
",",
"$",
"merged_without_dups",
")",
";",
"return",
"$",
"this",
"->",
"excludeFileTemp",
";",
"}"
] |
Combines deploy.exclude_file with deploy.exclude_additions_file.
Creates a temporary file containing the combination.
@return string
The filepath to the temporary file containing the combined list.
|
[
"Combines",
"deploy",
".",
"exclude_file",
"with",
"deploy",
".",
"exclude_additions_file",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L514-L522
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.setMultisiteFilePermissions
|
protected function setMultisiteFilePermissions($perms) {
$taskFilesystemStack = $this->taskFilesystemStack();
$multisites = $this->getConfigValue('multisites');
foreach ($multisites as $multisite) {
$multisite_dir = $this->getConfigValue('docroot') . '/sites/' . $multisite;
$taskFilesystemStack->chmod($multisite_dir, $perms);
}
$taskFilesystemStack->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE);
$taskFilesystemStack->run();
}
|
php
|
protected function setMultisiteFilePermissions($perms) {
$taskFilesystemStack = $this->taskFilesystemStack();
$multisites = $this->getConfigValue('multisites');
foreach ($multisites as $multisite) {
$multisite_dir = $this->getConfigValue('docroot') . '/sites/' . $multisite;
$taskFilesystemStack->chmod($multisite_dir, $perms);
}
$taskFilesystemStack->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE);
$taskFilesystemStack->run();
}
|
[
"protected",
"function",
"setMultisiteFilePermissions",
"(",
"$",
"perms",
")",
"{",
"$",
"taskFilesystemStack",
"=",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
";",
"$",
"multisites",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'multisites'",
")",
";",
"foreach",
"(",
"$",
"multisites",
"as",
"$",
"multisite",
")",
"{",
"$",
"multisite_dir",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'docroot'",
")",
".",
"'/sites/'",
".",
"$",
"multisite",
";",
"$",
"taskFilesystemStack",
"->",
"chmod",
"(",
"$",
"multisite_dir",
",",
"$",
"perms",
")",
";",
"}",
"$",
"taskFilesystemStack",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
";",
"$",
"taskFilesystemStack",
"->",
"run",
"(",
")",
";",
"}"
] |
Sets permissions for all multisite directories.
|
[
"Sets",
"permissions",
"for",
"all",
"multisite",
"directories",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L527-L536
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.commit
|
protected function commit() {
$this->say("Committing artifact to <comment>{$this->branchName}</comment>...");
$result = $this->taskGit()
->dir($this->deployDir)
->exec("git rm -r --cached --ignore-unmatch --quiet .")
->add('-A')
->commit($this->commitMessage, '--quiet')
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Failed to commit deployment artifact!");
}
}
|
php
|
protected function commit() {
$this->say("Committing artifact to <comment>{$this->branchName}</comment>...");
$result = $this->taskGit()
->dir($this->deployDir)
->exec("git rm -r --cached --ignore-unmatch --quiet .")
->add('-A')
->commit($this->commitMessage, '--quiet')
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Failed to commit deployment artifact!");
}
}
|
[
"protected",
"function",
"commit",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Committing artifact to <comment>{$this->branchName}</comment>...\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskGit",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"deployDir",
")",
"->",
"exec",
"(",
"\"git rm -r --cached --ignore-unmatch --quiet .\"",
")",
"->",
"add",
"(",
"'-A'",
")",
"->",
"commit",
"(",
"$",
"this",
"->",
"commitMessage",
",",
"'--quiet'",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Failed to commit deployment artifact!\"",
")",
";",
"}",
"}"
] |
Creates a commit on the artifact.
@throws BltException
|
[
"Creates",
"a",
"commit",
"on",
"the",
"artifact",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L542-L556
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.push
|
protected function push($identifier, $options) {
if ($options['dry-run']) {
$this->logger->warning("Skipping push of deployment artifact. deploy.dryRun is set to true.");
return FALSE;
}
else {
$this->say("Pushing artifact to git.remotes...");
}
$task = $this->taskExecStack()
->dir($this->deployDir);
foreach ($this->getConfigValue('git.remotes') as $remote) {
$remote_name = md5($remote);
$task->exec("git push $remote_name $identifier");
}
$result = $task->run();
if (!$result->wasSuccessful()) {
throw new BltException("Failed to push deployment artifact!");
}
}
|
php
|
protected function push($identifier, $options) {
if ($options['dry-run']) {
$this->logger->warning("Skipping push of deployment artifact. deploy.dryRun is set to true.");
return FALSE;
}
else {
$this->say("Pushing artifact to git.remotes...");
}
$task = $this->taskExecStack()
->dir($this->deployDir);
foreach ($this->getConfigValue('git.remotes') as $remote) {
$remote_name = md5($remote);
$task->exec("git push $remote_name $identifier");
}
$result = $task->run();
if (!$result->wasSuccessful()) {
throw new BltException("Failed to push deployment artifact!");
}
}
|
[
"protected",
"function",
"push",
"(",
"$",
"identifier",
",",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"options",
"[",
"'dry-run'",
"]",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"\"Skipping push of deployment artifact. deploy.dryRun is set to true.\"",
")",
";",
"return",
"FALSE",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Pushing artifact to git.remotes...\"",
")",
";",
"}",
"$",
"task",
"=",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"deployDir",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'git.remotes'",
")",
"as",
"$",
"remote",
")",
"{",
"$",
"remote_name",
"=",
"md5",
"(",
"$",
"remote",
")",
";",
"$",
"task",
"->",
"exec",
"(",
"\"git push $remote_name $identifier\"",
")",
";",
"}",
"$",
"result",
"=",
"$",
"task",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Failed to push deployment artifact!\"",
")",
";",
"}",
"}"
] |
Pushes the artifact to git.remotes.
@param $identifier
@param $options
@return bool
@throws BltException
|
[
"Pushes",
"the",
"artifact",
"to",
"git",
".",
"remotes",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L565-L585
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.cutTag
|
protected function cutTag($repo = 'build') {
$taskGit = $this->taskGit()
->tag($this->tagName, $this->commitMessage)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail();
if ($repo == 'build') {
$taskGit->dir($this->deployDir);
}
$result = $taskGit->run();
if (!$result->wasSuccessful()) {
throw new BltException("Failed to create Git tag!");
}
$this->say("The tag {$this->tagName} was created on the {$repo} repository.");
}
|
php
|
protected function cutTag($repo = 'build') {
$taskGit = $this->taskGit()
->tag($this->tagName, $this->commitMessage)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->stopOnFail();
if ($repo == 'build') {
$taskGit->dir($this->deployDir);
}
$result = $taskGit->run();
if (!$result->wasSuccessful()) {
throw new BltException("Failed to create Git tag!");
}
$this->say("The tag {$this->tagName} was created on the {$repo} repository.");
}
|
[
"protected",
"function",
"cutTag",
"(",
"$",
"repo",
"=",
"'build'",
")",
"{",
"$",
"taskGit",
"=",
"$",
"this",
"->",
"taskGit",
"(",
")",
"->",
"tag",
"(",
"$",
"this",
"->",
"tagName",
",",
"$",
"this",
"->",
"commitMessage",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"stopOnFail",
"(",
")",
";",
"if",
"(",
"$",
"repo",
"==",
"'build'",
")",
"{",
"$",
"taskGit",
"->",
"dir",
"(",
"$",
"this",
"->",
"deployDir",
")",
";",
"}",
"$",
"result",
"=",
"$",
"taskGit",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Failed to create Git tag!\"",
")",
";",
"}",
"$",
"this",
"->",
"say",
"(",
"\"The tag {$this->tagName} was created on the {$repo} repository.\"",
")",
";",
"}"
] |
Creates a tag on the build repository.
@param $repo
The repo in which a tag should be cut.
@throws BltException
|
[
"Creates",
"a",
"tag",
"on",
"the",
"build",
"repository",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L594-L609
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.updateAll
|
public function updateAll() {
// Disable alias since we are targeting specific uri.
$this->config->set('drush.alias', '');
foreach ($this->getConfigValue('multisites') as $multisite) {
$this->updateSite($multisite);
}
}
|
php
|
public function updateAll() {
// Disable alias since we are targeting specific uri.
$this->config->set('drush.alias', '');
foreach ($this->getConfigValue('multisites') as $multisite) {
$this->updateSite($multisite);
}
}
|
[
"public",
"function",
"updateAll",
"(",
")",
"{",
"// Disable alias since we are targeting specific uri.",
"$",
"this",
"->",
"config",
"->",
"set",
"(",
"'drush.alias'",
",",
"''",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'multisites'",
")",
"as",
"$",
"multisite",
")",
"{",
"$",
"this",
"->",
"updateSite",
"(",
"$",
"multisite",
")",
";",
"}",
"}"
] |
Update the database to reflect the state of the Drupal file system.
@command artifact:update:drupal:all-sites
@aliases auda
|
[
"Update",
"the",
"database",
"to",
"reflect",
"the",
"state",
"of",
"the",
"Drupal",
"file",
"system",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L638-L645
|
train
|
acquia/blt
|
src/Robo/Commands/Deploy/DeployCommand.php
|
DeployCommand.syncRefresh
|
public function syncRefresh() {
// Disable alias since we are targeting specific uri.
$this->config->set('drush.alias', '');
// Sync files.
$this->config->set('sync.files', TRUE);
foreach ($this->getConfigValue('multisites') as $multisite) {
$this->say("Syncing $multisite...");
if (!$this->config->get('drush.uri')) {
$this->config->set('drush.uri', $multisite);
}
$this->invokeCommand('drupal:sync:db');
$this->invokeCommand('drupal:sync:files');
$this->invokeCommand('drupal:update');
$this->say("Finished syncing $multisite.");
}
}
|
php
|
public function syncRefresh() {
// Disable alias since we are targeting specific uri.
$this->config->set('drush.alias', '');
// Sync files.
$this->config->set('sync.files', TRUE);
foreach ($this->getConfigValue('multisites') as $multisite) {
$this->say("Syncing $multisite...");
if (!$this->config->get('drush.uri')) {
$this->config->set('drush.uri', $multisite);
}
$this->invokeCommand('drupal:sync:db');
$this->invokeCommand('drupal:sync:files');
$this->invokeCommand('drupal:update');
$this->say("Finished syncing $multisite.");
}
}
|
[
"public",
"function",
"syncRefresh",
"(",
")",
"{",
"// Disable alias since we are targeting specific uri.",
"$",
"this",
"->",
"config",
"->",
"set",
"(",
"'drush.alias'",
",",
"''",
")",
";",
"// Sync files.",
"$",
"this",
"->",
"config",
"->",
"set",
"(",
"'sync.files'",
",",
"TRUE",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'multisites'",
")",
"as",
"$",
"multisite",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Syncing $multisite...\"",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'drush.uri'",
")",
")",
"{",
"$",
"this",
"->",
"config",
"->",
"set",
"(",
"'drush.uri'",
",",
"$",
"multisite",
")",
";",
"}",
"$",
"this",
"->",
"invokeCommand",
"(",
"'drupal:sync:db'",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'drupal:sync:files'",
")",
";",
"$",
"this",
"->",
"invokeCommand",
"(",
"'drupal:update'",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Finished syncing $multisite.\"",
")",
";",
"}",
"}"
] |
Syncs database and files and runs updates.
@command artifact:sync:all-sites
@aliases asas
|
[
"Syncs",
"database",
"and",
"files",
"and",
"runs",
"updates",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Deploy/DeployCommand.php#L667-L686
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8006000
|
public function update_8006000() {
// Move files to blt subdir.
$this->updater->moveFile('project.yml', 'blt/project.yml', TRUE);
$this->updater->moveFile('project.local.yml', 'blt/project.local.yml',
TRUE);
$this->updater->moveFile('example.project.local.yml',
'blt/example.project.local.yml', TRUE);
// Delete symlink to hooks directory. Individual git hooks are now symlinked, not the entire directory.
$this->updater->deleteFile('.git/hooks');
$this->updater->getOutput()
->writeln('.git/hooks was deleted. Please re-run blt:init:git-hooks to install git hooks locally.');
$this->updater->removeComposerRepository('https://github.com/mortenson/composer-patches');
$this->updater->removeComposerScript('post-create-project-cmd');
// Change 'deploy' module key to 'prod'.
// @see https://github.com/acquia/blt/pull/700.
$project_config = $this->updater->getProjectYml();
if (!empty($project_config['modules']['deploy'])) {
$project_config['modules']['prod'] = $project_config['modules']['deploy'];
unset($project_config['modules']['deploy']);
}
$this->updater->getOutput()
->writeln("<comment>You MUST remove .travis.yml and re-initialize Travis CI support with `blt recipes:ci:travis:init`.</comment>");
}
|
php
|
public function update_8006000() {
// Move files to blt subdir.
$this->updater->moveFile('project.yml', 'blt/project.yml', TRUE);
$this->updater->moveFile('project.local.yml', 'blt/project.local.yml',
TRUE);
$this->updater->moveFile('example.project.local.yml',
'blt/example.project.local.yml', TRUE);
// Delete symlink to hooks directory. Individual git hooks are now symlinked, not the entire directory.
$this->updater->deleteFile('.git/hooks');
$this->updater->getOutput()
->writeln('.git/hooks was deleted. Please re-run blt:init:git-hooks to install git hooks locally.');
$this->updater->removeComposerRepository('https://github.com/mortenson/composer-patches');
$this->updater->removeComposerScript('post-create-project-cmd');
// Change 'deploy' module key to 'prod'.
// @see https://github.com/acquia/blt/pull/700.
$project_config = $this->updater->getProjectYml();
if (!empty($project_config['modules']['deploy'])) {
$project_config['modules']['prod'] = $project_config['modules']['deploy'];
unset($project_config['modules']['deploy']);
}
$this->updater->getOutput()
->writeln("<comment>You MUST remove .travis.yml and re-initialize Travis CI support with `blt recipes:ci:travis:init`.</comment>");
}
|
[
"public",
"function",
"update_8006000",
"(",
")",
"{",
"// Move files to blt subdir.",
"$",
"this",
"->",
"updater",
"->",
"moveFile",
"(",
"'project.yml'",
",",
"'blt/project.yml'",
",",
"TRUE",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"moveFile",
"(",
"'project.local.yml'",
",",
"'blt/project.local.yml'",
",",
"TRUE",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"moveFile",
"(",
"'example.project.local.yml'",
",",
"'blt/example.project.local.yml'",
",",
"TRUE",
")",
";",
"// Delete symlink to hooks directory. Individual git hooks are now symlinked, not the entire directory.",
"$",
"this",
"->",
"updater",
"->",
"deleteFile",
"(",
"'.git/hooks'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"'.git/hooks was deleted. Please re-run blt:init:git-hooks to install git hooks locally.'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"removeComposerRepository",
"(",
"'https://github.com/mortenson/composer-patches'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"removeComposerScript",
"(",
"'post-create-project-cmd'",
")",
";",
"// Change 'deploy' module key to 'prod'.",
"// @see https://github.com/acquia/blt/pull/700.",
"$",
"project_config",
"=",
"$",
"this",
"->",
"updater",
"->",
"getProjectYml",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"project_config",
"[",
"'modules'",
"]",
"[",
"'deploy'",
"]",
")",
")",
"{",
"$",
"project_config",
"[",
"'modules'",
"]",
"[",
"'prod'",
"]",
"=",
"$",
"project_config",
"[",
"'modules'",
"]",
"[",
"'deploy'",
"]",
";",
"unset",
"(",
"$",
"project_config",
"[",
"'modules'",
"]",
"[",
"'deploy'",
"]",
")",
";",
"}",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"<comment>You MUST remove .travis.yml and re-initialize Travis CI support with `blt recipes:ci:travis:init`.</comment>\"",
")",
";",
"}"
] |
8.6.0.
@Update(
version = "8006000",
description = "Moves configuration files to blt subdirectory. Removes .git/hooks symlink."
)
|
[
"8",
".",
"6",
".",
"0",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L54-L80
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8006002
|
public function update_8006002() {
$composer_json = $this->updater->getComposerJson();
$composer_json = DoPackagistConverter::convertComposerJson($composer_json);
// This package is not compatible with D.O style version constraints.
unset($composer_json['require']['drupal-composer/drupal-security-advisories']);
$this->updater->writeComposerJson($composer_json);
}
|
php
|
public function update_8006002() {
$composer_json = $this->updater->getComposerJson();
$composer_json = DoPackagistConverter::convertComposerJson($composer_json);
// This package is not compatible with D.O style version constraints.
unset($composer_json['require']['drupal-composer/drupal-security-advisories']);
$this->updater->writeComposerJson($composer_json);
}
|
[
"public",
"function",
"update_8006002",
"(",
")",
"{",
"$",
"composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getComposerJson",
"(",
")",
";",
"$",
"composer_json",
"=",
"DoPackagistConverter",
"::",
"convertComposerJson",
"(",
"$",
"composer_json",
")",
";",
"// This package is not compatible with D.O style version constraints.",
"unset",
"(",
"$",
"composer_json",
"[",
"'require'",
"]",
"[",
"'drupal-composer/drupal-security-advisories'",
"]",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"writeComposerJson",
"(",
"$",
"composer_json",
")",
";",
"}"
] |
8.6.2.
@Update(
version = "8006002",
description = "Updates composer.json version constraints for Drupal.org."
)
|
[
"8",
".",
"6",
".",
"2",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L90-L96
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8006004
|
public function update_8006004() {
$composer_json = $this->updater->getComposerJson();
$remove_packages = [
'drupal/coder',
'drupal-composer/drupal-security-advisories',
'phing/phing',
'phpunit/phpunit',
'behat/mink-extension',
'behat/mink-goutte-driver',
'behat/mink-browserkit-driver',
];
foreach ($remove_packages as $package) {
unset($composer_json['require'][$package]);
unset($composer_json['require-dev'][$package]);
}
$this->updater->writeComposerJson($composer_json);
}
|
php
|
public function update_8006004() {
$composer_json = $this->updater->getComposerJson();
$remove_packages = [
'drupal/coder',
'drupal-composer/drupal-security-advisories',
'phing/phing',
'phpunit/phpunit',
'behat/mink-extension',
'behat/mink-goutte-driver',
'behat/mink-browserkit-driver',
];
foreach ($remove_packages as $package) {
unset($composer_json['require'][$package]);
unset($composer_json['require-dev'][$package]);
}
$this->updater->writeComposerJson($composer_json);
}
|
[
"public",
"function",
"update_8006004",
"(",
")",
"{",
"$",
"composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getComposerJson",
"(",
")",
";",
"$",
"remove_packages",
"=",
"[",
"'drupal/coder'",
",",
"'drupal-composer/drupal-security-advisories'",
",",
"'phing/phing'",
",",
"'phpunit/phpunit'",
",",
"'behat/mink-extension'",
",",
"'behat/mink-goutte-driver'",
",",
"'behat/mink-browserkit-driver'",
",",
"]",
";",
"foreach",
"(",
"$",
"remove_packages",
"as",
"$",
"package",
")",
"{",
"unset",
"(",
"$",
"composer_json",
"[",
"'require'",
"]",
"[",
"$",
"package",
"]",
")",
";",
"unset",
"(",
"$",
"composer_json",
"[",
"'require-dev'",
"]",
"[",
"$",
"package",
"]",
")",
";",
"}",
"$",
"this",
"->",
"updater",
"->",
"writeComposerJson",
"(",
"$",
"composer_json",
")",
";",
"}"
] |
8.5.4.
@Update(
version = "8006004",
description = "Removes deprecated packages from composer.json."
)
|
[
"8",
".",
"5",
".",
"4",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L106-L122
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8006006
|
public function update_8006006() {
$composer_json = $this->updater->getComposerJson();
unset($composer_json['require-dev']['drush/drush']);
$this->updater->writeComposerJson($composer_json);
}
|
php
|
public function update_8006006() {
$composer_json = $this->updater->getComposerJson();
unset($composer_json['require-dev']['drush/drush']);
$this->updater->writeComposerJson($composer_json);
}
|
[
"public",
"function",
"update_8006006",
"(",
")",
"{",
"$",
"composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getComposerJson",
"(",
")",
";",
"unset",
"(",
"$",
"composer_json",
"[",
"'require-dev'",
"]",
"[",
"'drush/drush'",
"]",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"writeComposerJson",
"(",
"$",
"composer_json",
")",
";",
"}"
] |
8.6.6.
@Update(
version = "8006006",
description = "Removes drush/drush from require-dev."
)
|
[
"8",
".",
"6",
".",
"6",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L132-L136
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8006007
|
public function update_8006007() {
$composer_json = $this->updater->getComposerJson();
if (!empty($composer_json['extra']['drupal-scaffold']['excludes'])) {
$composer_json['extra']['drupal-scaffold']['excludes'] = array_unique(array_values($composer_json['extra']['drupal-scaffold']['excludes']));
}
$this->updater->writeComposerJson($composer_json);
}
|
php
|
public function update_8006007() {
$composer_json = $this->updater->getComposerJson();
if (!empty($composer_json['extra']['drupal-scaffold']['excludes'])) {
$composer_json['extra']['drupal-scaffold']['excludes'] = array_unique(array_values($composer_json['extra']['drupal-scaffold']['excludes']));
}
$this->updater->writeComposerJson($composer_json);
}
|
[
"public",
"function",
"update_8006007",
"(",
")",
"{",
"$",
"composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getComposerJson",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'drupal-scaffold'",
"]",
"[",
"'excludes'",
"]",
")",
")",
"{",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'drupal-scaffold'",
"]",
"[",
"'excludes'",
"]",
"=",
"array_unique",
"(",
"array_values",
"(",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'drupal-scaffold'",
"]",
"[",
"'excludes'",
"]",
")",
")",
";",
"}",
"$",
"this",
"->",
"updater",
"->",
"writeComposerJson",
"(",
"$",
"composer_json",
")",
";",
"}"
] |
8.6.7.
@Update(
version = "8006007",
description = "Changes drupal scaffold excludes from associative to indexed array."
)
|
[
"8",
".",
"6",
".",
"7",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L146-L152
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8009000
|
public function update_8009000() {
$project_yml = $this->updater->getProjectYml();
if (!empty($project_yml['behat']['launch-phantomjs']) && $project_yml['behat']['launch-phantomjs']) {
$project_yml['behat']['web-driver'] = 'phantomjs';
}
else {
$project_yml['behat']['web-driver'] = 'selenium';
}
unset($project_yml['behat']['launch-selenium']);
unset($project_yml['behat']['launch-phantomjs']);
if (!empty($project_yml['multisite.name'])) {
$project_yml['multisites'][] = $project_yml['multisite.name'];
unset ($project_yml['multisite.name']);
}
unset($project_yml['import']);
if (file_exists($this->updater->getRepoRoot() . '/Vagrantfile')) {
$project_yml['vm']['enable'] = TRUE;
}
$this->updater->writeProjectYml($project_yml);
$messages = [
"You have updated to a new major version of BLT, which introduces backwards-incompatible changes.",
"You may need to perform the following manual update steps:",
" - View the full list of commands via `blt list`, <comment>BLT commands have changed</comment>",
" - Re-initialize default Travis CI configuration via `blt recipes:ci:travis:init`.
- Re-initialize default Acquia Pipelines configuration via `blt recipes:ci:pipelines:init`.",
" - Port custom Phing commands to Robo. All Phing commands are now obsolete. See:",
" http://blt.readthedocs.io/en/9.x/readme/extending-blt/",
];
if (file_exists($this->updater->getRepoRoot() . '/blt/composer.overrides.json')) {
$messages[] = " - <comment>blt/composer.overrides.json</comment> is no longer necessary.";
$messages[] = " - Move your overrides to your root composer.json, and set extra.merge-plugin.ignore-duplicates to true.";
}
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
php
|
public function update_8009000() {
$project_yml = $this->updater->getProjectYml();
if (!empty($project_yml['behat']['launch-phantomjs']) && $project_yml['behat']['launch-phantomjs']) {
$project_yml['behat']['web-driver'] = 'phantomjs';
}
else {
$project_yml['behat']['web-driver'] = 'selenium';
}
unset($project_yml['behat']['launch-selenium']);
unset($project_yml['behat']['launch-phantomjs']);
if (!empty($project_yml['multisite.name'])) {
$project_yml['multisites'][] = $project_yml['multisite.name'];
unset ($project_yml['multisite.name']);
}
unset($project_yml['import']);
if (file_exists($this->updater->getRepoRoot() . '/Vagrantfile')) {
$project_yml['vm']['enable'] = TRUE;
}
$this->updater->writeProjectYml($project_yml);
$messages = [
"You have updated to a new major version of BLT, which introduces backwards-incompatible changes.",
"You may need to perform the following manual update steps:",
" - View the full list of commands via `blt list`, <comment>BLT commands have changed</comment>",
" - Re-initialize default Travis CI configuration via `blt recipes:ci:travis:init`.
- Re-initialize default Acquia Pipelines configuration via `blt recipes:ci:pipelines:init`.",
" - Port custom Phing commands to Robo. All Phing commands are now obsolete. See:",
" http://blt.readthedocs.io/en/9.x/readme/extending-blt/",
];
if (file_exists($this->updater->getRepoRoot() . '/blt/composer.overrides.json')) {
$messages[] = " - <comment>blt/composer.overrides.json</comment> is no longer necessary.";
$messages[] = " - Move your overrides to your root composer.json, and set extra.merge-plugin.ignore-duplicates to true.";
}
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
[
"public",
"function",
"update_8009000",
"(",
")",
"{",
"$",
"project_yml",
"=",
"$",
"this",
"->",
"updater",
"->",
"getProjectYml",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"project_yml",
"[",
"'behat'",
"]",
"[",
"'launch-phantomjs'",
"]",
")",
"&&",
"$",
"project_yml",
"[",
"'behat'",
"]",
"[",
"'launch-phantomjs'",
"]",
")",
"{",
"$",
"project_yml",
"[",
"'behat'",
"]",
"[",
"'web-driver'",
"]",
"=",
"'phantomjs'",
";",
"}",
"else",
"{",
"$",
"project_yml",
"[",
"'behat'",
"]",
"[",
"'web-driver'",
"]",
"=",
"'selenium'",
";",
"}",
"unset",
"(",
"$",
"project_yml",
"[",
"'behat'",
"]",
"[",
"'launch-selenium'",
"]",
")",
";",
"unset",
"(",
"$",
"project_yml",
"[",
"'behat'",
"]",
"[",
"'launch-phantomjs'",
"]",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"project_yml",
"[",
"'multisite.name'",
"]",
")",
")",
"{",
"$",
"project_yml",
"[",
"'multisites'",
"]",
"[",
"]",
"=",
"$",
"project_yml",
"[",
"'multisite.name'",
"]",
";",
"unset",
"(",
"$",
"project_yml",
"[",
"'multisite.name'",
"]",
")",
";",
"}",
"unset",
"(",
"$",
"project_yml",
"[",
"'import'",
"]",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"updater",
"->",
"getRepoRoot",
"(",
")",
".",
"'/Vagrantfile'",
")",
")",
"{",
"$",
"project_yml",
"[",
"'vm'",
"]",
"[",
"'enable'",
"]",
"=",
"TRUE",
";",
"}",
"$",
"this",
"->",
"updater",
"->",
"writeProjectYml",
"(",
"$",
"project_yml",
")",
";",
"$",
"messages",
"=",
"[",
"\"You have updated to a new major version of BLT, which introduces backwards-incompatible changes.\"",
",",
"\"You may need to perform the following manual update steps:\"",
",",
"\" - View the full list of commands via `blt list`, <comment>BLT commands have changed</comment>\"",
",",
"\" - Re-initialize default Travis CI configuration via `blt recipes:ci:travis:init`.\n - Re-initialize default Acquia Pipelines configuration via `blt recipes:ci:pipelines:init`.\"",
",",
"\" - Port custom Phing commands to Robo. All Phing commands are now obsolete. See:\"",
",",
"\" http://blt.readthedocs.io/en/9.x/readme/extending-blt/\"",
",",
"]",
";",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"updater",
"->",
"getRepoRoot",
"(",
")",
".",
"'/blt/composer.overrides.json'",
")",
")",
"{",
"$",
"messages",
"[",
"]",
"=",
"\" - <comment>blt/composer.overrides.json</comment> is no longer necessary.\"",
";",
"$",
"messages",
"[",
"]",
"=",
"\" - Move your overrides to your root composer.json, and set extra.merge-plugin.ignore-duplicates to true.\"",
";",
"}",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"}"
] |
8.9.0.
@Update(
version = "8009000",
description = "Updating deprecated yaml keys."
)
|
[
"8",
".",
"9",
".",
"0",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L300-L340
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8009001
|
public function update_8009001() {
$project_yml = $this->updater->getProjectYml();
unset($project_yml['phpcs']['filesets']['files.php.custom.modules']);
unset($project_yml['phpcs']['filesets']['files.php.custom.themes']);
unset($project_yml['phpcs']['filesets']['files.php.tests']);
$this->updater->writeProjectYml($project_yml);
}
|
php
|
public function update_8009001() {
$project_yml = $this->updater->getProjectYml();
unset($project_yml['phpcs']['filesets']['files.php.custom.modules']);
unset($project_yml['phpcs']['filesets']['files.php.custom.themes']);
unset($project_yml['phpcs']['filesets']['files.php.tests']);
$this->updater->writeProjectYml($project_yml);
}
|
[
"public",
"function",
"update_8009001",
"(",
")",
"{",
"$",
"project_yml",
"=",
"$",
"this",
"->",
"updater",
"->",
"getProjectYml",
"(",
")",
";",
"unset",
"(",
"$",
"project_yml",
"[",
"'phpcs'",
"]",
"[",
"'filesets'",
"]",
"[",
"'files.php.custom.modules'",
"]",
")",
";",
"unset",
"(",
"$",
"project_yml",
"[",
"'phpcs'",
"]",
"[",
"'filesets'",
"]",
"[",
"'files.php.custom.themes'",
"]",
")",
";",
"unset",
"(",
"$",
"project_yml",
"[",
"'phpcs'",
"]",
"[",
"'filesets'",
"]",
"[",
"'files.php.tests'",
"]",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"writeProjectYml",
"(",
"$",
"project_yml",
")",
";",
"}"
] |
8.9.1.
@Update(
version = "8009001",
description = "Removing deprecated filesets."
)
|
[
"8",
".",
"9",
".",
"1",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L350-L356
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8009003
|
public function update_8009003() {
$composer_json = $this->updater->getComposerJson();
$composer_json['extra']['installer-types'][] = 'bower-asset';
$composer_json['extra']['installer-types'][] = 'npm-asset';
$composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:bower-asset';
$composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:npm-asset';
// Add the Asset Packagist repository if it does not already exist.
if (isset($composer_json['repositories'])) {
$repository_key = NULL;
foreach ($composer_json['repositories'] as $key => $repository) {
if ($repository['type'] == 'composer' && strpos($repository['url'], 'https://asset-packagist.org') === 0) {
$repository_key = $key;
break;
}
}
if (is_null($repository_key)) {
$composer_json['repositories']['asset-packagist'] = [
'type' => 'composer',
'url' => 'https://asset-packagist.org',
];
}
}
$projectAcsfHooks = $this->updater->getRepoRoot() . '/factory-hooks';
$acsf_inited = file_exists($projectAcsfHooks);
if ($acsf_inited) {
$composer_json['config']['platform']['php'] = '5.6';
}
$this->updater->writeComposerJson($composer_json);
$messages = [
"Your composer.json file has been modified to be compatible with Lightning 2.1.8+.",
"You must execute `composer update` to update your lock file.",
];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
php
|
public function update_8009003() {
$composer_json = $this->updater->getComposerJson();
$composer_json['extra']['installer-types'][] = 'bower-asset';
$composer_json['extra']['installer-types'][] = 'npm-asset';
$composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:bower-asset';
$composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:npm-asset';
// Add the Asset Packagist repository if it does not already exist.
if (isset($composer_json['repositories'])) {
$repository_key = NULL;
foreach ($composer_json['repositories'] as $key => $repository) {
if ($repository['type'] == 'composer' && strpos($repository['url'], 'https://asset-packagist.org') === 0) {
$repository_key = $key;
break;
}
}
if (is_null($repository_key)) {
$composer_json['repositories']['asset-packagist'] = [
'type' => 'composer',
'url' => 'https://asset-packagist.org',
];
}
}
$projectAcsfHooks = $this->updater->getRepoRoot() . '/factory-hooks';
$acsf_inited = file_exists($projectAcsfHooks);
if ($acsf_inited) {
$composer_json['config']['platform']['php'] = '5.6';
}
$this->updater->writeComposerJson($composer_json);
$messages = [
"Your composer.json file has been modified to be compatible with Lightning 2.1.8+.",
"You must execute `composer update` to update your lock file.",
];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
[
"public",
"function",
"update_8009003",
"(",
")",
"{",
"$",
"composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getComposerJson",
"(",
")",
";",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-types'",
"]",
"[",
"]",
"=",
"'bower-asset'",
";",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-types'",
"]",
"[",
"]",
"=",
"'npm-asset'",
";",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-paths'",
"]",
"[",
"'docroot/libraries/{$name}'",
"]",
"[",
"]",
"=",
"'type:bower-asset'",
";",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-paths'",
"]",
"[",
"'docroot/libraries/{$name}'",
"]",
"[",
"]",
"=",
"'type:npm-asset'",
";",
"// Add the Asset Packagist repository if it does not already exist.",
"if",
"(",
"isset",
"(",
"$",
"composer_json",
"[",
"'repositories'",
"]",
")",
")",
"{",
"$",
"repository_key",
"=",
"NULL",
";",
"foreach",
"(",
"$",
"composer_json",
"[",
"'repositories'",
"]",
"as",
"$",
"key",
"=>",
"$",
"repository",
")",
"{",
"if",
"(",
"$",
"repository",
"[",
"'type'",
"]",
"==",
"'composer'",
"&&",
"strpos",
"(",
"$",
"repository",
"[",
"'url'",
"]",
",",
"'https://asset-packagist.org'",
")",
"===",
"0",
")",
"{",
"$",
"repository_key",
"=",
"$",
"key",
";",
"break",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"repository_key",
")",
")",
"{",
"$",
"composer_json",
"[",
"'repositories'",
"]",
"[",
"'asset-packagist'",
"]",
"=",
"[",
"'type'",
"=>",
"'composer'",
",",
"'url'",
"=>",
"'https://asset-packagist.org'",
",",
"]",
";",
"}",
"}",
"$",
"projectAcsfHooks",
"=",
"$",
"this",
"->",
"updater",
"->",
"getRepoRoot",
"(",
")",
".",
"'/factory-hooks'",
";",
"$",
"acsf_inited",
"=",
"file_exists",
"(",
"$",
"projectAcsfHooks",
")",
";",
"if",
"(",
"$",
"acsf_inited",
")",
"{",
"$",
"composer_json",
"[",
"'config'",
"]",
"[",
"'platform'",
"]",
"[",
"'php'",
"]",
"=",
"'5.6'",
";",
"}",
"$",
"this",
"->",
"updater",
"->",
"writeComposerJson",
"(",
"$",
"composer_json",
")",
";",
"$",
"messages",
"=",
"[",
"\"Your composer.json file has been modified to be compatible with Lightning 2.1.8+.\"",
",",
"\"You must execute `composer update` to update your lock file.\"",
",",
"]",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"}"
] |
8.9.3.
@Update(
version = "8009003",
description = "Adding support for Asset Packagist."
)
|
[
"8",
".",
"9",
".",
"3",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L366-L407
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8009007
|
public function update_8009007() {
$this->updater->deleteFile('drush.wrapper');
$this->updater->deleteFile('.drush-use');
// Recommend drush upgrade.
$messages = [
"You should replace your local global installation of drush with drush launcher:",
"https://github.com/drush-ops/drush-launcher",
];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
php
|
public function update_8009007() {
$this->updater->deleteFile('drush.wrapper');
$this->updater->deleteFile('.drush-use');
// Recommend drush upgrade.
$messages = [
"You should replace your local global installation of drush with drush launcher:",
"https://github.com/drush-ops/drush-launcher",
];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
[
"public",
"function",
"update_8009007",
"(",
")",
"{",
"$",
"this",
"->",
"updater",
"->",
"deleteFile",
"(",
"'drush.wrapper'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"deleteFile",
"(",
"'.drush-use'",
")",
";",
"// Recommend drush upgrade.",
"$",
"messages",
"=",
"[",
"\"You should replace your local global installation of drush with drush launcher:\"",
",",
"\"https://github.com/drush-ops/drush-launcher\"",
",",
"]",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"}"
] |
8.9.7.
@Update(
version = "8009007",
description = "Removing drush files."
)
|
[
"8",
".",
"9",
".",
"7",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L417-L430
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_8009011
|
public function update_8009011() {
$project_yml = $this->updater->getProjectYml();
if (isset($project_yml['vm']['enable'])) {
// Add to project.local.yml.
$project_local_yml = $this->updater->getProjectLocalYml();
$project_local_yml['vm']['enable'] = $project_yml['vm']['enable'];
$this->updater->writeProjectLocalYml($project_local_yml);
// Remove from project.yml.
unset($project_yml['vm']);
$this->updater->writeProjectYml($project_yml);
}
}
|
php
|
public function update_8009011() {
$project_yml = $this->updater->getProjectYml();
if (isset($project_yml['vm']['enable'])) {
// Add to project.local.yml.
$project_local_yml = $this->updater->getProjectLocalYml();
$project_local_yml['vm']['enable'] = $project_yml['vm']['enable'];
$this->updater->writeProjectLocalYml($project_local_yml);
// Remove from project.yml.
unset($project_yml['vm']);
$this->updater->writeProjectYml($project_yml);
}
}
|
[
"public",
"function",
"update_8009011",
"(",
")",
"{",
"$",
"project_yml",
"=",
"$",
"this",
"->",
"updater",
"->",
"getProjectYml",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"project_yml",
"[",
"'vm'",
"]",
"[",
"'enable'",
"]",
")",
")",
"{",
"// Add to project.local.yml.",
"$",
"project_local_yml",
"=",
"$",
"this",
"->",
"updater",
"->",
"getProjectLocalYml",
"(",
")",
";",
"$",
"project_local_yml",
"[",
"'vm'",
"]",
"[",
"'enable'",
"]",
"=",
"$",
"project_yml",
"[",
"'vm'",
"]",
"[",
"'enable'",
"]",
";",
"$",
"this",
"->",
"updater",
"->",
"writeProjectLocalYml",
"(",
"$",
"project_local_yml",
")",
";",
"// Remove from project.yml.",
"unset",
"(",
"$",
"project_yml",
"[",
"'vm'",
"]",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"writeProjectYml",
"(",
"$",
"project_yml",
")",
";",
"}",
"}"
] |
8.9.11.
@Update(
version = "8009011",
description = "Move vm.enable from project.yml to project.local.yml."
)
|
[
"8",
".",
"9",
".",
"11",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L440-L452
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_9001000
|
public function update_9001000() {
$this->updater->syncWithTemplate('.gitignore', TRUE);
$messages = ['.gitignore has been updated. Review it for any custom changes that may have been overwritten.'];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
$this->updater->syncWithTemplate('blt/ci.blt.yml', TRUE);
$messages = ['blt/ci.blt.yml has been updated. Review it for any custom changes that may have been overwritten.'];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
// Update composer.json to include new BLT required/suggested files.
// Pulls in wikimedia/composer-merge-plugin and composer/installers settings.
$project_composer_json = $this->updater->getRepoRoot() . '/composer.json';
$template_composer_json = $this->updater->getBltRoot() . '/subtree-splits/blt-project/composer.json';
$munged_json = ComposerMunge::mungeFiles($project_composer_json, $template_composer_json);
$bytes = file_put_contents($project_composer_json, $munged_json);
if (!$bytes) {
$messages = ["Could not update $project_composer_json."];
}
else {
$messages = ["Updated $project_composer_json. Review changes, then re-run composer update."];
}
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
php
|
public function update_9001000() {
$this->updater->syncWithTemplate('.gitignore', TRUE);
$messages = ['.gitignore has been updated. Review it for any custom changes that may have been overwritten.'];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
$this->updater->syncWithTemplate('blt/ci.blt.yml', TRUE);
$messages = ['blt/ci.blt.yml has been updated. Review it for any custom changes that may have been overwritten.'];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
// Update composer.json to include new BLT required/suggested files.
// Pulls in wikimedia/composer-merge-plugin and composer/installers settings.
$project_composer_json = $this->updater->getRepoRoot() . '/composer.json';
$template_composer_json = $this->updater->getBltRoot() . '/subtree-splits/blt-project/composer.json';
$munged_json = ComposerMunge::mungeFiles($project_composer_json, $template_composer_json);
$bytes = file_put_contents($project_composer_json, $munged_json);
if (!$bytes) {
$messages = ["Could not update $project_composer_json."];
}
else {
$messages = ["Updated $project_composer_json. Review changes, then re-run composer update."];
}
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
[
"public",
"function",
"update_9001000",
"(",
")",
"{",
"$",
"this",
"->",
"updater",
"->",
"syncWithTemplate",
"(",
"'.gitignore'",
",",
"TRUE",
")",
";",
"$",
"messages",
"=",
"[",
"'.gitignore has been updated. Review it for any custom changes that may have been overwritten.'",
"]",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"syncWithTemplate",
"(",
"'blt/ci.blt.yml'",
",",
"TRUE",
")",
";",
"$",
"messages",
"=",
"[",
"'blt/ci.blt.yml has been updated. Review it for any custom changes that may have been overwritten.'",
"]",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"// Update composer.json to include new BLT required/suggested files.",
"// Pulls in wikimedia/composer-merge-plugin and composer/installers settings.",
"$",
"project_composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getRepoRoot",
"(",
")",
".",
"'/composer.json'",
";",
"$",
"template_composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getBltRoot",
"(",
")",
".",
"'/subtree-splits/blt-project/composer.json'",
";",
"$",
"munged_json",
"=",
"ComposerMunge",
"::",
"mungeFiles",
"(",
"$",
"project_composer_json",
",",
"$",
"template_composer_json",
")",
";",
"$",
"bytes",
"=",
"file_put_contents",
"(",
"$",
"project_composer_json",
",",
"$",
"munged_json",
")",
";",
"if",
"(",
"!",
"$",
"bytes",
")",
"{",
"$",
"messages",
"=",
"[",
"\"Could not update $project_composer_json.\"",
"]",
";",
"}",
"else",
"{",
"$",
"messages",
"=",
"[",
"\"Updated $project_composer_json. Review changes, then re-run composer update.\"",
"]",
";",
"}",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"}"
] |
9.1.0-alpha1.
@Update(
version = "9001000",
description = "Add deployment_identifier to project .gitignore and re-syncs ci.blt.yml."
)
|
[
"9",
".",
"1",
".",
"0",
"-",
"alpha1",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L549-L583
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_9001001
|
public function update_9001001() {
$this->updater->syncWithTemplate('.gitignore', TRUE);
$composer_json = $this->updater->getComposerJson();
if (isset($composer_json['extra']['installer-paths']['drush/contrib/{$name}'])) {
unset($composer_json['extra']['installer-paths']['drush/contrib/{$name}']);
}
$composer_json['extra']['installer-paths']['drush/Commands/{$name}'][] = 'type:drupal-drush';
$this->updater->writeComposerJson($composer_json);
$messages = [
"Your composer.json file has been modified to be compatible with Drush 9.",
"You must execute `composer update --lock` to update your lock file.",
];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
php
|
public function update_9001001() {
$this->updater->syncWithTemplate('.gitignore', TRUE);
$composer_json = $this->updater->getComposerJson();
if (isset($composer_json['extra']['installer-paths']['drush/contrib/{$name}'])) {
unset($composer_json['extra']['installer-paths']['drush/contrib/{$name}']);
}
$composer_json['extra']['installer-paths']['drush/Commands/{$name}'][] = 'type:drupal-drush';
$this->updater->writeComposerJson($composer_json);
$messages = [
"Your composer.json file has been modified to be compatible with Drush 9.",
"You must execute `composer update --lock` to update your lock file.",
];
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
|
[
"public",
"function",
"update_9001001",
"(",
")",
"{",
"$",
"this",
"->",
"updater",
"->",
"syncWithTemplate",
"(",
"'.gitignore'",
",",
"TRUE",
")",
";",
"$",
"composer_json",
"=",
"$",
"this",
"->",
"updater",
"->",
"getComposerJson",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-paths'",
"]",
"[",
"'drush/contrib/{$name}'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-paths'",
"]",
"[",
"'drush/contrib/{$name}'",
"]",
")",
";",
"}",
"$",
"composer_json",
"[",
"'extra'",
"]",
"[",
"'installer-paths'",
"]",
"[",
"'drush/Commands/{$name}'",
"]",
"[",
"]",
"=",
"'type:drupal-drush'",
";",
"$",
"this",
"->",
"updater",
"->",
"writeComposerJson",
"(",
"$",
"composer_json",
")",
";",
"$",
"messages",
"=",
"[",
"\"Your composer.json file has been modified to be compatible with Drush 9.\"",
",",
"\"You must execute `composer update --lock` to update your lock file.\"",
",",
"]",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"}"
] |
9.1.0.
@Update(
version = "9001001",
description = "Adjust Drush 9 Composer contrib directory."
)
|
[
"9",
".",
"1",
".",
"0",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L593-L609
|
train
|
acquia/blt
|
src/Update/Updates.php
|
Updates.update_9002000
|
public function update_9002000() {
if (file_exists($this->updater->getRepoRoot() . '/factory-hooks')) {
$messages = [
"This update will update the files in your existing factory hooks directory.",
"Review the resulting files and ensure that any customizations have been re-added.",
];
$this->updater->executeCommand("./vendor/bin/blt recipes:acsf:init:hooks");
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
}
|
php
|
public function update_9002000() {
if (file_exists($this->updater->getRepoRoot() . '/factory-hooks')) {
$messages = [
"This update will update the files in your existing factory hooks directory.",
"Review the resulting files and ensure that any customizations have been re-added.",
];
$this->updater->executeCommand("./vendor/bin/blt recipes:acsf:init:hooks");
$formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
$this->updater->getOutput()->writeln("");
$this->updater->getOutput()->writeln($formattedBlock);
$this->updater->getOutput()->writeln("");
}
}
|
[
"public",
"function",
"update_9002000",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"updater",
"->",
"getRepoRoot",
"(",
")",
".",
"'/factory-hooks'",
")",
")",
"{",
"$",
"messages",
"=",
"[",
"\"This update will update the files in your existing factory hooks directory.\"",
",",
"\"Review the resulting files and ensure that any customizations have been re-added.\"",
",",
"]",
";",
"$",
"this",
"->",
"updater",
"->",
"executeCommand",
"(",
"\"./vendor/bin/blt recipes:acsf:init:hooks\"",
")",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"updater",
"->",
"getFormatter",
"(",
")",
"->",
"formatBlock",
"(",
"$",
"messages",
",",
"'ice'",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"$",
"this",
"->",
"updater",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"\"",
")",
";",
"}",
"}"
] |
9.2.0.
@Update(
version = "9002000",
description = "Factory Hooks Drush 9 bug fixes and enhancements for db-update."
)
|
[
"9",
".",
"2",
".",
"0",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Update/Updates.php#L619-L631
|
train
|
acquia/blt
|
src/Robo/Commands/Validate/YamlCommand.php
|
YamlCommand.lintFileSets
|
public function lintFileSets() {
$this->say("Validating yaml syntax for all custom modules and exported config...");
/** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */
$fileset_manager = $this->getContainer()->get('filesetManager');
$fileset_ids = $this->getConfigValue('validate.yaml.filesets');
$filesets = $fileset_manager->getFilesets($fileset_ids, TRUE);
$bin = $this->getConfigValue('composer.bin');
$command = "'$bin/yaml-cli' lint '%s'";
$this->executeCommandAgainstFilesets($filesets, $command, TRUE);
}
|
php
|
public function lintFileSets() {
$this->say("Validating yaml syntax for all custom modules and exported config...");
/** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */
$fileset_manager = $this->getContainer()->get('filesetManager');
$fileset_ids = $this->getConfigValue('validate.yaml.filesets');
$filesets = $fileset_manager->getFilesets($fileset_ids, TRUE);
$bin = $this->getConfigValue('composer.bin');
$command = "'$bin/yaml-cli' lint '%s'";
$this->executeCommandAgainstFilesets($filesets, $command, TRUE);
}
|
[
"public",
"function",
"lintFileSets",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Validating yaml syntax for all custom modules and exported config...\"",
")",
";",
"/** @var \\Acquia\\Blt\\Robo\\Filesets\\FilesetManager $fileset_manager */",
"$",
"fileset_manager",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'filesetManager'",
")",
";",
"$",
"fileset_ids",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'validate.yaml.filesets'",
")",
";",
"$",
"filesets",
"=",
"$",
"fileset_manager",
"->",
"getFilesets",
"(",
"$",
"fileset_ids",
",",
"TRUE",
")",
";",
"$",
"bin",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'composer.bin'",
")",
";",
"$",
"command",
"=",
"\"'$bin/yaml-cli' lint '%s'\"",
";",
"$",
"this",
"->",
"executeCommandAgainstFilesets",
"(",
"$",
"filesets",
",",
"$",
"command",
",",
"TRUE",
")",
";",
"}"
] |
Executes YAML validator against all validate.yaml.filesets files.
@command tests:yaml:lint:all
@aliases tyla yaml tests:yaml:lint validate:yaml
|
[
"Executes",
"YAML",
"validator",
"against",
"all",
"validate",
".",
"yaml",
".",
"filesets",
"files",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Validate/YamlCommand.php#L19-L29
|
train
|
acquia/blt
|
src/Robo/Commands/Validate/YamlCommand.php
|
YamlCommand.lintFileList
|
public function lintFileList($file_list) {
$this->say("Linting YAML files...");
$files = explode("\n", $file_list);
/** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */
$fileset_manager = $this->getContainer()->get('filesetManager');
$fileset_ids = $this->getConfigValue('validate.yaml.filesets');
$filesets = $fileset_manager->getFilesets($fileset_ids);
$bin = $this->getConfigValue('composer.bin');
$command = "'$bin/yaml-cli' lint '%s'";
foreach ($filesets as $fileset_id => $fileset) {
$filesets[$fileset_id] = $fileset_manager->filterFilesByFileset($files, $fileset);
}
$this->executeCommandAgainstFilesets($filesets, $command);
}
|
php
|
public function lintFileList($file_list) {
$this->say("Linting YAML files...");
$files = explode("\n", $file_list);
/** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */
$fileset_manager = $this->getContainer()->get('filesetManager');
$fileset_ids = $this->getConfigValue('validate.yaml.filesets');
$filesets = $fileset_manager->getFilesets($fileset_ids);
$bin = $this->getConfigValue('composer.bin');
$command = "'$bin/yaml-cli' lint '%s'";
foreach ($filesets as $fileset_id => $fileset) {
$filesets[$fileset_id] = $fileset_manager->filterFilesByFileset($files, $fileset);
}
$this->executeCommandAgainstFilesets($filesets, $command);
}
|
[
"public",
"function",
"lintFileList",
"(",
"$",
"file_list",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Linting YAML files...\"",
")",
";",
"$",
"files",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"file_list",
")",
";",
"/** @var \\Acquia\\Blt\\Robo\\Filesets\\FilesetManager $fileset_manager */",
"$",
"fileset_manager",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'filesetManager'",
")",
";",
"$",
"fileset_ids",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'validate.yaml.filesets'",
")",
";",
"$",
"filesets",
"=",
"$",
"fileset_manager",
"->",
"getFilesets",
"(",
"$",
"fileset_ids",
")",
";",
"$",
"bin",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'composer.bin'",
")",
";",
"$",
"command",
"=",
"\"'$bin/yaml-cli' lint '%s'\"",
";",
"foreach",
"(",
"$",
"filesets",
"as",
"$",
"fileset_id",
"=>",
"$",
"fileset",
")",
"{",
"$",
"filesets",
"[",
"$",
"fileset_id",
"]",
"=",
"$",
"fileset_manager",
"->",
"filterFilesByFileset",
"(",
"$",
"files",
",",
"$",
"fileset",
")",
";",
"}",
"$",
"this",
"->",
"executeCommandAgainstFilesets",
"(",
"$",
"filesets",
",",
"$",
"command",
")",
";",
"}"
] |
Executes YAML validator against files, if in validate.yaml.filesets.
@command tests:yaml:lint:files
@aliases tylf
@param string $file_list
A list of files to scan, separated by \n.
|
[
"Executes",
"YAML",
"validator",
"against",
"files",
"if",
"in",
"validate",
".",
"yaml",
".",
"filesets",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Validate/YamlCommand.php#L40-L57
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.initializeSimpleSamlPhp
|
public function initializeSimpleSamlPhp() {
$this->requireModule();
$this->initializeConfig();
$this->setSimpleSamlPhpInstalled();
$this->symlinkDocrootToLibDir();
$this->addHtaccessPatch();
$this->outputCompleteSetupInstructions();
}
|
php
|
public function initializeSimpleSamlPhp() {
$this->requireModule();
$this->initializeConfig();
$this->setSimpleSamlPhpInstalled();
$this->symlinkDocrootToLibDir();
$this->addHtaccessPatch();
$this->outputCompleteSetupInstructions();
}
|
[
"public",
"function",
"initializeSimpleSamlPhp",
"(",
")",
"{",
"$",
"this",
"->",
"requireModule",
"(",
")",
";",
"$",
"this",
"->",
"initializeConfig",
"(",
")",
";",
"$",
"this",
"->",
"setSimpleSamlPhpInstalled",
"(",
")",
";",
"$",
"this",
"->",
"symlinkDocrootToLibDir",
"(",
")",
";",
"$",
"this",
"->",
"addHtaccessPatch",
"(",
")",
";",
"$",
"this",
"->",
"outputCompleteSetupInstructions",
"(",
")",
";",
"}"
] |
Initializes SimpleSAMLphp for project.
@command recipes:simplesamlphp:init
@aliases rsi saml simplesamlphp:init
|
[
"Initializes",
"SimpleSAMLphp",
"for",
"project",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L42-L49
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.initializeConfig
|
protected function initializeConfig() {
$destinationDirectory = "{$this->repoRoot}/simplesamlphp/config";
$this->say("Copying config files to ${destinationDirectory}...");
$result = $this->taskFileSystemStack()
->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/authsources.php", "${destinationDirectory}/authsources.php", TRUE)
->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/config.php", "${destinationDirectory}/config.php", TRUE)
->copy("{$this->bltRoot}/scripts/simplesamlphp/acquia_config.php", "${destinationDirectory}/acquia_config.php", TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to copy SimpleSamlPhp config files.");
}
$config_file = "{$this->repoRoot}/simplesamlphp/config/config.php";
$result = $this->taskWriteToFile($config_file)
->text("include 'acquia_config.php';")
->append()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable modify $config_file.");
}
$this->say("Copying config files to {$this->repoRoot}/simplesamlphp/metadata...");
$result = $this->taskFileSystemStack()
->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/metadata-templates/saml20-idp-remote.php", "{$this->repoRoot}/simplesamlphp/metadata/saml20-idp-remote.php", TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to initialize SimpleSamlPhp configuration.");
}
}
|
php
|
protected function initializeConfig() {
$destinationDirectory = "{$this->repoRoot}/simplesamlphp/config";
$this->say("Copying config files to ${destinationDirectory}...");
$result = $this->taskFileSystemStack()
->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/authsources.php", "${destinationDirectory}/authsources.php", TRUE)
->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/config.php", "${destinationDirectory}/config.php", TRUE)
->copy("{$this->bltRoot}/scripts/simplesamlphp/acquia_config.php", "${destinationDirectory}/acquia_config.php", TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to copy SimpleSamlPhp config files.");
}
$config_file = "{$this->repoRoot}/simplesamlphp/config/config.php";
$result = $this->taskWriteToFile($config_file)
->text("include 'acquia_config.php';")
->append()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable modify $config_file.");
}
$this->say("Copying config files to {$this->repoRoot}/simplesamlphp/metadata...");
$result = $this->taskFileSystemStack()
->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/metadata-templates/saml20-idp-remote.php", "{$this->repoRoot}/simplesamlphp/metadata/saml20-idp-remote.php", TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to initialize SimpleSamlPhp configuration.");
}
}
|
[
"protected",
"function",
"initializeConfig",
"(",
")",
"{",
"$",
"destinationDirectory",
"=",
"\"{$this->repoRoot}/simplesamlphp/config\"",
";",
"$",
"this",
"->",
"say",
"(",
"\"Copying config files to ${destinationDirectory}...\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskFileSystemStack",
"(",
")",
"->",
"copy",
"(",
"\"{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/authsources.php\"",
",",
"\"${destinationDirectory}/authsources.php\"",
",",
"TRUE",
")",
"->",
"copy",
"(",
"\"{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/config.php\"",
",",
"\"${destinationDirectory}/config.php\"",
",",
"TRUE",
")",
"->",
"copy",
"(",
"\"{$this->bltRoot}/scripts/simplesamlphp/acquia_config.php\"",
",",
"\"${destinationDirectory}/acquia_config.php\"",
",",
"TRUE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to copy SimpleSamlPhp config files.\"",
")",
";",
"}",
"$",
"config_file",
"=",
"\"{$this->repoRoot}/simplesamlphp/config/config.php\"",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskWriteToFile",
"(",
"$",
"config_file",
")",
"->",
"text",
"(",
"\"include 'acquia_config.php';\"",
")",
"->",
"append",
"(",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable modify $config_file.\"",
")",
";",
"}",
"$",
"this",
"->",
"say",
"(",
"\"Copying config files to {$this->repoRoot}/simplesamlphp/metadata...\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskFileSystemStack",
"(",
")",
"->",
"copy",
"(",
"\"{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/metadata-templates/saml20-idp-remote.php\"",
",",
"\"{$this->repoRoot}/simplesamlphp/metadata/saml20-idp-remote.php\"",
",",
"TRUE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to initialize SimpleSamlPhp configuration.\"",
")",
";",
"}",
"}"
] |
Copies configuration templates from SimpleSamlPHP to the repo root.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Copies",
"configuration",
"templates",
"from",
"SimpleSamlPHP",
"to",
"the",
"repo",
"root",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L70-L103
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.setSimpleSamlPhpInstalled
|
protected function setSimpleSamlPhpInstalled() {
$project_yml = $this->getConfigValue('blt.config-files.project');
$this->say("Updating ${project_yml}...");
$project_config = YamlMunge::parseFile($project_yml);
$project_config['simplesamlphp'] = TRUE;
try {
YamlMunge::writeFile($project_yml, $project_config);
}
catch (\Exception $e) {
throw new BltException("Unable to update $project_yml.");
}
}
|
php
|
protected function setSimpleSamlPhpInstalled() {
$project_yml = $this->getConfigValue('blt.config-files.project');
$this->say("Updating ${project_yml}...");
$project_config = YamlMunge::parseFile($project_yml);
$project_config['simplesamlphp'] = TRUE;
try {
YamlMunge::writeFile($project_yml, $project_config);
}
catch (\Exception $e) {
throw new BltException("Unable to update $project_yml.");
}
}
|
[
"protected",
"function",
"setSimpleSamlPhpInstalled",
"(",
")",
"{",
"$",
"project_yml",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.config-files.project'",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Updating ${project_yml}...\"",
")",
";",
"$",
"project_config",
"=",
"YamlMunge",
"::",
"parseFile",
"(",
"$",
"project_yml",
")",
";",
"$",
"project_config",
"[",
"'simplesamlphp'",
"]",
"=",
"TRUE",
";",
"try",
"{",
"YamlMunge",
"::",
"writeFile",
"(",
"$",
"project_yml",
",",
"$",
"project_config",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to update $project_yml.\"",
")",
";",
"}",
"}"
] |
Sets value in blt.yml to let targets know simplesamlphp is installed.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Sets",
"value",
"in",
"blt",
".",
"yml",
"to",
"let",
"targets",
"know",
"simplesamlphp",
"is",
"installed",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L136-L150
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.symlinkDocrootToLibDir
|
protected function symlinkDocrootToLibDir() {
$docroot = $this->getConfigValue('docroot');
$this->say("Creating a symbolic link from ${docroot}/simplesaml to web accessible directory in the simplesamlphp library...");
$result = $this->taskFileSystemStack()
->symlink("../vendor/simplesamlphp/simplesamlphp/www", "${docroot}/simplesaml")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable create symlink.");
}
}
|
php
|
protected function symlinkDocrootToLibDir() {
$docroot = $this->getConfigValue('docroot');
$this->say("Creating a symbolic link from ${docroot}/simplesaml to web accessible directory in the simplesamlphp library...");
$result = $this->taskFileSystemStack()
->symlink("../vendor/simplesamlphp/simplesamlphp/www", "${docroot}/simplesaml")
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable create symlink.");
}
}
|
[
"protected",
"function",
"symlinkDocrootToLibDir",
"(",
")",
"{",
"$",
"docroot",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'docroot'",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Creating a symbolic link from ${docroot}/simplesaml to web accessible directory in the simplesamlphp library...\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskFileSystemStack",
"(",
")",
"->",
"symlink",
"(",
"\"../vendor/simplesamlphp/simplesamlphp/www\"",
",",
"\"${docroot}/simplesaml\"",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable create symlink.\"",
")",
";",
"}",
"}"
] |
Creates a symlink from the docroot to the web accessible library dir.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Creates",
"a",
"symlink",
"from",
"the",
"docroot",
"to",
"the",
"web",
"accessible",
"library",
"dir",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L156-L168
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.simpleSamlPhpBuildConfig
|
public function simpleSamlPhpBuildConfig() {
$this->say('Copying config files to the appropriate place in simplesamlphp library...');
$result = $this->taskCopyDir(["{$this->repoRoot}/simplesamlphp" => "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp"])
->overwrite(TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to copy configuration into SimpleSamlPhp.");
}
$result = $this->taskFileSystemStack()
->copy("{$this->bltRoot}/scripts/simplesamlphp/gitignore.txt", "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/.gitignore", TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to copy .gitignore into SimpleSamlPhp.");
}
}
|
php
|
public function simpleSamlPhpBuildConfig() {
$this->say('Copying config files to the appropriate place in simplesamlphp library...');
$result = $this->taskCopyDir(["{$this->repoRoot}/simplesamlphp" => "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp"])
->overwrite(TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to copy configuration into SimpleSamlPhp.");
}
$result = $this->taskFileSystemStack()
->copy("{$this->bltRoot}/scripts/simplesamlphp/gitignore.txt", "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/.gitignore", TRUE)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to copy .gitignore into SimpleSamlPhp.");
}
}
|
[
"public",
"function",
"simpleSamlPhpBuildConfig",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"'Copying config files to the appropriate place in simplesamlphp library...'",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskCopyDir",
"(",
"[",
"\"{$this->repoRoot}/simplesamlphp\"",
"=>",
"\"{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp\"",
"]",
")",
"->",
"overwrite",
"(",
"TRUE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to copy configuration into SimpleSamlPhp.\"",
")",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"taskFileSystemStack",
"(",
")",
"->",
"copy",
"(",
"\"{$this->bltRoot}/scripts/simplesamlphp/gitignore.txt\"",
",",
"\"{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/.gitignore\"",
",",
"TRUE",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to copy .gitignore into SimpleSamlPhp.\"",
")",
";",
"}",
"}"
] |
Copies customized config files into vendored SimpleSamlPHP.
@command source:build:simplesamlphp-config
@aliases sbsc
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Copies",
"customized",
"config",
"files",
"into",
"vendored",
"SimpleSamlPHP",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L177-L194
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.outputCompleteSetupInstructions
|
protected function outputCompleteSetupInstructions() {
$instructions = [
'To complete the setup you must manually modify several files:',
'',
"* {$this->repoRoot}/simplesamlphp/config/acquia_config.php",
"* {$this->repoRoot}/simplesamlphp/config/authsources.php",
"* {$this->repoRoot}/simplesamlphp/metadata/saml20-idp-remote.php",
'',
'After editing these files execute the following command to copy the modified files to the correct location in the SimpleSAMLphp library:',
'',
"'blt source:build:simplesamlphp-config'",
'',
"See http://blt.readthedocs.io/en/latest/readme/simplesamlphp-setup/ for details on how to modify the files.",
];
$formattedBlock = $this->formatter->formatBlock($instructions, 'comment', TRUE);
$this->writeln($formattedBlock);
}
|
php
|
protected function outputCompleteSetupInstructions() {
$instructions = [
'To complete the setup you must manually modify several files:',
'',
"* {$this->repoRoot}/simplesamlphp/config/acquia_config.php",
"* {$this->repoRoot}/simplesamlphp/config/authsources.php",
"* {$this->repoRoot}/simplesamlphp/metadata/saml20-idp-remote.php",
'',
'After editing these files execute the following command to copy the modified files to the correct location in the SimpleSAMLphp library:',
'',
"'blt source:build:simplesamlphp-config'",
'',
"See http://blt.readthedocs.io/en/latest/readme/simplesamlphp-setup/ for details on how to modify the files.",
];
$formattedBlock = $this->formatter->formatBlock($instructions, 'comment', TRUE);
$this->writeln($formattedBlock);
}
|
[
"protected",
"function",
"outputCompleteSetupInstructions",
"(",
")",
"{",
"$",
"instructions",
"=",
"[",
"'To complete the setup you must manually modify several files:'",
",",
"''",
",",
"\"* {$this->repoRoot}/simplesamlphp/config/acquia_config.php\"",
",",
"\"* {$this->repoRoot}/simplesamlphp/config/authsources.php\"",
",",
"\"* {$this->repoRoot}/simplesamlphp/metadata/saml20-idp-remote.php\"",
",",
"''",
",",
"'After editing these files execute the following command to copy the modified files to the correct location in the SimpleSAMLphp library:'",
",",
"''",
",",
"\"'blt source:build:simplesamlphp-config'\"",
",",
"''",
",",
"\"See http://blt.readthedocs.io/en/latest/readme/simplesamlphp-setup/ for details on how to modify the files.\"",
",",
"]",
";",
"$",
"formattedBlock",
"=",
"$",
"this",
"->",
"formatter",
"->",
"formatBlock",
"(",
"$",
"instructions",
",",
"'comment'",
",",
"TRUE",
")",
";",
"$",
"this",
"->",
"writeln",
"(",
"$",
"formattedBlock",
")",
";",
"}"
] |
Outputs a message to edit the new config files.
|
[
"Outputs",
"a",
"message",
"to",
"edit",
"the",
"new",
"config",
"files",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L210-L226
|
train
|
acquia/blt
|
src/Robo/Commands/Saml/SimpleSamlPhpCommand.php
|
SimpleSamlPhpCommand.addHtaccessPatch
|
protected function addHtaccessPatch() {
$this->taskFilesystemStack()
->copy($this->bltRoot . "/scripts/simplesamlphp/htaccess-saml.patch",
$this->repoRoot . "/patches/htaccess-saml.patch")
->run();
$composer_json = json_decode(file_get_contents($this->getConfigValue('repo.root') . '/composer.json'));
$composer_json->scripts->{"post-drupal-scaffold-cmd"}[] = "cd docroot && patch -p1 <../patches/htaccess-saml.patch";
file_put_contents($this->getConfigValue('repo.root') . '/composer.json',
json_encode($composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$this->taskExecStack()
->dir($this->getConfigValue('repo.roou'))
->exec("composer post-drupal-scaffold-cmd")
->run();
// @todo throw exceptions.
}
|
php
|
protected function addHtaccessPatch() {
$this->taskFilesystemStack()
->copy($this->bltRoot . "/scripts/simplesamlphp/htaccess-saml.patch",
$this->repoRoot . "/patches/htaccess-saml.patch")
->run();
$composer_json = json_decode(file_get_contents($this->getConfigValue('repo.root') . '/composer.json'));
$composer_json->scripts->{"post-drupal-scaffold-cmd"}[] = "cd docroot && patch -p1 <../patches/htaccess-saml.patch";
file_put_contents($this->getConfigValue('repo.root') . '/composer.json',
json_encode($composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$this->taskExecStack()
->dir($this->getConfigValue('repo.roou'))
->exec("composer post-drupal-scaffold-cmd")
->run();
// @todo throw exceptions.
}
|
[
"protected",
"function",
"addHtaccessPatch",
"(",
")",
"{",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"bltRoot",
".",
"\"/scripts/simplesamlphp/htaccess-saml.patch\"",
",",
"$",
"this",
"->",
"repoRoot",
".",
"\"/patches/htaccess-saml.patch\"",
")",
"->",
"run",
"(",
")",
";",
"$",
"composer_json",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/composer.json'",
")",
")",
";",
"$",
"composer_json",
"->",
"scripts",
"->",
"{",
"\"post-drupal-scaffold-cmd\"",
"}",
"[",
"]",
"=",
"\"cd docroot && patch -p1 <../patches/htaccess-saml.patch\"",
";",
"file_put_contents",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/composer.json'",
",",
"json_encode",
"(",
"$",
"composer_json",
",",
"JSON_PRETTY_PRINT",
"|",
"JSON_UNESCAPED_SLASHES",
")",
")",
";",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.roou'",
")",
")",
"->",
"exec",
"(",
"\"composer post-drupal-scaffold-cmd\"",
")",
"->",
"run",
"(",
")",
";",
"// @todo throw exceptions.",
"}"
] |
Add a patch to .htaccess.
|
[
"Add",
"a",
"patch",
"to",
".",
"htaccess",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Saml/SimpleSamlPhpCommand.php#L231-L245
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.invokeCommands
|
protected function invokeCommands(array $commands) {
foreach ($commands as $key => $value) {
if (is_numeric($key)) {
$command = $value;
$args = [];
}
else {
$command = $key;
$args = $value;
}
$this->invokeCommand($command, $args);
}
}
|
php
|
protected function invokeCommands(array $commands) {
foreach ($commands as $key => $value) {
if (is_numeric($key)) {
$command = $value;
$args = [];
}
else {
$command = $key;
$args = $value;
}
$this->invokeCommand($command, $args);
}
}
|
[
"protected",
"function",
"invokeCommands",
"(",
"array",
"$",
"commands",
")",
"{",
"foreach",
"(",
"$",
"commands",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"$",
"command",
"=",
"$",
"value",
";",
"$",
"args",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"$",
"command",
"=",
"$",
"key",
";",
"$",
"args",
"=",
"$",
"value",
";",
"}",
"$",
"this",
"->",
"invokeCommand",
"(",
"$",
"command",
",",
"$",
"args",
")",
";",
"}",
"}"
] |
Invokes an array of Symfony commands.
@param array $commands
An array of Symfony commands to invoke, e.g., 'tests:behat:run'.
|
[
"Invokes",
"an",
"array",
"of",
"Symfony",
"commands",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L53-L65
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.invokeCommand
|
protected function invokeCommand($command_name, array $args = []) {
$this->invokeDepth++;
if (!$this->isCommandDisabled($command_name)) {
/** @var \Acquia\Blt\Robo\Application $application */
$application = $this->getContainer()->get('application');
$command = $application->find($command_name);
$input = new ArrayInput($args);
$input->setInteractive($this->input()->isInteractive());
$prefix = str_repeat(">", $this->invokeDepth);
$this->output->writeln("<comment>$prefix $command_name</comment>");
$exit_code = $application->runCommand($command, $input, $this->output());
$this->invokeDepth--;
// The application will catch any exceptions thrown in the executed
// command. We must check the exit code and throw our own exception. This
// obviates the need to check the exit code of every invoked command.
if ($exit_code) {
throw new BltException("Command `$command_name {$input->__toString()}` exited with code $exit_code.");
}
}
}
|
php
|
protected function invokeCommand($command_name, array $args = []) {
$this->invokeDepth++;
if (!$this->isCommandDisabled($command_name)) {
/** @var \Acquia\Blt\Robo\Application $application */
$application = $this->getContainer()->get('application');
$command = $application->find($command_name);
$input = new ArrayInput($args);
$input->setInteractive($this->input()->isInteractive());
$prefix = str_repeat(">", $this->invokeDepth);
$this->output->writeln("<comment>$prefix $command_name</comment>");
$exit_code = $application->runCommand($command, $input, $this->output());
$this->invokeDepth--;
// The application will catch any exceptions thrown in the executed
// command. We must check the exit code and throw our own exception. This
// obviates the need to check the exit code of every invoked command.
if ($exit_code) {
throw new BltException("Command `$command_name {$input->__toString()}` exited with code $exit_code.");
}
}
}
|
[
"protected",
"function",
"invokeCommand",
"(",
"$",
"command_name",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"invokeDepth",
"++",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isCommandDisabled",
"(",
"$",
"command_name",
")",
")",
"{",
"/** @var \\Acquia\\Blt\\Robo\\Application $application */",
"$",
"application",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'application'",
")",
";",
"$",
"command",
"=",
"$",
"application",
"->",
"find",
"(",
"$",
"command_name",
")",
";",
"$",
"input",
"=",
"new",
"ArrayInput",
"(",
"$",
"args",
")",
";",
"$",
"input",
"->",
"setInteractive",
"(",
"$",
"this",
"->",
"input",
"(",
")",
"->",
"isInteractive",
"(",
")",
")",
";",
"$",
"prefix",
"=",
"str_repeat",
"(",
"\">\"",
",",
"$",
"this",
"->",
"invokeDepth",
")",
";",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"\"<comment>$prefix $command_name</comment>\"",
")",
";",
"$",
"exit_code",
"=",
"$",
"application",
"->",
"runCommand",
"(",
"$",
"command",
",",
"$",
"input",
",",
"$",
"this",
"->",
"output",
"(",
")",
")",
";",
"$",
"this",
"->",
"invokeDepth",
"--",
";",
"// The application will catch any exceptions thrown in the executed",
"// command. We must check the exit code and throw our own exception. This",
"// obviates the need to check the exit code of every invoked command.",
"if",
"(",
"$",
"exit_code",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Command `$command_name {$input->__toString()}` exited with code $exit_code.\"",
")",
";",
"}",
"}",
"}"
] |
Invokes a single Symfony command.
@param string $command_name
The name of the command, e.g., 'tests:behat:run'.
@param array $args
An array of arguments to pass to the command.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Invokes",
"a",
"single",
"Symfony",
"command",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L77-L99
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.getDisabledCommands
|
protected function getDisabledCommands() {
$disabled_commands_config = $this->getConfigValue('disable-targets');
if ($disabled_commands_config) {
$disabled_commands = ArrayManipulator::flattenMultidimensionalArray($disabled_commands_config, ':');
return $disabled_commands;
}
return [];
}
|
php
|
protected function getDisabledCommands() {
$disabled_commands_config = $this->getConfigValue('disable-targets');
if ($disabled_commands_config) {
$disabled_commands = ArrayManipulator::flattenMultidimensionalArray($disabled_commands_config, ':');
return $disabled_commands;
}
return [];
}
|
[
"protected",
"function",
"getDisabledCommands",
"(",
")",
"{",
"$",
"disabled_commands_config",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'disable-targets'",
")",
";",
"if",
"(",
"$",
"disabled_commands_config",
")",
"{",
"$",
"disabled_commands",
"=",
"ArrayManipulator",
"::",
"flattenMultidimensionalArray",
"(",
"$",
"disabled_commands_config",
",",
"':'",
")",
";",
"return",
"$",
"disabled_commands",
";",
"}",
"return",
"[",
"]",
";",
"}"
] |
Gets an array of commands that have been configured to be disabled.
@return array
A flat array of disabled commands.
|
[
"Gets",
"an",
"array",
"of",
"commands",
"that",
"have",
"been",
"configured",
"to",
"be",
"disabled",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L107-L114
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.isCommandDisabled
|
protected function isCommandDisabled($command) {
$disabled_commands = $this->getDisabledCommands();
if (is_array($disabled_commands) && array_key_exists($command, $disabled_commands) && $disabled_commands[$command]) {
$this->logger->warning("The $command command is disabled.");
return TRUE;
}
return FALSE;
}
|
php
|
protected function isCommandDisabled($command) {
$disabled_commands = $this->getDisabledCommands();
if (is_array($disabled_commands) && array_key_exists($command, $disabled_commands) && $disabled_commands[$command]) {
$this->logger->warning("The $command command is disabled.");
return TRUE;
}
return FALSE;
}
|
[
"protected",
"function",
"isCommandDisabled",
"(",
"$",
"command",
")",
"{",
"$",
"disabled_commands",
"=",
"$",
"this",
"->",
"getDisabledCommands",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"disabled_commands",
")",
"&&",
"array_key_exists",
"(",
"$",
"command",
",",
"$",
"disabled_commands",
")",
"&&",
"$",
"disabled_commands",
"[",
"$",
"command",
"]",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"\"The $command command is disabled.\"",
")",
";",
"return",
"TRUE",
";",
"}",
"return",
"FALSE",
";",
"}"
] |
Determines if a command has been disabled via disable-targets.
@param string $command
The command name.
@return bool
TRUE if the command is disabled.
|
[
"Determines",
"if",
"a",
"command",
"has",
"been",
"disabled",
"via",
"disable",
"-",
"targets",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L125-L133
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.invokeHook
|
protected function invokeHook($hook) {
if ($this->getConfig()->has("command-hooks.$hook.command")
&& $this->getConfigValue("command-hooks.$hook.command")) {
$this->say("Executing $hook target hook...");
$result = $this->taskExecStack()
->exec($this->getConfigValue("command-hooks.$hook.command"))
->dir($this->getConfigValue("command-hooks.$hook.dir"))
->interactive($this->input()->isInteractive())
->printOutput(TRUE)
->printMetadata(TRUE)
->stopOnFail()
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Executing target-hook $hook failed.");
}
}
else {
$this->logger->info("Skipped $hook target hook. No hook is defined.");
return 0;
}
}
|
php
|
protected function invokeHook($hook) {
if ($this->getConfig()->has("command-hooks.$hook.command")
&& $this->getConfigValue("command-hooks.$hook.command")) {
$this->say("Executing $hook target hook...");
$result = $this->taskExecStack()
->exec($this->getConfigValue("command-hooks.$hook.command"))
->dir($this->getConfigValue("command-hooks.$hook.dir"))
->interactive($this->input()->isInteractive())
->printOutput(TRUE)
->printMetadata(TRUE)
->stopOnFail()
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Executing target-hook $hook failed.");
}
}
else {
$this->logger->info("Skipped $hook target hook. No hook is defined.");
return 0;
}
}
|
[
"protected",
"function",
"invokeHook",
"(",
"$",
"hook",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"has",
"(",
"\"command-hooks.$hook.command\"",
")",
"&&",
"$",
"this",
"->",
"getConfigValue",
"(",
"\"command-hooks.$hook.command\"",
")",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Executing $hook target hook...\"",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"exec",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"\"command-hooks.$hook.command\"",
")",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"\"command-hooks.$hook.dir\"",
")",
")",
"->",
"interactive",
"(",
"$",
"this",
"->",
"input",
"(",
")",
"->",
"isInteractive",
"(",
")",
")",
"->",
"printOutput",
"(",
"TRUE",
")",
"->",
"printMetadata",
"(",
"TRUE",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Executing target-hook $hook failed.\"",
")",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"Skipped $hook target hook. No hook is defined.\"",
")",
";",
"return",
"0",
";",
"}",
"}"
] |
Invokes a given 'command-hooks' hook, typically defined in blt.yml.
@param string $hook
The hook name.
@return int
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Invokes",
"a",
"given",
"command",
"-",
"hooks",
"hook",
"typically",
"defined",
"in",
"blt",
".",
"yml",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L145-L167
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.installVagrantPlugin
|
protected function installVagrantPlugin($plugin) {
if (!$this->getInspector()->isVagrantPluginInstalled($plugin)) {
$this->logger->warning("The $plugin plugin is not installed! Attempting to install it...");
$this->taskExec("vagrant plugin install $plugin")->run();
}
}
|
php
|
protected function installVagrantPlugin($plugin) {
if (!$this->getInspector()->isVagrantPluginInstalled($plugin)) {
$this->logger->warning("The $plugin plugin is not installed! Attempting to install it...");
$this->taskExec("vagrant plugin install $plugin")->run();
}
}
|
[
"protected",
"function",
"installVagrantPlugin",
"(",
"$",
"plugin",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getInspector",
"(",
")",
"->",
"isVagrantPluginInstalled",
"(",
"$",
"plugin",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"\"The $plugin plugin is not installed! Attempting to install it...\"",
")",
";",
"$",
"this",
"->",
"taskExec",
"(",
"\"vagrant plugin install $plugin\"",
")",
"->",
"run",
"(",
")",
";",
"}",
"}"
] |
Installs a vagrant plugin if it is not already installed.
@param string $plugin
The vagrant plugin name.
|
[
"Installs",
"a",
"vagrant",
"plugin",
"if",
"it",
"is",
"not",
"already",
"installed",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L175-L180
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.executeCommandAgainstFilesets
|
protected function executeCommandAgainstFilesets(array $filesets, $command, $parallel = FALSE) {
$passed = TRUE;
$failed_filesets = [];
foreach ($filesets as $fileset_id => $fileset) {
if (!is_null($fileset) && iterator_count($fileset)) {
$this->say("Iterating over fileset $fileset_id...");
$files = iterator_to_array($fileset);
$result = $this->executeCommandAgainstFiles($files, $command, $parallel);
if (!$result->wasSuccessful()) {
// We iterate over all filesets before throwing an exception. This
// will, for instance, allow a user to see all PHPCS violations in
// output before the command exits.
$passed = FALSE;
$failed_filesets[] = $fileset_id;
}
}
else {
$this->logger->info("No files were found in fileset $fileset_id. Skipped.");
}
}
if (!$passed) {
throw new BltException("Executing `$command` against fileset(s) " . implode(', ', $failed_filesets) . " returned a non-zero exit code.`");
}
}
|
php
|
protected function executeCommandAgainstFilesets(array $filesets, $command, $parallel = FALSE) {
$passed = TRUE;
$failed_filesets = [];
foreach ($filesets as $fileset_id => $fileset) {
if (!is_null($fileset) && iterator_count($fileset)) {
$this->say("Iterating over fileset $fileset_id...");
$files = iterator_to_array($fileset);
$result = $this->executeCommandAgainstFiles($files, $command, $parallel);
if (!$result->wasSuccessful()) {
// We iterate over all filesets before throwing an exception. This
// will, for instance, allow a user to see all PHPCS violations in
// output before the command exits.
$passed = FALSE;
$failed_filesets[] = $fileset_id;
}
}
else {
$this->logger->info("No files were found in fileset $fileset_id. Skipped.");
}
}
if (!$passed) {
throw new BltException("Executing `$command` against fileset(s) " . implode(', ', $failed_filesets) . " returned a non-zero exit code.`");
}
}
|
[
"protected",
"function",
"executeCommandAgainstFilesets",
"(",
"array",
"$",
"filesets",
",",
"$",
"command",
",",
"$",
"parallel",
"=",
"FALSE",
")",
"{",
"$",
"passed",
"=",
"TRUE",
";",
"$",
"failed_filesets",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filesets",
"as",
"$",
"fileset_id",
"=>",
"$",
"fileset",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"fileset",
")",
"&&",
"iterator_count",
"(",
"$",
"fileset",
")",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Iterating over fileset $fileset_id...\"",
")",
";",
"$",
"files",
"=",
"iterator_to_array",
"(",
"$",
"fileset",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"executeCommandAgainstFiles",
"(",
"$",
"files",
",",
"$",
"command",
",",
"$",
"parallel",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"// We iterate over all filesets before throwing an exception. This",
"// will, for instance, allow a user to see all PHPCS violations in",
"// output before the command exits.",
"$",
"passed",
"=",
"FALSE",
";",
"$",
"failed_filesets",
"[",
"]",
"=",
"$",
"fileset_id",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"No files were found in fileset $fileset_id. Skipped.\"",
")",
";",
"}",
"}",
"if",
"(",
"!",
"$",
"passed",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Executing `$command` against fileset(s) \"",
".",
"implode",
"(",
"', '",
",",
"$",
"failed_filesets",
")",
".",
"\" returned a non-zero exit code.`\"",
")",
";",
"}",
"}"
] |
Executes a given command against multiple filesets.
@param \Symfony\Component\Finder\Finder[] $filesets
@param string $command
The command to execute. The command should contain '%s', which will be
replaced with the file path of each file in the filesets.
@param bool $parallel
Indicates whether commands should be run in parallel or sequentially.
Defaults to FALSE.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Executes",
"a",
"given",
"command",
"against",
"multiple",
"filesets",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L196-L220
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.executeCommandAgainstFiles
|
protected function executeCommandAgainstFiles($files, $command, $parallel = FALSE) {
if ($parallel) {
return $this->executeCommandAgainstFilesInParallel($files, $command);
}
else {
return $this->executeCommandAgainstFilesProcedurally($files, $command);
}
}
|
php
|
protected function executeCommandAgainstFiles($files, $command, $parallel = FALSE) {
if ($parallel) {
return $this->executeCommandAgainstFilesInParallel($files, $command);
}
else {
return $this->executeCommandAgainstFilesProcedurally($files, $command);
}
}
|
[
"protected",
"function",
"executeCommandAgainstFiles",
"(",
"$",
"files",
",",
"$",
"command",
",",
"$",
"parallel",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"parallel",
")",
"{",
"return",
"$",
"this",
"->",
"executeCommandAgainstFilesInParallel",
"(",
"$",
"files",
",",
"$",
"command",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"executeCommandAgainstFilesProcedurally",
"(",
"$",
"files",
",",
"$",
"command",
")",
";",
"}",
"}"
] |
Executes a given command against an array of files.
@param array $files
A flat array of absolute file paths.
@param string $command
The command to execute. The command should contain '%s', which will be
replaced with the file path of each file in the fileset.
@param bool $parallel
Indicates whether commands should be run in parallel or sequentially.
Defaults to FALSE.
@return \Robo\Result
The result of the command execution.
|
[
"Executes",
"a",
"given",
"command",
"against",
"an",
"array",
"of",
"files",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L238-L245
|
train
|
acquia/blt
|
src/Robo/BltTasks.php
|
BltTasks.switchSiteContext
|
public function switchSiteContext($site_name) {
$this->logger->debug("Switching site context to <comment>$site_name</comment>.");
$config_initializer = new ConfigInitializer($this->getConfigValue('repo.root'), $this->input());
$config_initializer->setSite($site_name);
$new_config = $config_initializer->initialize();
// Replaces config.
$this->getConfig()->import($new_config->export());
}
|
php
|
public function switchSiteContext($site_name) {
$this->logger->debug("Switching site context to <comment>$site_name</comment>.");
$config_initializer = new ConfigInitializer($this->getConfigValue('repo.root'), $this->input());
$config_initializer->setSite($site_name);
$new_config = $config_initializer->initialize();
// Replaces config.
$this->getConfig()->import($new_config->export());
}
|
[
"public",
"function",
"switchSiteContext",
"(",
"$",
"site_name",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"\"Switching site context to <comment>$site_name</comment>.\"",
")",
";",
"$",
"config_initializer",
"=",
"new",
"ConfigInitializer",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
",",
"$",
"this",
"->",
"input",
"(",
")",
")",
";",
"$",
"config_initializer",
"->",
"setSite",
"(",
"$",
"site_name",
")",
";",
"$",
"new_config",
"=",
"$",
"config_initializer",
"->",
"initialize",
"(",
")",
";",
"// Replaces config.",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"import",
"(",
"$",
"new_config",
"->",
"export",
"(",
")",
")",
";",
"}"
] |
Sets multisite context by settings site-specific config values.
@param string $site_name
The name of a multisite, e.g., if docroot/sites/example.com is the site,
$site_name would be example.com.
|
[
"Sets",
"multisite",
"context",
"by",
"settings",
"site",
"-",
"specific",
"config",
"values",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/BltTasks.php#L302-L310
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/ConfigSplitCommand.php
|
ConfigSplitCommand.generateConfigSplits
|
public function generateConfigSplits() {
$this->say("This command will generate configuration and directories for the following environment based splits: Local, CI, Dev, Stage, and Prod.");
$default_splits = ['Local', 'CI', 'Dev', 'Stage', 'Prod'];
foreach ($default_splits as $split) {
$this->createSplitConfig($split);
}
}
|
php
|
public function generateConfigSplits() {
$this->say("This command will generate configuration and directories for the following environment based splits: Local, CI, Dev, Stage, and Prod.");
$default_splits = ['Local', 'CI', 'Dev', 'Stage', 'Prod'];
foreach ($default_splits as $split) {
$this->createSplitConfig($split);
}
}
|
[
"public",
"function",
"generateConfigSplits",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"This command will generate configuration and directories for the following environment based splits: Local, CI, Dev, Stage, and Prod.\"",
")",
";",
"$",
"default_splits",
"=",
"[",
"'Local'",
",",
"'CI'",
",",
"'Dev'",
",",
"'Stage'",
",",
"'Prod'",
"]",
";",
"foreach",
"(",
"$",
"default_splits",
"as",
"$",
"split",
")",
"{",
"$",
"this",
"->",
"createSplitConfig",
"(",
"$",
"split",
")",
";",
"}",
"}"
] |
Generates empty config_split splits for the selected environments.
@command recipes:config:init:splits
@aliases rcis splits
|
[
"Generates",
"empty",
"config_split",
"splits",
"for",
"the",
"selected",
"environments",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/ConfigSplitCommand.php#L63-L70
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/ConfigSplitCommand.php
|
ConfigSplitCommand.createSplitConfig
|
protected function createSplitConfig($name) {
$id = strtolower($name);
$split_config_file = $this->configSyncDir . "/config_split.config_split.{$id}.yml";
if (file_exists($split_config_file)) {
$this->say("The config_split file for $name already exists. Skipping.");
}
else {
$uuid = $this->uuidGenerator->generate();
$config = $this->twig->render('config_split.config_split.env.yml.twig', [
'uuid' => $uuid,
'name' => $name,
'id' => $id,
]);
$this->createSplitDir($name);
$this->writeSplitConfig($split_config_file, $config);
}
}
|
php
|
protected function createSplitConfig($name) {
$id = strtolower($name);
$split_config_file = $this->configSyncDir . "/config_split.config_split.{$id}.yml";
if (file_exists($split_config_file)) {
$this->say("The config_split file for $name already exists. Skipping.");
}
else {
$uuid = $this->uuidGenerator->generate();
$config = $this->twig->render('config_split.config_split.env.yml.twig', [
'uuid' => $uuid,
'name' => $name,
'id' => $id,
]);
$this->createSplitDir($name);
$this->writeSplitConfig($split_config_file, $config);
}
}
|
[
"protected",
"function",
"createSplitConfig",
"(",
"$",
"name",
")",
"{",
"$",
"id",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"$",
"split_config_file",
"=",
"$",
"this",
"->",
"configSyncDir",
".",
"\"/config_split.config_split.{$id}.yml\"",
";",
"if",
"(",
"file_exists",
"(",
"$",
"split_config_file",
")",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"The config_split file for $name already exists. Skipping.\"",
")",
";",
"}",
"else",
"{",
"$",
"uuid",
"=",
"$",
"this",
"->",
"uuidGenerator",
"->",
"generate",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"twig",
"->",
"render",
"(",
"'config_split.config_split.env.yml.twig'",
",",
"[",
"'uuid'",
"=>",
"$",
"uuid",
",",
"'name'",
"=>",
"$",
"name",
",",
"'id'",
"=>",
"$",
"id",
",",
"]",
")",
";",
"$",
"this",
"->",
"createSplitDir",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"writeSplitConfig",
"(",
"$",
"split_config_file",
",",
"$",
"config",
")",
";",
"}",
"}"
] |
Create a config_split configuration and directory for the given split.
@param string $name
The name of the split to create.
|
[
"Create",
"a",
"config_split",
"configuration",
"and",
"directory",
"for",
"the",
"given",
"split",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/ConfigSplitCommand.php#L78-L94
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/ConfigSplitCommand.php
|
ConfigSplitCommand.createSplitDir
|
protected function createSplitDir($split) {
$split_dir = $this->configSplitDir . '/' . strtolower($split);
$result = $this->taskFilesystemStack()
->mkdir($split_dir)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to create $split_dir.");
}
if (!file_exists($split_dir . '/README.md')) {
$readme = $this->twig->render('README.md.twig', [
'name' => $split,
]);
file_put_contents($split_dir . '/README.md', $readme);
}
}
|
php
|
protected function createSplitDir($split) {
$split_dir = $this->configSplitDir . '/' . strtolower($split);
$result = $this->taskFilesystemStack()
->mkdir($split_dir)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Unable to create $split_dir.");
}
if (!file_exists($split_dir . '/README.md')) {
$readme = $this->twig->render('README.md.twig', [
'name' => $split,
]);
file_put_contents($split_dir . '/README.md', $readme);
}
}
|
[
"protected",
"function",
"createSplitDir",
"(",
"$",
"split",
")",
"{",
"$",
"split_dir",
"=",
"$",
"this",
"->",
"configSplitDir",
".",
"'/'",
".",
"strtolower",
"(",
"$",
"split",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"mkdir",
"(",
"$",
"split_dir",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to create $split_dir.\"",
")",
";",
"}",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"split_dir",
".",
"'/README.md'",
")",
")",
"{",
"$",
"readme",
"=",
"$",
"this",
"->",
"twig",
"->",
"render",
"(",
"'README.md.twig'",
",",
"[",
"'name'",
"=>",
"$",
"split",
",",
"]",
")",
";",
"file_put_contents",
"(",
"$",
"split_dir",
".",
"'/README.md'",
",",
"$",
"readme",
")",
";",
"}",
"}"
] |
Creates the config directory for the given config_split.
@param string $split
The name of the split.
|
[
"Creates",
"the",
"config",
"directory",
"for",
"the",
"given",
"config_split",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/ConfigSplitCommand.php#L102-L116
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/ConfigSplitCommand.php
|
ConfigSplitCommand.writeSplitConfig
|
protected function writeSplitConfig($file_path, $config) {
$result = $this->taskWriteToFile($file_path)
->text($config)
->run();
if (!$result) {
throw new BltException("Unable to write $file_path.");
}
}
|
php
|
protected function writeSplitConfig($file_path, $config) {
$result = $this->taskWriteToFile($file_path)
->text($config)
->run();
if (!$result) {
throw new BltException("Unable to write $file_path.");
}
}
|
[
"protected",
"function",
"writeSplitConfig",
"(",
"$",
"file_path",
",",
"$",
"config",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"taskWriteToFile",
"(",
"$",
"file_path",
")",
"->",
"text",
"(",
"$",
"config",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to write $file_path.\"",
")",
";",
"}",
"}"
] |
Write the config_split configuration YAML file in the given directory.
@param string $file_path
The path where the file should be written.
@param string $config
The config file contents.
|
[
"Write",
"the",
"config_split",
"configuration",
"YAML",
"file",
"in",
"the",
"given",
"directory",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/ConfigSplitCommand.php#L126-L133
|
train
|
acquia/blt
|
src/Robo/Config/DefaultConfig.php
|
DefaultConfig.populateHelperConfig
|
public function populateHelperConfig() {
$this->set('drush.alias', $this->get('drush.default_alias'));
if (!$this->get('multisites')) {
$this->set('multisites', $this->getSiteDirs());
}
$multisites = $this->get('multisites');
$first_multisite = reset($multisites);
$site = $this->get('site', $first_multisite);
$this->setSite($site);
}
|
php
|
public function populateHelperConfig() {
$this->set('drush.alias', $this->get('drush.default_alias'));
if (!$this->get('multisites')) {
$this->set('multisites', $this->getSiteDirs());
}
$multisites = $this->get('multisites');
$first_multisite = reset($multisites);
$site = $this->get('site', $first_multisite);
$this->setSite($site);
}
|
[
"public",
"function",
"populateHelperConfig",
"(",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"'drush.alias'",
",",
"$",
"this",
"->",
"get",
"(",
"'drush.default_alias'",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"get",
"(",
"'multisites'",
")",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"'multisites'",
",",
"$",
"this",
"->",
"getSiteDirs",
"(",
")",
")",
";",
"}",
"$",
"multisites",
"=",
"$",
"this",
"->",
"get",
"(",
"'multisites'",
")",
";",
"$",
"first_multisite",
"=",
"reset",
"(",
"$",
"multisites",
")",
";",
"$",
"site",
"=",
"$",
"this",
"->",
"get",
"(",
"'site'",
",",
"$",
"first_multisite",
")",
";",
"$",
"this",
"->",
"setSite",
"(",
"$",
"site",
")",
";",
"}"
] |
Populates configuration settings not available during construction.
|
[
"Populates",
"configuration",
"settings",
"not",
"available",
"during",
"construction",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Config/DefaultConfig.php#L53-L64
|
train
|
acquia/blt
|
src/Robo/Config/DefaultConfig.php
|
DefaultConfig.getSiteDirs
|
protected function getSiteDirs() {
$sites_dir = $this->get('docroot') . '/sites';
$sites = [];
// If BLT's template has not yet been rsynced into the project root, it is
// possible that docroot/sites does not exist.
if (!file_exists($sites_dir)) {
return $sites;
}
$finder = new Finder();
$dirs = $finder
->in($sites_dir)
->directories()
->depth('< 1')
->exclude(['g', 'settings'])
->sortByName();
foreach ($dirs->getIterator() as $dir) {
$sites[] = $dir->getRelativePathname();
}
return $sites;
}
|
php
|
protected function getSiteDirs() {
$sites_dir = $this->get('docroot') . '/sites';
$sites = [];
// If BLT's template has not yet been rsynced into the project root, it is
// possible that docroot/sites does not exist.
if (!file_exists($sites_dir)) {
return $sites;
}
$finder = new Finder();
$dirs = $finder
->in($sites_dir)
->directories()
->depth('< 1')
->exclude(['g', 'settings'])
->sortByName();
foreach ($dirs->getIterator() as $dir) {
$sites[] = $dir->getRelativePathname();
}
return $sites;
}
|
[
"protected",
"function",
"getSiteDirs",
"(",
")",
"{",
"$",
"sites_dir",
"=",
"$",
"this",
"->",
"get",
"(",
"'docroot'",
")",
".",
"'/sites'",
";",
"$",
"sites",
"=",
"[",
"]",
";",
"// If BLT's template has not yet been rsynced into the project root, it is",
"// possible that docroot/sites does not exist.",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"sites_dir",
")",
")",
"{",
"return",
"$",
"sites",
";",
"}",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
"$",
"dirs",
"=",
"$",
"finder",
"->",
"in",
"(",
"$",
"sites_dir",
")",
"->",
"directories",
"(",
")",
"->",
"depth",
"(",
"'< 1'",
")",
"->",
"exclude",
"(",
"[",
"'g'",
",",
"'settings'",
"]",
")",
"->",
"sortByName",
"(",
")",
";",
"foreach",
"(",
"$",
"dirs",
"->",
"getIterator",
"(",
")",
"as",
"$",
"dir",
")",
"{",
"$",
"sites",
"[",
"]",
"=",
"$",
"dir",
"->",
"getRelativePathname",
"(",
")",
";",
"}",
"return",
"$",
"sites",
";",
"}"
] |
Gets an array of sites for the Drupal application.
I.e., sites under docroot/sites, not including acsf 'g' pseudo-site and
'settings' directory globbed in blt.settings.php.
@return array
An array of sites.
|
[
"Gets",
"an",
"array",
"of",
"sites",
"for",
"the",
"Drupal",
"application",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Config/DefaultConfig.php#L86-L108
|
train
|
acquia/blt
|
src/Robo/Commands/Blt/ExamplesCommand.php
|
ExamplesCommand.init
|
public function init() {
$result = $this->taskFilesystemStack()
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Commands/ExampleCommands.php',
$this->getConfigValue('repo.root') . '/blt/src/Blt/Plugin/Commands/ExampleCommands.php', FALSE)
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Test/ExampleTest.php',
$this->getConfigValue('repo.root') . '/tests/phpunit/ExampleTest.php', FALSE)
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Test/Examples.feature',
$this->getConfigValue('repo.root') . '/tests/behat/features/Examples.feature', FALSE)
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Filesets.php',
$this->getConfigValue('repo.root') . '/blt/src/Filesets.php', FALSE)
->stopOnFail()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Could not copy example files into the repository root.");
}
$this->say("<info>Example commands and hooks were copied to your repository root.</info>");
}
|
php
|
public function init() {
$result = $this->taskFilesystemStack()
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Commands/ExampleCommands.php',
$this->getConfigValue('repo.root') . '/blt/src/Blt/Plugin/Commands/ExampleCommands.php', FALSE)
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Test/ExampleTest.php',
$this->getConfigValue('repo.root') . '/tests/phpunit/ExampleTest.php', FALSE)
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Test/Examples.feature',
$this->getConfigValue('repo.root') . '/tests/behat/features/Examples.feature', FALSE)
->copy(
$this->getConfigValue('blt.root') . '/scripts/blt/examples/Filesets.php',
$this->getConfigValue('repo.root') . '/blt/src/Filesets.php', FALSE)
->stopOnFail()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();
if (!$result->wasSuccessful()) {
throw new BltException("Could not copy example files into the repository root.");
}
$this->say("<info>Example commands and hooks were copied to your repository root.</info>");
}
|
[
"public",
"function",
"init",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.root'",
")",
".",
"'/scripts/blt/examples/Commands/ExampleCommands.php'",
",",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/blt/src/Blt/Plugin/Commands/ExampleCommands.php'",
",",
"FALSE",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.root'",
")",
".",
"'/scripts/blt/examples/Test/ExampleTest.php'",
",",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/tests/phpunit/ExampleTest.php'",
",",
"FALSE",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.root'",
")",
".",
"'/scripts/blt/examples/Test/Examples.feature'",
",",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/tests/behat/features/Examples.feature'",
",",
"FALSE",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.root'",
")",
".",
"'/scripts/blt/examples/Filesets.php'",
",",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/blt/src/Filesets.php'",
",",
"FALSE",
")",
"->",
"stopOnFail",
"(",
")",
"->",
"setVerbosityThreshold",
"(",
"VerbosityThresholdInterface",
"::",
"VERBOSITY_VERBOSE",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Could not copy example files into the repository root.\"",
")",
";",
"}",
"$",
"this",
"->",
"say",
"(",
"\"<info>Example commands and hooks were copied to your repository root.</info>\"",
")",
";",
"}"
] |
Generates example files for writing custom commands and hooks.
@command recipes:blt:init:command
@aliases rbic examples:init
|
[
"Generates",
"example",
"files",
"for",
"writing",
"custom",
"commands",
"and",
"hooks",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Blt/ExamplesCommand.php#L21-L44
|
train
|
acquia/blt
|
src/Robo/Commands/Doctor/SimpleSamlPhpCheck.php
|
SimpleSamlPhpCheck.checkSimpleSamlPhp
|
protected function checkSimpleSamlPhp() {
if ($this->getConfig()->has('simplesamlphp')) {
$lib_root = $this->getConfigValue('repo.root') . '/vendor/simplesamlphp/simplesamlphp';
$config_root = $this->getConfigValue('repo.root') . '/simplesamlphp';
// Check for the configurable files in docroot/simplesamlphp.
if (!file_exists($config_root)) {
$this->logProblem(__FUNCTION__, [
"Simplesamlphp config directory is missing. $config_root",
"",
"Run `blt simplesamlphp:config:init` to create a config directory.",
], 'error');
}
// Check for the SimpleSAMLphp library in the vendor directory.
if (!file_exists($lib_root)) {
$this->logProblem(__FUNCTION__, [
"The SimpleSAMLphp library was not found in the vendor directory.",
" Run `blt simplesamlphp:config:init` to add the library as a dependency.",
], 'error');
}
// Compare config files in $config_root and $lib_root.
if (file_exists($lib_root) && file_exists($config_root)) {
$config_files = [
'/config/config.php',
'/config/authsources.php',
'/metadata/saml20-idp-remote.php',
];
foreach ($config_files as $config_file) {
if (file_exists($lib_root . $config_file) && file_exists($config_root . $config_file)) {
$config_file_content = file_get_contents($config_root . $config_file);
$lib_file_content = file_get_contents($lib_root . $config_file);
if (strcmp($config_file_content, $lib_file_content) !== 0) {
$this->logProblem(__FUNCTION__, [
"The configuration file: $config_file in $config_root does not match the one in $lib_root.",
" Run `blt source:build:simplesamlphp-config` to copy the files from the repo root to the library.",
], 'error');
}
}
else {
$lib_file_path = $lib_root . $config_file;
$this->logProblem(__FUNCTION__, [
"$lib_file_path is missing. Run `blt source:build:simplesamlphp-config`.",
], 'error');
}
}
}
// Check that the library's www dirctory is symlinked in the docroot.
if (!file_exists($this->getConfigValue('docroot') . '/simplesaml')) {
$this->logProblem(__FUNCTION__, [
"The symlink to the SimpleSAMLphp library is missing from your docroot.",
" Run `blt recipes:simplesamlphp:init`",
], 'error');
}
// Check that access to the symlinked directory is not blocked.
$htaccess = file_get_contents($this->getConfigValue('docroot') . '/.htaccess');
if (!strstr($htaccess, 'simplesaml')) {
$this->logProblem(__FUNCTION__, [
"Access to {$this->getConfigValue('docroot')}/simplesaml is blocked by .htaccess",
" Add the snippet in simplesamlphp-setup.md readme to your .htaccess file.",
], 'error');
}
}
}
|
php
|
protected function checkSimpleSamlPhp() {
if ($this->getConfig()->has('simplesamlphp')) {
$lib_root = $this->getConfigValue('repo.root') . '/vendor/simplesamlphp/simplesamlphp';
$config_root = $this->getConfigValue('repo.root') . '/simplesamlphp';
// Check for the configurable files in docroot/simplesamlphp.
if (!file_exists($config_root)) {
$this->logProblem(__FUNCTION__, [
"Simplesamlphp config directory is missing. $config_root",
"",
"Run `blt simplesamlphp:config:init` to create a config directory.",
], 'error');
}
// Check for the SimpleSAMLphp library in the vendor directory.
if (!file_exists($lib_root)) {
$this->logProblem(__FUNCTION__, [
"The SimpleSAMLphp library was not found in the vendor directory.",
" Run `blt simplesamlphp:config:init` to add the library as a dependency.",
], 'error');
}
// Compare config files in $config_root and $lib_root.
if (file_exists($lib_root) && file_exists($config_root)) {
$config_files = [
'/config/config.php',
'/config/authsources.php',
'/metadata/saml20-idp-remote.php',
];
foreach ($config_files as $config_file) {
if (file_exists($lib_root . $config_file) && file_exists($config_root . $config_file)) {
$config_file_content = file_get_contents($config_root . $config_file);
$lib_file_content = file_get_contents($lib_root . $config_file);
if (strcmp($config_file_content, $lib_file_content) !== 0) {
$this->logProblem(__FUNCTION__, [
"The configuration file: $config_file in $config_root does not match the one in $lib_root.",
" Run `blt source:build:simplesamlphp-config` to copy the files from the repo root to the library.",
], 'error');
}
}
else {
$lib_file_path = $lib_root . $config_file;
$this->logProblem(__FUNCTION__, [
"$lib_file_path is missing. Run `blt source:build:simplesamlphp-config`.",
], 'error');
}
}
}
// Check that the library's www dirctory is symlinked in the docroot.
if (!file_exists($this->getConfigValue('docroot') . '/simplesaml')) {
$this->logProblem(__FUNCTION__, [
"The symlink to the SimpleSAMLphp library is missing from your docroot.",
" Run `blt recipes:simplesamlphp:init`",
], 'error');
}
// Check that access to the symlinked directory is not blocked.
$htaccess = file_get_contents($this->getConfigValue('docroot') . '/.htaccess');
if (!strstr($htaccess, 'simplesaml')) {
$this->logProblem(__FUNCTION__, [
"Access to {$this->getConfigValue('docroot')}/simplesaml is blocked by .htaccess",
" Add the snippet in simplesamlphp-setup.md readme to your .htaccess file.",
], 'error');
}
}
}
|
[
"protected",
"function",
"checkSimpleSamlPhp",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"has",
"(",
"'simplesamlphp'",
")",
")",
"{",
"$",
"lib_root",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/vendor/simplesamlphp/simplesamlphp'",
";",
"$",
"config_root",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/simplesamlphp'",
";",
"// Check for the configurable files in docroot/simplesamlphp.",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"config_root",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"Simplesamlphp config directory is missing. $config_root\"",
",",
"\"\"",
",",
"\"Run `blt simplesamlphp:config:init` to create a config directory.\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"// Check for the SimpleSAMLphp library in the vendor directory.",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"lib_root",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"The SimpleSAMLphp library was not found in the vendor directory.\"",
",",
"\" Run `blt simplesamlphp:config:init` to add the library as a dependency.\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"// Compare config files in $config_root and $lib_root.",
"if",
"(",
"file_exists",
"(",
"$",
"lib_root",
")",
"&&",
"file_exists",
"(",
"$",
"config_root",
")",
")",
"{",
"$",
"config_files",
"=",
"[",
"'/config/config.php'",
",",
"'/config/authsources.php'",
",",
"'/metadata/saml20-idp-remote.php'",
",",
"]",
";",
"foreach",
"(",
"$",
"config_files",
"as",
"$",
"config_file",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"lib_root",
".",
"$",
"config_file",
")",
"&&",
"file_exists",
"(",
"$",
"config_root",
".",
"$",
"config_file",
")",
")",
"{",
"$",
"config_file_content",
"=",
"file_get_contents",
"(",
"$",
"config_root",
".",
"$",
"config_file",
")",
";",
"$",
"lib_file_content",
"=",
"file_get_contents",
"(",
"$",
"lib_root",
".",
"$",
"config_file",
")",
";",
"if",
"(",
"strcmp",
"(",
"$",
"config_file_content",
",",
"$",
"lib_file_content",
")",
"!==",
"0",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"The configuration file: $config_file in $config_root does not match the one in $lib_root.\"",
",",
"\" Run `blt source:build:simplesamlphp-config` to copy the files from the repo root to the library.\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"}",
"else",
"{",
"$",
"lib_file_path",
"=",
"$",
"lib_root",
".",
"$",
"config_file",
";",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"$lib_file_path is missing. Run `blt source:build:simplesamlphp-config`.\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"}",
"}",
"// Check that the library's www dirctory is symlinked in the docroot.",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'docroot'",
")",
".",
"'/simplesaml'",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"The symlink to the SimpleSAMLphp library is missing from your docroot.\"",
",",
"\" Run `blt recipes:simplesamlphp:init`\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"// Check that access to the symlinked directory is not blocked.",
"$",
"htaccess",
"=",
"file_get_contents",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'docroot'",
")",
".",
"'/.htaccess'",
")",
";",
"if",
"(",
"!",
"strstr",
"(",
"$",
"htaccess",
",",
"'simplesaml'",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
",",
"[",
"\"Access to {$this->getConfigValue('docroot')}/simplesaml is blocked by .htaccess\"",
",",
"\" Add the snippet in simplesamlphp-setup.md readme to your .htaccess file.\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"}",
"}"
] |
Performs a high level check of SimpleSAMLphp installation.
|
[
"Performs",
"a",
"high",
"level",
"check",
"of",
"SimpleSAMLphp",
"installation",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Doctor/SimpleSamlPhpCheck.php#L17-L83
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.generateAliasesAcquia
|
public function generateAliasesAcquia() {
$this->cloudConfDir = $_SERVER['HOME'] . '/.acquia';
$this->setAppId();
$this->cloudConfFileName = 'cloud_api.conf';
$this->cloudConfFilePath = $this->cloudConfDir . '/' . $this->cloudConfFileName;
$this->siteAliasDir = $this->getConfigValue('drush.alias-dir');
$cloudApiConfig = $this->loadCloudApiConfig();
$this->setCloudApiClient($cloudApiConfig['key'], $cloudApiConfig['secret']);
$this->say("<info>Gathering site info from Acquia Cloud.</info>");
$site = $this->cloudApiClient->application($this->appId);
$error = FALSE;
try {
$this->getSiteAliases($site);
}
catch (\Exception $e) {
$error = TRUE;
$this->logger->error("Did not write aliases for $site->name. Error: " . $e->getMessage());
}
if (!$error) {
$this->say("<info>Aliases were written, type 'drush sa' to see them.</info>");
}
}
|
php
|
public function generateAliasesAcquia() {
$this->cloudConfDir = $_SERVER['HOME'] . '/.acquia';
$this->setAppId();
$this->cloudConfFileName = 'cloud_api.conf';
$this->cloudConfFilePath = $this->cloudConfDir . '/' . $this->cloudConfFileName;
$this->siteAliasDir = $this->getConfigValue('drush.alias-dir');
$cloudApiConfig = $this->loadCloudApiConfig();
$this->setCloudApiClient($cloudApiConfig['key'], $cloudApiConfig['secret']);
$this->say("<info>Gathering site info from Acquia Cloud.</info>");
$site = $this->cloudApiClient->application($this->appId);
$error = FALSE;
try {
$this->getSiteAliases($site);
}
catch (\Exception $e) {
$error = TRUE;
$this->logger->error("Did not write aliases for $site->name. Error: " . $e->getMessage());
}
if (!$error) {
$this->say("<info>Aliases were written, type 'drush sa' to see them.</info>");
}
}
|
[
"public",
"function",
"generateAliasesAcquia",
"(",
")",
"{",
"$",
"this",
"->",
"cloudConfDir",
"=",
"$",
"_SERVER",
"[",
"'HOME'",
"]",
".",
"'/.acquia'",
";",
"$",
"this",
"->",
"setAppId",
"(",
")",
";",
"$",
"this",
"->",
"cloudConfFileName",
"=",
"'cloud_api.conf'",
";",
"$",
"this",
"->",
"cloudConfFilePath",
"=",
"$",
"this",
"->",
"cloudConfDir",
".",
"'/'",
".",
"$",
"this",
"->",
"cloudConfFileName",
";",
"$",
"this",
"->",
"siteAliasDir",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'drush.alias-dir'",
")",
";",
"$",
"cloudApiConfig",
"=",
"$",
"this",
"->",
"loadCloudApiConfig",
"(",
")",
";",
"$",
"this",
"->",
"setCloudApiClient",
"(",
"$",
"cloudApiConfig",
"[",
"'key'",
"]",
",",
"$",
"cloudApiConfig",
"[",
"'secret'",
"]",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"<info>Gathering site info from Acquia Cloud.</info>\"",
")",
";",
"$",
"site",
"=",
"$",
"this",
"->",
"cloudApiClient",
"->",
"application",
"(",
"$",
"this",
"->",
"appId",
")",
";",
"$",
"error",
"=",
"FALSE",
";",
"try",
"{",
"$",
"this",
"->",
"getSiteAliases",
"(",
"$",
"site",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"error",
"=",
"TRUE",
";",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"\"Did not write aliases for $site->name. Error: \"",
".",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"$",
"error",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"<info>Aliases were written, type 'drush sa' to see them.</info>\"",
")",
";",
"}",
"}"
] |
Generates new Acquia site aliases for Drush.
@command recipes:aliases:init:acquia
@aliases raia aliases
|
[
"Generates",
"new",
"Acquia",
"site",
"aliases",
"for",
"Drush",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L54-L78
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.setAppId
|
protected function setAppId() {
if ($app_id = $this->getConfigValue('cloud.appId')) {
$this->appId = $app_id;
}
else {
$this->say("<info>To generate an alias for the Acquia Cloud, BLT require's your Acquia Cloud application ID.</info>");
$this->say("<info>See https://docs.acquia.com/acquia-cloud/manage/applications.</info>");
$this->appId = $this->askRequired('Please enter your Acquia Cloud application ID');
$this->writeAppConfig($this->appId);
}
}
|
php
|
protected function setAppId() {
if ($app_id = $this->getConfigValue('cloud.appId')) {
$this->appId = $app_id;
}
else {
$this->say("<info>To generate an alias for the Acquia Cloud, BLT require's your Acquia Cloud application ID.</info>");
$this->say("<info>See https://docs.acquia.com/acquia-cloud/manage/applications.</info>");
$this->appId = $this->askRequired('Please enter your Acquia Cloud application ID');
$this->writeAppConfig($this->appId);
}
}
|
[
"protected",
"function",
"setAppId",
"(",
")",
"{",
"if",
"(",
"$",
"app_id",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'cloud.appId'",
")",
")",
"{",
"$",
"this",
"->",
"appId",
"=",
"$",
"app_id",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"say",
"(",
"\"<info>To generate an alias for the Acquia Cloud, BLT require's your Acquia Cloud application ID.</info>\"",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"<info>See https://docs.acquia.com/acquia-cloud/manage/applications.</info>\"",
")",
";",
"$",
"this",
"->",
"appId",
"=",
"$",
"this",
"->",
"askRequired",
"(",
"'Please enter your Acquia Cloud application ID'",
")",
";",
"$",
"this",
"->",
"writeAppConfig",
"(",
"$",
"this",
"->",
"appId",
")",
";",
"}",
"}"
] |
Sets the Acquia application ID from config and prompt.
|
[
"Sets",
"the",
"Acquia",
"application",
"ID",
"from",
"config",
"and",
"prompt",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L83-L93
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.writeAppConfig
|
protected function writeAppConfig($app_id) {
$project_yml = $this->getConfigValue('blt.config-files.project');
$this->say("Updating ${project_yml}...");
$project_config = YamlMunge::parseFile($project_yml);
$project_config['cloud']['appId'] = $app_id;
try {
YamlMunge::writeFile($project_yml, $project_config);
}
catch (\Exception $e) {
throw new BltException("Unable to update $project_yml.");
}
}
|
php
|
protected function writeAppConfig($app_id) {
$project_yml = $this->getConfigValue('blt.config-files.project');
$this->say("Updating ${project_yml}...");
$project_config = YamlMunge::parseFile($project_yml);
$project_config['cloud']['appId'] = $app_id;
try {
YamlMunge::writeFile($project_yml, $project_config);
}
catch (\Exception $e) {
throw new BltException("Unable to update $project_yml.");
}
}
|
[
"protected",
"function",
"writeAppConfig",
"(",
"$",
"app_id",
")",
"{",
"$",
"project_yml",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.config-files.project'",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Updating ${project_yml}...\"",
")",
";",
"$",
"project_config",
"=",
"YamlMunge",
"::",
"parseFile",
"(",
"$",
"project_yml",
")",
";",
"$",
"project_config",
"[",
"'cloud'",
"]",
"[",
"'appId'",
"]",
"=",
"$",
"app_id",
";",
"try",
"{",
"YamlMunge",
"::",
"writeFile",
"(",
"$",
"project_yml",
",",
"$",
"project_config",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"BltException",
"(",
"\"Unable to update $project_yml.\"",
")",
";",
"}",
"}"
] |
Sets appId value in blt.yml to disable interative prompt.
@param string $app_id
The Acquia Cloud application UUID.
@throws \Acquia\Blt\Robo\Exceptions\BltException
|
[
"Sets",
"appId",
"value",
"in",
"blt",
".",
"yml",
"to",
"disable",
"interative",
"prompt",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L102-L114
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.askForCloudApiCredentials
|
protected function askForCloudApiCredentials() {
$this->say("You may generate new API tokens at <comment>https://cloud.acquia.com/app/profile/tokens</comment>");
$key = $this->askRequired('Please enter your Acquia cloud API key:');
$secret = $this->askRequired('Please enter your Acquia cloud API secret:');
do {
$this->setCloudApiClient($key, $secret);
$cloud_api_client = $this->getCloudApiClient();
} while (!$cloud_api_client);
$config = array(
'key' => $key,
'secret' => $secret,
);
$this->writeCloudApiConfig($config);
return $config;
}
|
php
|
protected function askForCloudApiCredentials() {
$this->say("You may generate new API tokens at <comment>https://cloud.acquia.com/app/profile/tokens</comment>");
$key = $this->askRequired('Please enter your Acquia cloud API key:');
$secret = $this->askRequired('Please enter your Acquia cloud API secret:');
do {
$this->setCloudApiClient($key, $secret);
$cloud_api_client = $this->getCloudApiClient();
} while (!$cloud_api_client);
$config = array(
'key' => $key,
'secret' => $secret,
);
$this->writeCloudApiConfig($config);
return $config;
}
|
[
"protected",
"function",
"askForCloudApiCredentials",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"You may generate new API tokens at <comment>https://cloud.acquia.com/app/profile/tokens</comment>\"",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"askRequired",
"(",
"'Please enter your Acquia cloud API key:'",
")",
";",
"$",
"secret",
"=",
"$",
"this",
"->",
"askRequired",
"(",
"'Please enter your Acquia cloud API secret:'",
")",
";",
"do",
"{",
"$",
"this",
"->",
"setCloudApiClient",
"(",
"$",
"key",
",",
"$",
"secret",
")",
";",
"$",
"cloud_api_client",
"=",
"$",
"this",
"->",
"getCloudApiClient",
"(",
")",
";",
"}",
"while",
"(",
"!",
"$",
"cloud_api_client",
")",
";",
"$",
"config",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'secret'",
"=>",
"$",
"secret",
",",
")",
";",
"$",
"this",
"->",
"writeCloudApiConfig",
"(",
"$",
"config",
")",
";",
"return",
"$",
"config",
";",
"}"
] |
Interactive prompt to get Cloud API credentials.
@return array
Returns credentials as array on success.
|
[
"Interactive",
"prompt",
"to",
"get",
"Cloud",
"API",
"credentials",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L150-L164
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.writeCloudApiConfig
|
protected function writeCloudApiConfig(array $config) {
if (!is_dir($this->cloudConfDir)) {
mkdir($this->cloudConfDir);
}
file_put_contents($this->cloudConfFilePath, json_encode($config));
$this->say("Credentials were written to {$this->cloudConfFilePath}.");
}
|
php
|
protected function writeCloudApiConfig(array $config) {
if (!is_dir($this->cloudConfDir)) {
mkdir($this->cloudConfDir);
}
file_put_contents($this->cloudConfFilePath, json_encode($config));
$this->say("Credentials were written to {$this->cloudConfFilePath}.");
}
|
[
"protected",
"function",
"writeCloudApiConfig",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"cloudConfDir",
")",
")",
"{",
"mkdir",
"(",
"$",
"this",
"->",
"cloudConfDir",
")",
";",
"}",
"file_put_contents",
"(",
"$",
"this",
"->",
"cloudConfFilePath",
",",
"json_encode",
"(",
"$",
"config",
")",
")",
";",
"$",
"this",
"->",
"say",
"(",
"\"Credentials were written to {$this->cloudConfFilePath}.\"",
")",
";",
"}"
] |
Writes configuration to local file.
@param array $config
An array of CloudAPI configuraton.
|
[
"Writes",
"configuration",
"to",
"local",
"file",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L172-L178
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.setCloudApiClient
|
protected function setCloudApiClient($key, $secret) {
try {
$connector = new Connector(array(
'key' => $key,
'secret' => $secret,
));
$cloud_api = Client::factory($connector);
// We must call some method on the client to test authentication.
$cloud_api->applications();
$this->cloudApiClient = $cloud_api;
return $cloud_api;
}
catch (\Exception $e) {
// @todo this is being thrown after first auth. still works? check out.
$this->logger->error('Failed to authenticate with Acquia Cloud API.');
$this->logger->error('Exception was thrown: ' . $e->getMessage());
return NULL;
}
}
|
php
|
protected function setCloudApiClient($key, $secret) {
try {
$connector = new Connector(array(
'key' => $key,
'secret' => $secret,
));
$cloud_api = Client::factory($connector);
// We must call some method on the client to test authentication.
$cloud_api->applications();
$this->cloudApiClient = $cloud_api;
return $cloud_api;
}
catch (\Exception $e) {
// @todo this is being thrown after first auth. still works? check out.
$this->logger->error('Failed to authenticate with Acquia Cloud API.');
$this->logger->error('Exception was thrown: ' . $e->getMessage());
return NULL;
}
}
|
[
"protected",
"function",
"setCloudApiClient",
"(",
"$",
"key",
",",
"$",
"secret",
")",
"{",
"try",
"{",
"$",
"connector",
"=",
"new",
"Connector",
"(",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'secret'",
"=>",
"$",
"secret",
",",
")",
")",
";",
"$",
"cloud_api",
"=",
"Client",
"::",
"factory",
"(",
"$",
"connector",
")",
";",
"// We must call some method on the client to test authentication.",
"$",
"cloud_api",
"->",
"applications",
"(",
")",
";",
"$",
"this",
"->",
"cloudApiClient",
"=",
"$",
"cloud_api",
";",
"return",
"$",
"cloud_api",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"// @todo this is being thrown after first auth. still works? check out.",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"'Failed to authenticate with Acquia Cloud API.'",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"'Exception was thrown: '",
".",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"NULL",
";",
"}",
"}"
] |
Tests CloudAPI client authentication credentials.
@param string $key
The Acquia token public key.
@param string $secret
The Acquia token secret key.
@return array
Returns credentials as array on success, or NULL on failure.
|
[
"Tests",
"CloudAPI",
"client",
"authentication",
"credentials",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L191-L209
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.getAliases
|
protected function getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID) {
$alias = array();
// Skip wildcard domains.
$skip_site = FALSE;
if (strpos($uri, ':*') !== FALSE) {
$skip_site = TRUE;
}
if (!$skip_site) {
$docroot = '/var/www/html/' . $remoteUser . '/docroot';
$alias[$envName]['uri'] = $uri;
$alias[$envName]['host'] = $remoteHost;
$alias[$envName]['options'] = [];
$alias[$envName]['paths'] = ['dump-dir' => '/mnt/tmp'];
$alias[$envName]['root'] = $docroot;
$alias[$envName]['user'] = $remoteUser;
$alias[$envName]['ssh'] = ['options' => '-p 22'];
return $alias;
}
}
|
php
|
protected function getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID) {
$alias = array();
// Skip wildcard domains.
$skip_site = FALSE;
if (strpos($uri, ':*') !== FALSE) {
$skip_site = TRUE;
}
if (!$skip_site) {
$docroot = '/var/www/html/' . $remoteUser . '/docroot';
$alias[$envName]['uri'] = $uri;
$alias[$envName]['host'] = $remoteHost;
$alias[$envName]['options'] = [];
$alias[$envName]['paths'] = ['dump-dir' => '/mnt/tmp'];
$alias[$envName]['root'] = $docroot;
$alias[$envName]['user'] = $remoteUser;
$alias[$envName]['ssh'] = ['options' => '-p 22'];
return $alias;
}
}
|
[
"protected",
"function",
"getAliases",
"(",
"$",
"uri",
",",
"$",
"envName",
",",
"$",
"remoteHost",
",",
"$",
"remoteUser",
",",
"$",
"siteID",
")",
"{",
"$",
"alias",
"=",
"array",
"(",
")",
";",
"// Skip wildcard domains.",
"$",
"skip_site",
"=",
"FALSE",
";",
"if",
"(",
"strpos",
"(",
"$",
"uri",
",",
"':*'",
")",
"!==",
"FALSE",
")",
"{",
"$",
"skip_site",
"=",
"TRUE",
";",
"}",
"if",
"(",
"!",
"$",
"skip_site",
")",
"{",
"$",
"docroot",
"=",
"'/var/www/html/'",
".",
"$",
"remoteUser",
".",
"'/docroot'",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'uri'",
"]",
"=",
"$",
"uri",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'host'",
"]",
"=",
"$",
"remoteHost",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'options'",
"]",
"=",
"[",
"]",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'paths'",
"]",
"=",
"[",
"'dump-dir'",
"=>",
"'/mnt/tmp'",
"]",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'root'",
"]",
"=",
"$",
"docroot",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'user'",
"]",
"=",
"$",
"remoteUser",
";",
"$",
"alias",
"[",
"$",
"envName",
"]",
"[",
"'ssh'",
"]",
"=",
"[",
"'options'",
"=>",
"'-p 22'",
"]",
";",
"return",
"$",
"alias",
";",
"}",
"}"
] |
Generates a site alias for valid domains.
@param string $uri
The unique site url.
@param string $envName
The current environment.
@param string $remoteHost
The remote host.
@param string $remoteUser
The remote user.
@param string $siteID
The siteID / group.
@return array
The full alias for this site.
|
[
"Generates",
"a",
"site",
"alias",
"for",
"valid",
"domains",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L325-L346
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.getSitesJson
|
protected function getSitesJson($sshFull, $remoteUser) {
$this->say('Getting ACSF sites.json information...');
$result = $this->taskRsync()
->fromPath('/mnt/files/' . $remoteUser . '/files-private/sites.json')
->fromHost($sshFull)
->toPath($this->cloudConfDir)
->remoteShell('ssh -A -p 22')
->run();
if (!$result->wasSuccessful()) {
throw new \Exception("Unable to rsync ACSF sites.json");
}
$fullPath = $this->cloudConfDir . '/sites.json';
$response_body = file_get_contents($fullPath);
$sites_json = json_decode($response_body, TRUE);
return $sites_json;
}
|
php
|
protected function getSitesJson($sshFull, $remoteUser) {
$this->say('Getting ACSF sites.json information...');
$result = $this->taskRsync()
->fromPath('/mnt/files/' . $remoteUser . '/files-private/sites.json')
->fromHost($sshFull)
->toPath($this->cloudConfDir)
->remoteShell('ssh -A -p 22')
->run();
if (!$result->wasSuccessful()) {
throw new \Exception("Unable to rsync ACSF sites.json");
}
$fullPath = $this->cloudConfDir . '/sites.json';
$response_body = file_get_contents($fullPath);
$sites_json = json_decode($response_body, TRUE);
return $sites_json;
}
|
[
"protected",
"function",
"getSitesJson",
"(",
"$",
"sshFull",
",",
"$",
"remoteUser",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"'Getting ACSF sites.json information...'",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"taskRsync",
"(",
")",
"->",
"fromPath",
"(",
"'/mnt/files/'",
".",
"$",
"remoteUser",
".",
"'/files-private/sites.json'",
")",
"->",
"fromHost",
"(",
"$",
"sshFull",
")",
"->",
"toPath",
"(",
"$",
"this",
"->",
"cloudConfDir",
")",
"->",
"remoteShell",
"(",
"'ssh -A -p 22'",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"wasSuccessful",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Unable to rsync ACSF sites.json\"",
")",
";",
"}",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"cloudConfDir",
".",
"'/sites.json'",
";",
"$",
"response_body",
"=",
"file_get_contents",
"(",
"$",
"fullPath",
")",
";",
"$",
"sites_json",
"=",
"json_decode",
"(",
"$",
"response_body",
",",
"TRUE",
")",
";",
"return",
"$",
"sites_json",
";",
"}"
] |
Gets ACSF sites info without secondary API calls or Drupal bootstrap.
@param string $sshFull
The full ssh connection string for this environment.
@param string $remoteUser
The site.env remoteUser string used in the remote private files path.
@return array
An array of ACSF site data for the current environment.
|
[
"Gets",
"ACSF",
"sites",
"info",
"without",
"secondary",
"API",
"calls",
"or",
"Drupal",
"bootstrap",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L359-L380
|
train
|
acquia/blt
|
src/Robo/Commands/Generate/AliasesCommand.php
|
AliasesCommand.writeSiteAliases
|
protected function writeSiteAliases($site_id, array $aliases) {
if (!is_dir($this->siteAliasDir)) {
mkdir($this->siteAliasDir);
}
$filePath = $this->siteAliasDir . '/' . $site_id . '.site.yml';
if (file_exists($filePath)) {
if (!$this->confirm("File $filePath already exists and will be overwritten. Continue?")) {
throw new \Exception("Aborted at user request");
}
}
file_put_contents($filePath, Yaml::dump($aliases));
return $filePath;
}
|
php
|
protected function writeSiteAliases($site_id, array $aliases) {
if (!is_dir($this->siteAliasDir)) {
mkdir($this->siteAliasDir);
}
$filePath = $this->siteAliasDir . '/' . $site_id . '.site.yml';
if (file_exists($filePath)) {
if (!$this->confirm("File $filePath already exists and will be overwritten. Continue?")) {
throw new \Exception("Aborted at user request");
}
}
file_put_contents($filePath, Yaml::dump($aliases));
return $filePath;
}
|
[
"protected",
"function",
"writeSiteAliases",
"(",
"$",
"site_id",
",",
"array",
"$",
"aliases",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"siteAliasDir",
")",
")",
"{",
"mkdir",
"(",
"$",
"this",
"->",
"siteAliasDir",
")",
";",
"}",
"$",
"filePath",
"=",
"$",
"this",
"->",
"siteAliasDir",
".",
"'/'",
".",
"$",
"site_id",
".",
"'.site.yml'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"filePath",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirm",
"(",
"\"File $filePath already exists and will be overwritten. Continue?\"",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Aborted at user request\"",
")",
";",
"}",
"}",
"file_put_contents",
"(",
"$",
"filePath",
",",
"Yaml",
"::",
"dump",
"(",
"$",
"aliases",
")",
")",
";",
"return",
"$",
"filePath",
";",
"}"
] |
Writes site aliases to disk.
@param string $site_id
The siteID or alias group.
@param array $aliases
The alias array for this site group.
@return string
The alias site group file path.
@throws \Exception
|
[
"Writes",
"site",
"aliases",
"to",
"disk",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Generate/AliasesCommand.php#L395-L409
|
train
|
acquia/blt
|
src/Robo/Commands/Setup/CloudHooksCommand.php
|
CloudHooksCommand.copy
|
public function copy() {
$destination = $this->getConfigValue('repo.root') . '/hooks';
$this->say("Copying default Acquia cloud hooks into $destination...");
// This WILL overwrite files is source files are newer.
$result = $this->taskCopyDir([
$this->getConfigValue('blt.root') . '/scripts/cloud-hooks/hooks' => $destination,
])
->run();
$this->taskFilesystemStack()
->chmod($destination, 0755, 0000, TRUE)
->run();
return $result;
}
|
php
|
public function copy() {
$destination = $this->getConfigValue('repo.root') . '/hooks';
$this->say("Copying default Acquia cloud hooks into $destination...");
// This WILL overwrite files is source files are newer.
$result = $this->taskCopyDir([
$this->getConfigValue('blt.root') . '/scripts/cloud-hooks/hooks' => $destination,
])
->run();
$this->taskFilesystemStack()
->chmod($destination, 0755, 0000, TRUE)
->run();
return $result;
}
|
[
"public",
"function",
"copy",
"(",
")",
"{",
"$",
"destination",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'repo.root'",
")",
".",
"'/hooks'",
";",
"$",
"this",
"->",
"say",
"(",
"\"Copying default Acquia cloud hooks into $destination...\"",
")",
";",
"// This WILL overwrite files is source files are newer.",
"$",
"result",
"=",
"$",
"this",
"->",
"taskCopyDir",
"(",
"[",
"$",
"this",
"->",
"getConfigValue",
"(",
"'blt.root'",
")",
".",
"'/scripts/cloud-hooks/hooks'",
"=>",
"$",
"destination",
",",
"]",
")",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"chmod",
"(",
"$",
"destination",
",",
"0755",
",",
"0000",
",",
"TRUE",
")",
"->",
"run",
"(",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
Installs Acquia cloud hooks.
@command recipes:cloud-hooks:init
@aliases rchi setup:cloud-hooks
|
[
"Installs",
"Acquia",
"cloud",
"hooks",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Setup/CloudHooksCommand.php#L18-L31
|
train
|
acquia/blt
|
src/Robo/Commands/Doctor/DrupalVmCheck.php
|
DrupalVmCheck.checkDrupalVm
|
protected function checkDrupalVm() {
$drupal_vm_config_file = $this->getConfigValue('vm.config');
if (!file_exists($drupal_vm_config_file)) {
$this->logProblem(__FUNCTION__ . ':init', "You have DrupalVM initialized, but $drupal_vm_config_file is missing.", 'error');
return FALSE;
}
$drupal_vm_config = Yaml::parse(file_get_contents($drupal_vm_config_file));
$result = $this->getExecutor()->drush('site:alias --format=json')->silent(TRUE)->run();
$drush_aliases = json_decode($result->getMessage(), TRUE);
$local_alias_id = '@' . $this->getConfigValue('drush.aliases.local');
if ($local_alias_id !== '@self') {
if (empty($drush_aliases[$local_alias_id])) {
$this->logProblem(__FUNCTION__ . ":alias", [
"The drush alias assigned to drush.aliases.local does not exist in your drush aliases file.",
" drush.aliases.local is set to @$local_alias_id",
], 'error');
}
else {
$local_alias = $drush_aliases[$local_alias_id];
$this->checkHost($local_alias, $drupal_vm_config, $local_alias_id);
$this->checkUri($local_alias, $drupal_vm_config, $local_alias_id);
$this->checkRoot($drupal_vm_config, $local_alias, $local_alias_id);
}
}
}
|
php
|
protected function checkDrupalVm() {
$drupal_vm_config_file = $this->getConfigValue('vm.config');
if (!file_exists($drupal_vm_config_file)) {
$this->logProblem(__FUNCTION__ . ':init', "You have DrupalVM initialized, but $drupal_vm_config_file is missing.", 'error');
return FALSE;
}
$drupal_vm_config = Yaml::parse(file_get_contents($drupal_vm_config_file));
$result = $this->getExecutor()->drush('site:alias --format=json')->silent(TRUE)->run();
$drush_aliases = json_decode($result->getMessage(), TRUE);
$local_alias_id = '@' . $this->getConfigValue('drush.aliases.local');
if ($local_alias_id !== '@self') {
if (empty($drush_aliases[$local_alias_id])) {
$this->logProblem(__FUNCTION__ . ":alias", [
"The drush alias assigned to drush.aliases.local does not exist in your drush aliases file.",
" drush.aliases.local is set to @$local_alias_id",
], 'error');
}
else {
$local_alias = $drush_aliases[$local_alias_id];
$this->checkHost($local_alias, $drupal_vm_config, $local_alias_id);
$this->checkUri($local_alias, $drupal_vm_config, $local_alias_id);
$this->checkRoot($drupal_vm_config, $local_alias, $local_alias_id);
}
}
}
|
[
"protected",
"function",
"checkDrupalVm",
"(",
")",
"{",
"$",
"drupal_vm_config_file",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'vm.config'",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"drupal_vm_config_file",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
".",
"':init'",
",",
"\"You have DrupalVM initialized, but $drupal_vm_config_file is missing.\"",
",",
"'error'",
")",
";",
"return",
"FALSE",
";",
"}",
"$",
"drupal_vm_config",
"=",
"Yaml",
"::",
"parse",
"(",
"file_get_contents",
"(",
"$",
"drupal_vm_config_file",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"getExecutor",
"(",
")",
"->",
"drush",
"(",
"'site:alias --format=json'",
")",
"->",
"silent",
"(",
"TRUE",
")",
"->",
"run",
"(",
")",
";",
"$",
"drush_aliases",
"=",
"json_decode",
"(",
"$",
"result",
"->",
"getMessage",
"(",
")",
",",
"TRUE",
")",
";",
"$",
"local_alias_id",
"=",
"'@'",
".",
"$",
"this",
"->",
"getConfigValue",
"(",
"'drush.aliases.local'",
")",
";",
"if",
"(",
"$",
"local_alias_id",
"!==",
"'@self'",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"drush_aliases",
"[",
"$",
"local_alias_id",
"]",
")",
")",
"{",
"$",
"this",
"->",
"logProblem",
"(",
"__FUNCTION__",
".",
"\":alias\"",
",",
"[",
"\"The drush alias assigned to drush.aliases.local does not exist in your drush aliases file.\"",
",",
"\" drush.aliases.local is set to @$local_alias_id\"",
",",
"]",
",",
"'error'",
")",
";",
"}",
"else",
"{",
"$",
"local_alias",
"=",
"$",
"drush_aliases",
"[",
"$",
"local_alias_id",
"]",
";",
"$",
"this",
"->",
"checkHost",
"(",
"$",
"local_alias",
",",
"$",
"drupal_vm_config",
",",
"$",
"local_alias_id",
")",
";",
"$",
"this",
"->",
"checkUri",
"(",
"$",
"local_alias",
",",
"$",
"drupal_vm_config",
",",
"$",
"local_alias_id",
")",
";",
"$",
"this",
"->",
"checkRoot",
"(",
"$",
"drupal_vm_config",
",",
"$",
"local_alias",
",",
"$",
"local_alias_id",
")",
";",
"}",
"}",
"}"
] |
Checks Drupal VM configuration.
|
[
"Checks",
"Drupal",
"VM",
"configuration",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Doctor/DrupalVmCheck.php#L22-L47
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.createFromSymlink
|
public function createFromSymlink($options = [
'project-dir' => self::BLT_PROJECT_DIR,
'vm' => TRUE,
]) {
$test_project_dir = $this->bltRoot . "/" . $options['project-dir'];
$bin = $test_project_dir . "/vendor/bin";
$this->prepareTestProjectDir($test_project_dir);
$this->taskFilesystemStack()
->mkdir($test_project_dir)
->copy($this->bltRoot . '/subtree-splits/blt-project/composer.json', $test_project_dir . '/composer.json')
->run();
$template_composer_json_filepath = $test_project_dir . '/composer.json';
$template_composer_json = json_decode(file_get_contents($template_composer_json_filepath));
$template_composer_json->repositories->blt = [
'type' => 'path',
'url' => '../blt',
'options' => [
'symlink' => TRUE,
],
];
$template_composer_json->require->{'acquia/blt'} = '*@dev';
file_put_contents($template_composer_json_filepath, json_encode($template_composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$this->taskExecStack()
->dir($test_project_dir)
->exec("git init")
->exec("git add -A")
->exec("git commit -m \"Initial commit.\"")
->run();
if (!$options['vm']) {
$this->taskReplaceInFile($test_project_dir . "/composer.json")
->from("../blt")
->to($this->bltRoot)
->run();
}
$task = $this->taskExecStack()
->dir($test_project_dir)
// BLT is the only dependency at this point. Install it.
->exec("composer install");
if ($options['vm']) {
$task->exec("$bin/blt vm --no-boot --no-interaction -v")
->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.local_path '../blt'")
->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.destination '/var/www/blt'")
->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.type nfs");
}
$task->run();
}
|
php
|
public function createFromSymlink($options = [
'project-dir' => self::BLT_PROJECT_DIR,
'vm' => TRUE,
]) {
$test_project_dir = $this->bltRoot . "/" . $options['project-dir'];
$bin = $test_project_dir . "/vendor/bin";
$this->prepareTestProjectDir($test_project_dir);
$this->taskFilesystemStack()
->mkdir($test_project_dir)
->copy($this->bltRoot . '/subtree-splits/blt-project/composer.json', $test_project_dir . '/composer.json')
->run();
$template_composer_json_filepath = $test_project_dir . '/composer.json';
$template_composer_json = json_decode(file_get_contents($template_composer_json_filepath));
$template_composer_json->repositories->blt = [
'type' => 'path',
'url' => '../blt',
'options' => [
'symlink' => TRUE,
],
];
$template_composer_json->require->{'acquia/blt'} = '*@dev';
file_put_contents($template_composer_json_filepath, json_encode($template_composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$this->taskExecStack()
->dir($test_project_dir)
->exec("git init")
->exec("git add -A")
->exec("git commit -m \"Initial commit.\"")
->run();
if (!$options['vm']) {
$this->taskReplaceInFile($test_project_dir . "/composer.json")
->from("../blt")
->to($this->bltRoot)
->run();
}
$task = $this->taskExecStack()
->dir($test_project_dir)
// BLT is the only dependency at this point. Install it.
->exec("composer install");
if ($options['vm']) {
$task->exec("$bin/blt vm --no-boot --no-interaction -v")
->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.local_path '../blt'")
->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.destination '/var/www/blt'")
->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.type nfs");
}
$task->run();
}
|
[
"public",
"function",
"createFromSymlink",
"(",
"$",
"options",
"=",
"[",
"'project-dir'",
"=>",
"self",
"::",
"BLT_PROJECT_DIR",
",",
"'vm'",
"=>",
"TRUE",
",",
"]",
")",
"{",
"$",
"test_project_dir",
"=",
"$",
"this",
"->",
"bltRoot",
".",
"\"/\"",
".",
"$",
"options",
"[",
"'project-dir'",
"]",
";",
"$",
"bin",
"=",
"$",
"test_project_dir",
".",
"\"/vendor/bin\"",
";",
"$",
"this",
"->",
"prepareTestProjectDir",
"(",
"$",
"test_project_dir",
")",
";",
"$",
"this",
"->",
"taskFilesystemStack",
"(",
")",
"->",
"mkdir",
"(",
"$",
"test_project_dir",
")",
"->",
"copy",
"(",
"$",
"this",
"->",
"bltRoot",
".",
"'/subtree-splits/blt-project/composer.json'",
",",
"$",
"test_project_dir",
".",
"'/composer.json'",
")",
"->",
"run",
"(",
")",
";",
"$",
"template_composer_json_filepath",
"=",
"$",
"test_project_dir",
".",
"'/composer.json'",
";",
"$",
"template_composer_json",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"template_composer_json_filepath",
")",
")",
";",
"$",
"template_composer_json",
"->",
"repositories",
"->",
"blt",
"=",
"[",
"'type'",
"=>",
"'path'",
",",
"'url'",
"=>",
"'../blt'",
",",
"'options'",
"=>",
"[",
"'symlink'",
"=>",
"TRUE",
",",
"]",
",",
"]",
";",
"$",
"template_composer_json",
"->",
"require",
"->",
"{",
"'acquia/blt'",
"}",
"=",
"'*@dev'",
";",
"file_put_contents",
"(",
"$",
"template_composer_json_filepath",
",",
"json_encode",
"(",
"$",
"template_composer_json",
",",
"JSON_PRETTY_PRINT",
"|",
"JSON_UNESCAPED_SLASHES",
")",
")",
";",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"test_project_dir",
")",
"->",
"exec",
"(",
"\"git init\"",
")",
"->",
"exec",
"(",
"\"git add -A\"",
")",
"->",
"exec",
"(",
"\"git commit -m \\\"Initial commit.\\\"\"",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"options",
"[",
"'vm'",
"]",
")",
"{",
"$",
"this",
"->",
"taskReplaceInFile",
"(",
"$",
"test_project_dir",
".",
"\"/composer.json\"",
")",
"->",
"from",
"(",
"\"../blt\"",
")",
"->",
"to",
"(",
"$",
"this",
"->",
"bltRoot",
")",
"->",
"run",
"(",
")",
";",
"}",
"$",
"task",
"=",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"test_project_dir",
")",
"// BLT is the only dependency at this point. Install it.",
"->",
"exec",
"(",
"\"composer install\"",
")",
";",
"if",
"(",
"$",
"options",
"[",
"'vm'",
"]",
")",
"{",
"$",
"task",
"->",
"exec",
"(",
"\"$bin/blt vm --no-boot --no-interaction -v\"",
")",
"->",
"exec",
"(",
"\"$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.local_path '../blt'\"",
")",
"->",
"exec",
"(",
"\"$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.destination '/var/www/blt'\"",
")",
"->",
"exec",
"(",
"\"$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.type nfs\"",
")",
";",
"}",
"$",
"task",
"->",
"run",
"(",
")",
";",
"}"
] |
Create a new project via symlink from current checkout of BLT.
Local BLT will be symlinked to blted8/vendor/acquia/blt.
@option project-dir The directory in which the test project will be
created.
@option vm Whether a VM will be booted.
|
[
"Create",
"a",
"new",
"project",
"via",
"symlink",
"from",
"current",
"checkout",
"of",
"BLT",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L66-L115
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.bltRelease
|
public function bltRelease(
$tag,
$github_token,
$options = [
'prev-tag' => NULL,
]
) {
$this->stopOnFail();
$current_branch = $this->getCurrentBranch();
$this->checkDirty();
$this->printReleasePreamble($tag, $current_branch);
$this->assertBranchMatchesUpstream($current_branch);
$this->resetLocalBranch($current_branch);
$this->updateBltVersionConstant($tag);
$prev_tag = $this->getPrevTag($options, $current_branch);
$release_notes = $this->generateReleaseNotes($prev_tag, $tag, $github_token);
$this->updateChangelog($tag, $release_notes);
// Push the change upstream.
$this->_exec("git add CHANGELOG.md $this->bltRoot/src/Robo/Blt.php");
$this->_exec("git commit -m 'Updating CHANGELOG.md and setting version for $tag.' -n");
$this->_exec("git push upstream $current_branch");
$this->createGitHubRelease($current_branch, $tag, $release_notes, $github_token);
return 0;
}
|
php
|
public function bltRelease(
$tag,
$github_token,
$options = [
'prev-tag' => NULL,
]
) {
$this->stopOnFail();
$current_branch = $this->getCurrentBranch();
$this->checkDirty();
$this->printReleasePreamble($tag, $current_branch);
$this->assertBranchMatchesUpstream($current_branch);
$this->resetLocalBranch($current_branch);
$this->updateBltVersionConstant($tag);
$prev_tag = $this->getPrevTag($options, $current_branch);
$release_notes = $this->generateReleaseNotes($prev_tag, $tag, $github_token);
$this->updateChangelog($tag, $release_notes);
// Push the change upstream.
$this->_exec("git add CHANGELOG.md $this->bltRoot/src/Robo/Blt.php");
$this->_exec("git commit -m 'Updating CHANGELOG.md and setting version for $tag.' -n");
$this->_exec("git push upstream $current_branch");
$this->createGitHubRelease($current_branch, $tag, $release_notes, $github_token);
return 0;
}
|
[
"public",
"function",
"bltRelease",
"(",
"$",
"tag",
",",
"$",
"github_token",
",",
"$",
"options",
"=",
"[",
"'prev-tag'",
"=>",
"NULL",
",",
"]",
")",
"{",
"$",
"this",
"->",
"stopOnFail",
"(",
")",
";",
"$",
"current_branch",
"=",
"$",
"this",
"->",
"getCurrentBranch",
"(",
")",
";",
"$",
"this",
"->",
"checkDirty",
"(",
")",
";",
"$",
"this",
"->",
"printReleasePreamble",
"(",
"$",
"tag",
",",
"$",
"current_branch",
")",
";",
"$",
"this",
"->",
"assertBranchMatchesUpstream",
"(",
"$",
"current_branch",
")",
";",
"$",
"this",
"->",
"resetLocalBranch",
"(",
"$",
"current_branch",
")",
";",
"$",
"this",
"->",
"updateBltVersionConstant",
"(",
"$",
"tag",
")",
";",
"$",
"prev_tag",
"=",
"$",
"this",
"->",
"getPrevTag",
"(",
"$",
"options",
",",
"$",
"current_branch",
")",
";",
"$",
"release_notes",
"=",
"$",
"this",
"->",
"generateReleaseNotes",
"(",
"$",
"prev_tag",
",",
"$",
"tag",
",",
"$",
"github_token",
")",
";",
"$",
"this",
"->",
"updateChangelog",
"(",
"$",
"tag",
",",
"$",
"release_notes",
")",
";",
"// Push the change upstream.",
"$",
"this",
"->",
"_exec",
"(",
"\"git add CHANGELOG.md $this->bltRoot/src/Robo/Blt.php\"",
")",
";",
"$",
"this",
"->",
"_exec",
"(",
"\"git commit -m 'Updating CHANGELOG.md and setting version for $tag.' -n\"",
")",
";",
"$",
"this",
"->",
"_exec",
"(",
"\"git push upstream $current_branch\"",
")",
";",
"$",
"this",
"->",
"createGitHubRelease",
"(",
"$",
"current_branch",
",",
"$",
"tag",
",",
"$",
"release_notes",
",",
"$",
"github_token",
")",
";",
"return",
"0",
";",
"}"
] |
Generates release notes and cuts a new tag on GitHub.
@command release
@param string $tag
The tag name. E.g, 8.6.10.
@param string $github_token
A github access token.
@option prev-tag The previous tag on the current branch from which to
determine diff.
@return int
The CLI status code.
|
[
"Generates",
"release",
"notes",
"and",
"cuts",
"a",
"new",
"tag",
"on",
"GitHub",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L214-L239
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.releaseNotes
|
public function releaseNotes(
$tag,
$github_token,
$options = [
'prev-tag' => NULL,
]
) {
$current_branch = $this->getCurrentBranch();
$prev_tag = $this->getPrevTag($options, $current_branch);
// @todo Check git version.
$changes = $this->generateReleaseNotes($tag, $prev_tag, $github_token);
$this->updateChangelog($tag, $changes);
}
|
php
|
public function releaseNotes(
$tag,
$github_token,
$options = [
'prev-tag' => NULL,
]
) {
$current_branch = $this->getCurrentBranch();
$prev_tag = $this->getPrevTag($options, $current_branch);
// @todo Check git version.
$changes = $this->generateReleaseNotes($tag, $prev_tag, $github_token);
$this->updateChangelog($tag, $changes);
}
|
[
"public",
"function",
"releaseNotes",
"(",
"$",
"tag",
",",
"$",
"github_token",
",",
"$",
"options",
"=",
"[",
"'prev-tag'",
"=>",
"NULL",
",",
"]",
")",
"{",
"$",
"current_branch",
"=",
"$",
"this",
"->",
"getCurrentBranch",
"(",
")",
";",
"$",
"prev_tag",
"=",
"$",
"this",
"->",
"getPrevTag",
"(",
"$",
"options",
",",
"$",
"current_branch",
")",
";",
"// @todo Check git version.",
"$",
"changes",
"=",
"$",
"this",
"->",
"generateReleaseNotes",
"(",
"$",
"tag",
",",
"$",
"prev_tag",
",",
"$",
"github_token",
")",
";",
"$",
"this",
"->",
"updateChangelog",
"(",
"$",
"tag",
",",
"$",
"changes",
")",
";",
"}"
] |
Update CHANGELOG.md with notes for new release.
@param string $tag
The tag name. E.g, 8.6.10.
@param string $github_token
A github access token.
@option prev-tag The previous tag on the current branch from which to
determine diff.
@return int
The CLI status code.
|
[
"Update",
"CHANGELOG",
".",
"md",
"with",
"notes",
"for",
"new",
"release",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L304-L317
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.fixCode
|
public function fixCode() {
$command = "'{$this->bin}/phpcbf'";
$task = $this->taskExecStack()
->dir($this->bltRoot)
->exec($command);
$result = $task->run();
return $result->getExitCode();
}
|
php
|
public function fixCode() {
$command = "'{$this->bin}/phpcbf'";
$task = $this->taskExecStack()
->dir($this->bltRoot)
->exec($command);
$result = $task->run();
return $result->getExitCode();
}
|
[
"public",
"function",
"fixCode",
"(",
")",
"{",
"$",
"command",
"=",
"\"'{$this->bin}/phpcbf'\"",
";",
"$",
"task",
"=",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"bltRoot",
")",
"->",
"exec",
"(",
"$",
"command",
")",
";",
"$",
"result",
"=",
"$",
"task",
"->",
"run",
"(",
")",
";",
"return",
"$",
"result",
"->",
"getExitCode",
"(",
")",
";",
"}"
] |
Fixes BLT internal code via PHPCBF.
@command fix-code
|
[
"Fixes",
"BLT",
"internal",
"code",
"via",
"PHPCBF",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L357-L365
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.sniffCode
|
public function sniffCode() {
$task = $this->taskExecStack()
->dir($this->bltRoot)
->exec("{$this->bin}/phpcs")
->exec("composer validate");
$result = $task->run();
return $result->getExitCode();
}
|
php
|
public function sniffCode() {
$task = $this->taskExecStack()
->dir($this->bltRoot)
->exec("{$this->bin}/phpcs")
->exec("composer validate");
$result = $task->run();
return $result->getExitCode();
}
|
[
"public",
"function",
"sniffCode",
"(",
")",
"{",
"$",
"task",
"=",
"$",
"this",
"->",
"taskExecStack",
"(",
")",
"->",
"dir",
"(",
"$",
"this",
"->",
"bltRoot",
")",
"->",
"exec",
"(",
"\"{$this->bin}/phpcs\"",
")",
"->",
"exec",
"(",
"\"composer validate\"",
")",
";",
"$",
"result",
"=",
"$",
"task",
"->",
"run",
"(",
")",
";",
"return",
"$",
"result",
"->",
"getExitCode",
"(",
")",
";",
"}"
] |
Sniffs BLT internal code via PHPCS.
@command sniff-code
|
[
"Sniffs",
"BLT",
"internal",
"code",
"via",
"PHPCS",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L372-L380
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.updateBltVersionConstant
|
protected function updateBltVersionConstant($tag) {
// Change version constant in Blt.php.
$this->taskReplaceInFile($this->bltRoot . '/src/Robo/Blt.php')
// Test group:
// @codingStandardsIgnoreStart
// const VERSION = '9.x-dev';
// const VERSION = '9.0.x-dev';
// const VERSION = '9.0.0-alpha1';
// const VERSION = '9.0.0-beta2';
// const VERSION = '9.0.0';
// @codingStandardsIgnoreEnd
->regex('/(const VERSION = \')[0-9]{1,2}\.[0-9x]{1,2}(\.[0-9x](-(alpha|beta|rc|dev)[0-9]{0,2})?|-dev?)(\';)/')
->to('${1}' . $tag . '${5}')
->run();
}
|
php
|
protected function updateBltVersionConstant($tag) {
// Change version constant in Blt.php.
$this->taskReplaceInFile($this->bltRoot . '/src/Robo/Blt.php')
// Test group:
// @codingStandardsIgnoreStart
// const VERSION = '9.x-dev';
// const VERSION = '9.0.x-dev';
// const VERSION = '9.0.0-alpha1';
// const VERSION = '9.0.0-beta2';
// const VERSION = '9.0.0';
// @codingStandardsIgnoreEnd
->regex('/(const VERSION = \')[0-9]{1,2}\.[0-9x]{1,2}(\.[0-9x](-(alpha|beta|rc|dev)[0-9]{0,2})?|-dev?)(\';)/')
->to('${1}' . $tag . '${5}')
->run();
}
|
[
"protected",
"function",
"updateBltVersionConstant",
"(",
"$",
"tag",
")",
"{",
"// Change version constant in Blt.php.",
"$",
"this",
"->",
"taskReplaceInFile",
"(",
"$",
"this",
"->",
"bltRoot",
".",
"'/src/Robo/Blt.php'",
")",
"// Test group:",
"// @codingStandardsIgnoreStart",
"// const VERSION = '9.x-dev';",
"// const VERSION = '9.0.x-dev';",
"// const VERSION = '9.0.0-alpha1';",
"// const VERSION = '9.0.0-beta2';",
"// const VERSION = '9.0.0';",
"// @codingStandardsIgnoreEnd",
"->",
"regex",
"(",
"'/(const VERSION = \\')[0-9]{1,2}\\.[0-9x]{1,2}(\\.[0-9x](-(alpha|beta|rc|dev)[0-9]{0,2})?|-dev?)(\\';)/'",
")",
"->",
"to",
"(",
"'${1}'",
".",
"$",
"tag",
".",
"'${5}'",
")",
"->",
"run",
"(",
")",
";",
"}"
] |
Updates the version constant in Blt.php.
@param string $tag
The new version.
|
[
"Updates",
"the",
"version",
"constant",
"in",
"Blt",
".",
"php",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L388-L402
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.sortChanges
|
protected function sortChanges($log_entries, $github_token) {
$client = new Client();
$client->authenticate($github_token, NULL, Client::AUTH_URL_TOKEN);
/** @var \Github\Api\Issue $issue_api */
$issue_api = $client->api('issue');
$changes = [
'breaking' => [],
'enhancements' => [],
'bugs' => [],
'misc' => [],
];
foreach ($log_entries as $log_entry) {
$changes = $this->sortLogEntry($log_entry, $issue_api, $changes);
}
return $changes;
}
|
php
|
protected function sortChanges($log_entries, $github_token) {
$client = new Client();
$client->authenticate($github_token, NULL, Client::AUTH_URL_TOKEN);
/** @var \Github\Api\Issue $issue_api */
$issue_api = $client->api('issue');
$changes = [
'breaking' => [],
'enhancements' => [],
'bugs' => [],
'misc' => [],
];
foreach ($log_entries as $log_entry) {
$changes = $this->sortLogEntry($log_entry, $issue_api, $changes);
}
return $changes;
}
|
[
"protected",
"function",
"sortChanges",
"(",
"$",
"log_entries",
",",
"$",
"github_token",
")",
"{",
"$",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"$",
"client",
"->",
"authenticate",
"(",
"$",
"github_token",
",",
"NULL",
",",
"Client",
"::",
"AUTH_URL_TOKEN",
")",
";",
"/** @var \\Github\\Api\\Issue $issue_api */",
"$",
"issue_api",
"=",
"$",
"client",
"->",
"api",
"(",
"'issue'",
")",
";",
"$",
"changes",
"=",
"[",
"'breaking'",
"=>",
"[",
"]",
",",
"'enhancements'",
"=>",
"[",
"]",
",",
"'bugs'",
"=>",
"[",
"]",
",",
"'misc'",
"=>",
"[",
"]",
",",
"]",
";",
"foreach",
"(",
"$",
"log_entries",
"as",
"$",
"log_entry",
")",
"{",
"$",
"changes",
"=",
"$",
"this",
"->",
"sortLogEntry",
"(",
"$",
"log_entry",
",",
"$",
"issue_api",
",",
"$",
"changes",
")",
";",
"}",
"return",
"$",
"changes",
";",
"}"
] |
Sorts an array of log changes based on GitHub issue labels.
This method will iterate over an array of log changes, use a regular
expression to identify GitHub issue numbers, and use the GitHub API to
fetch the labels for those issues.
@param array $log_entries
An array of log changes. Typically each row would be a commit message.
@return array
A multidimensional array grouped by the labels enhancement and bug.
|
[
"Sorts",
"an",
"array",
"of",
"log",
"changes",
"based",
"on",
"GitHub",
"issue",
"labels",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L487-L503
|
train
|
acquia/blt
|
RoboFile.php
|
RoboFile.sortLogEntry
|
protected function sortLogEntry($log_entry, $issue_api, $changes) {
$sorted = FALSE;
$github_issue_number = $this->parseGitHubIssueNumber($log_entry);
if ($github_issue_number) {
$labels = $this->getGitHubIssueLabels($issue_api, $github_issue_number);
if ($labels) {
foreach ($labels as $label) {
if (strtolower($label['name']) == 'change record') {
$changes['breaking'][] = $log_entry;
$sorted = TRUE;
break;
}
elseif (strtolower($label['name']) == 'enhancement') {
$changes['enhancements'][] = $log_entry;
$sorted = TRUE;
break;
}
elseif (strtolower($label['name']) == 'bug') {
$changes['bugs'][] = $log_entry;
$sorted = TRUE;
break;
}
}
}
}
if (!$sorted) {
$changes['misc'][] = $log_entry;
}
return $changes;
}
|
php
|
protected function sortLogEntry($log_entry, $issue_api, $changes) {
$sorted = FALSE;
$github_issue_number = $this->parseGitHubIssueNumber($log_entry);
if ($github_issue_number) {
$labels = $this->getGitHubIssueLabels($issue_api, $github_issue_number);
if ($labels) {
foreach ($labels as $label) {
if (strtolower($label['name']) == 'change record') {
$changes['breaking'][] = $log_entry;
$sorted = TRUE;
break;
}
elseif (strtolower($label['name']) == 'enhancement') {
$changes['enhancements'][] = $log_entry;
$sorted = TRUE;
break;
}
elseif (strtolower($label['name']) == 'bug') {
$changes['bugs'][] = $log_entry;
$sorted = TRUE;
break;
}
}
}
}
if (!$sorted) {
$changes['misc'][] = $log_entry;
}
return $changes;
}
|
[
"protected",
"function",
"sortLogEntry",
"(",
"$",
"log_entry",
",",
"$",
"issue_api",
",",
"$",
"changes",
")",
"{",
"$",
"sorted",
"=",
"FALSE",
";",
"$",
"github_issue_number",
"=",
"$",
"this",
"->",
"parseGitHubIssueNumber",
"(",
"$",
"log_entry",
")",
";",
"if",
"(",
"$",
"github_issue_number",
")",
"{",
"$",
"labels",
"=",
"$",
"this",
"->",
"getGitHubIssueLabels",
"(",
"$",
"issue_api",
",",
"$",
"github_issue_number",
")",
";",
"if",
"(",
"$",
"labels",
")",
"{",
"foreach",
"(",
"$",
"labels",
"as",
"$",
"label",
")",
"{",
"if",
"(",
"strtolower",
"(",
"$",
"label",
"[",
"'name'",
"]",
")",
"==",
"'change record'",
")",
"{",
"$",
"changes",
"[",
"'breaking'",
"]",
"[",
"]",
"=",
"$",
"log_entry",
";",
"$",
"sorted",
"=",
"TRUE",
";",
"break",
";",
"}",
"elseif",
"(",
"strtolower",
"(",
"$",
"label",
"[",
"'name'",
"]",
")",
"==",
"'enhancement'",
")",
"{",
"$",
"changes",
"[",
"'enhancements'",
"]",
"[",
"]",
"=",
"$",
"log_entry",
";",
"$",
"sorted",
"=",
"TRUE",
";",
"break",
";",
"}",
"elseif",
"(",
"strtolower",
"(",
"$",
"label",
"[",
"'name'",
"]",
")",
"==",
"'bug'",
")",
"{",
"$",
"changes",
"[",
"'bugs'",
"]",
"[",
"]",
"=",
"$",
"log_entry",
";",
"$",
"sorted",
"=",
"TRUE",
";",
"break",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"!",
"$",
"sorted",
")",
"{",
"$",
"changes",
"[",
"'misc'",
"]",
"[",
"]",
"=",
"$",
"log_entry",
";",
"}",
"return",
"$",
"changes",
";",
"}"
] |
Sorts log entry according to GitHub label.
@param $log_entry
@param $issue_api
@param $changes
@return mixed
|
[
"Sorts",
"log",
"entry",
"according",
"to",
"GitHub",
"label",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/RoboFile.php#L514-L543
|
train
|
acquia/blt
|
src/Robo/Commands/Sync/SyncCommand.php
|
SyncCommand.allSites
|
public function allSites() {
$multisites = $this->getConfigValue('multisites');
$this->printSyncMap($multisites);
$continue = $this->confirm("Continue?", TRUE);
if (!$continue) {
return 0;
}
foreach ($multisites as $multisite) {
$this->say("Refreshing site <comment>$multisite</comment>...");
$this->switchSiteContext($multisite);
$this->sync();
}
}
|
php
|
public function allSites() {
$multisites = $this->getConfigValue('multisites');
$this->printSyncMap($multisites);
$continue = $this->confirm("Continue?", TRUE);
if (!$continue) {
return 0;
}
foreach ($multisites as $multisite) {
$this->say("Refreshing site <comment>$multisite</comment>...");
$this->switchSiteContext($multisite);
$this->sync();
}
}
|
[
"public",
"function",
"allSites",
"(",
")",
"{",
"$",
"multisites",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'multisites'",
")",
";",
"$",
"this",
"->",
"printSyncMap",
"(",
"$",
"multisites",
")",
";",
"$",
"continue",
"=",
"$",
"this",
"->",
"confirm",
"(",
"\"Continue?\"",
",",
"TRUE",
")",
";",
"if",
"(",
"!",
"$",
"continue",
")",
"{",
"return",
"0",
";",
"}",
"foreach",
"(",
"$",
"multisites",
"as",
"$",
"multisite",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Refreshing site <comment>$multisite</comment>...\"",
")",
";",
"$",
"this",
"->",
"switchSiteContext",
"(",
"$",
"multisite",
")",
";",
"$",
"this",
"->",
"sync",
"(",
")",
";",
"}",
"}"
] |
Synchronize each multisite.
@command drupal:sync:all-sites
@aliases dsa sync:all
@executeInVm
|
[
"Synchronize",
"each",
"multisite",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Sync/SyncCommand.php#L20-L32
|
train
|
acquia/blt
|
src/Robo/Commands/Sync/SyncCommand.php
|
SyncCommand.syncFiles
|
public function syncFiles() {
$local_alias = '@' . $this->getConfigValue('drush.aliases.local');
$remote_alias = '@' . $this->getConfigValue('drush.aliases.remote');
$site_dir = $this->getConfigValue('site');
$task = $this->taskDrush()
->alias('')
->uri('')
->drush('rsync')
->arg($remote_alias . ':%files/')
->arg($this->getConfigValue('docroot') . "/sites/$site_dir/files")
->option('exclude-paths', implode(':', $this->getConfigValue('sync.exclude-paths')));
$result = $task->run();
return $result;
}
|
php
|
public function syncFiles() {
$local_alias = '@' . $this->getConfigValue('drush.aliases.local');
$remote_alias = '@' . $this->getConfigValue('drush.aliases.remote');
$site_dir = $this->getConfigValue('site');
$task = $this->taskDrush()
->alias('')
->uri('')
->drush('rsync')
->arg($remote_alias . ':%files/')
->arg($this->getConfigValue('docroot') . "/sites/$site_dir/files")
->option('exclude-paths', implode(':', $this->getConfigValue('sync.exclude-paths')));
$result = $task->run();
return $result;
}
|
[
"public",
"function",
"syncFiles",
"(",
")",
"{",
"$",
"local_alias",
"=",
"'@'",
".",
"$",
"this",
"->",
"getConfigValue",
"(",
"'drush.aliases.local'",
")",
";",
"$",
"remote_alias",
"=",
"'@'",
".",
"$",
"this",
"->",
"getConfigValue",
"(",
"'drush.aliases.remote'",
")",
";",
"$",
"site_dir",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"'site'",
")",
";",
"$",
"task",
"=",
"$",
"this",
"->",
"taskDrush",
"(",
")",
"->",
"alias",
"(",
"''",
")",
"->",
"uri",
"(",
"''",
")",
"->",
"drush",
"(",
"'rsync'",
")",
"->",
"arg",
"(",
"$",
"remote_alias",
".",
"':%files/'",
")",
"->",
"arg",
"(",
"$",
"this",
"->",
"getConfigValue",
"(",
"'docroot'",
")",
".",
"\"/sites/$site_dir/files\"",
")",
"->",
"option",
"(",
"'exclude-paths'",
",",
"implode",
"(",
"':'",
",",
"$",
"this",
"->",
"getConfigValue",
"(",
"'sync.exclude-paths'",
")",
")",
")",
";",
"$",
"result",
"=",
"$",
"task",
"->",
"run",
"(",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
Copies remote files to local machine.
@command drupal:sync:files
@aliases dsf sync:files
@validateDrushConfig
@executeInVm
@todo Support multisite.
|
[
"Copies",
"remote",
"files",
"to",
"local",
"machine",
"."
] |
8a903c1d930f82f4b9ee657d62d123782dd2ed59
|
https://github.com/acquia/blt/blob/8a903c1d930f82f4b9ee657d62d123782dd2ed59/src/Robo/Commands/Sync/SyncCommand.php#L67-L83
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.