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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksHandler.php | TasksHandler.delegateAndRebind | protected function delegateAndRebind($method, array $parameters, $builder)
{
$object = (array) array_shift($parameters);
$object = $this->builder->$builder(...$object);
$object->$method(...$parameters);
$this->container->add('rocketeer.'.$object->getIdentifier(), $object);
} | php | protected function delegateAndRebind($method, array $parameters, $builder)
{
$object = (array) array_shift($parameters);
$object = $this->builder->$builder(...$object);
$object->$method(...$parameters);
$this->container->add('rocketeer.'.$object->getIdentifier(), $object);
} | [
"protected",
"function",
"delegateAndRebind",
"(",
"$",
"method",
",",
"array",
"$",
"parameters",
",",
"$",
"builder",
")",
"{",
"$",
"object",
"=",
"(",
"array",
")",
"array_shift",
"(",
"$",
"parameters",
")",
";",
"$",
"object",
"=",
"$",
"this",
"... | Call a method on an object, and rebind it into the container.
@param string $method
@param array $parameters
@param string $builder
@throws \Rocketeer\Services\Builders\TaskCompositionException | [
"Call",
"a",
"method",
"on",
"an",
"object",
"and",
"rebind",
"it",
"into",
"the",
"container",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksHandler.php#L267-L274 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksHandler.php | TasksHandler.getEventHandle | public function getEventHandle(IdentifierInterface $entity = null, $event = null)
{
// Concatenate identifier and event if it's not already done
$event = $entity ? $entity->getIdentifier().'.'.$event : $event;
$event = str_replace('rocketeer.', null, $event);
return 'rocketeer.'.$event;
} | php | public function getEventHandle(IdentifierInterface $entity = null, $event = null)
{
// Concatenate identifier and event if it's not already done
$event = $entity ? $entity->getIdentifier().'.'.$event : $event;
$event = str_replace('rocketeer.', null, $event);
return 'rocketeer.'.$event;
} | [
"public",
"function",
"getEventHandle",
"(",
"IdentifierInterface",
"$",
"entity",
"=",
"null",
",",
"$",
"event",
"=",
"null",
")",
"{",
"// Concatenate identifier and event if it's not already done",
"$",
"event",
"=",
"$",
"entity",
"?",
"$",
"entity",
"->",
"g... | Get the handle of an event.
@param IdentifierInterface|null $entity
@param string|null $event
@return string | [
"Get",
"the",
"handle",
"of",
"an",
"event",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksHandler.php#L284-L291 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/StrategiesBuilder.php | StrategiesBuilder.buildStrategy | public function buildStrategy($strategy, $concrete = null)
{
// If we passed a concrete implementation
// look for it specifically
$handle = Str::snake($strategy, '-');
if ($concrete) {
$handle .= '.'.Str::snake($concrete, '-');
}
// If no found instance, create a new one
$handle = 'rocketeer.strategies.'.$handle;
if (!$this->container->has($handle)) {
$option = Str::snake($strategy, '-');
$concrete = $concrete ?: $this->config->getContextually('strategies.'.$option);
$strategy = $this->buildStrategyFromName($strategy, $concrete);
if (!$strategy) {
return;
}
$this->container->add($handle, $strategy);
}
// Get and register modules
/** @var AbstractStrategy $strategy */
$strategy = $this->container->get($handle);
$strategy = $this->modulable->registerBashModulesOn($strategy);
return $strategy;
} | php | public function buildStrategy($strategy, $concrete = null)
{
// If we passed a concrete implementation
// look for it specifically
$handle = Str::snake($strategy, '-');
if ($concrete) {
$handle .= '.'.Str::snake($concrete, '-');
}
// If no found instance, create a new one
$handle = 'rocketeer.strategies.'.$handle;
if (!$this->container->has($handle)) {
$option = Str::snake($strategy, '-');
$concrete = $concrete ?: $this->config->getContextually('strategies.'.$option);
$strategy = $this->buildStrategyFromName($strategy, $concrete);
if (!$strategy) {
return;
}
$this->container->add($handle, $strategy);
}
// Get and register modules
/** @var AbstractStrategy $strategy */
$strategy = $this->container->get($handle);
$strategy = $this->modulable->registerBashModulesOn($strategy);
return $strategy;
} | [
"public",
"function",
"buildStrategy",
"(",
"$",
"strategy",
",",
"$",
"concrete",
"=",
"null",
")",
"{",
"// If we passed a concrete implementation",
"// look for it specifically",
"$",
"handle",
"=",
"Str",
"::",
"snake",
"(",
"$",
"strategy",
",",
"'-'",
")",
... | Build a strategy.
@param string $strategy
@param string|null $concrete
@return \Rocketeer\Strategies\AbstractStrategy|\Rocketeer\Strategies\Framework\FrameworkStrategyInterface|false | [
"Build",
"a",
"strategy",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/StrategiesBuilder.php#L31-L59 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/StrategiesBuilder.php | StrategiesBuilder.buildStrategyFromName | protected function buildStrategyFromName($strategy, $concrete)
{
$concrete = $this->modulable->findQualifiedName($concrete, 'strategies', $strategy);
if (!$concrete) {
return false;
}
return new $concrete($this->container);
} | php | protected function buildStrategyFromName($strategy, $concrete)
{
$concrete = $this->modulable->findQualifiedName($concrete, 'strategies', $strategy);
if (!$concrete) {
return false;
}
return new $concrete($this->container);
} | [
"protected",
"function",
"buildStrategyFromName",
"(",
"$",
"strategy",
",",
"$",
"concrete",
")",
"{",
"$",
"concrete",
"=",
"$",
"this",
"->",
"modulable",
"->",
"findQualifiedName",
"(",
"$",
"concrete",
",",
"'strategies'",
",",
"$",
"strategy",
")",
";"... | Find a build a strategy by its class name.
@param string $strategy
@param string $concrete
@return object|false | [
"Find",
"a",
"build",
"a",
"strategy",
"by",
"its",
"class",
"name",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/StrategiesBuilder.php#L69-L78 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Config/Files/Loaders/ConfigurationLoader.php | ConfigurationLoader.getFiles | public function getFiles()
{
$finders = [
MainConfigurationFinder::class,
ContextualConfigurationFinder::class,
PluginsConfigurationFinder::class,
];
// Filter out non-existing folders
$folders = $this->getFolders();
if (!$folders) {
return [];
}
$files = [];
foreach ($folders as $folder) {
foreach ($finders as $finder) {
/** @var AbstractConfigurationFinder $finder */
$finder = new $finder($this->files, $folder);
$files = array_merge($files, $finder->getFiles());
}
}
// Load consolidated configuration
$folder = $this->paths->getRocketeerPath();
if ($this->files->has($folder)) {
$consolidated = new ConsolidatedConfigurationFinder($this->files, $folder);
$files = array_merge($files, $consolidated->getFiles());
}
return $files;
} | php | public function getFiles()
{
$finders = [
MainConfigurationFinder::class,
ContextualConfigurationFinder::class,
PluginsConfigurationFinder::class,
];
// Filter out non-existing folders
$folders = $this->getFolders();
if (!$folders) {
return [];
}
$files = [];
foreach ($folders as $folder) {
foreach ($finders as $finder) {
/** @var AbstractConfigurationFinder $finder */
$finder = new $finder($this->files, $folder);
$files = array_merge($files, $finder->getFiles());
}
}
// Load consolidated configuration
$folder = $this->paths->getRocketeerPath();
if ($this->files->has($folder)) {
$consolidated = new ConsolidatedConfigurationFinder($this->files, $folder);
$files = array_merge($files, $consolidated->getFiles());
}
return $files;
} | [
"public",
"function",
"getFiles",
"(",
")",
"{",
"$",
"finders",
"=",
"[",
"MainConfigurationFinder",
"::",
"class",
",",
"ContextualConfigurationFinder",
"::",
"class",
",",
"PluginsConfigurationFinder",
"::",
"class",
",",
"]",
";",
"// Filter out non-existing folde... | Gather the files to load for configuration.
@return SplFileInfo[] | [
"Gather",
"the",
"files",
"to",
"load",
"for",
"configuration",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Config/Files/Loaders/ConfigurationLoader.php#L127-L158 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Config/Files/Loaders/ConfigurationLoader.php | ConfigurationLoader.wrapConfigurationContents | protected function wrapConfigurationContents(SplFileInfo $file, array $contents)
{
$key = $file->getBasename('.'.$file->getExtension());
if (array_keys($contents) !== [$key] || !is_array($contents[$key])) {
return [$key => $contents];
} elseif (array_keys($contents) === ['rocketeer']) {
return $contents['rocketeer'];
}
return $contents;
} | php | protected function wrapConfigurationContents(SplFileInfo $file, array $contents)
{
$key = $file->getBasename('.'.$file->getExtension());
if (array_keys($contents) !== [$key] || !is_array($contents[$key])) {
return [$key => $contents];
} elseif (array_keys($contents) === ['rocketeer']) {
return $contents['rocketeer'];
}
return $contents;
} | [
"protected",
"function",
"wrapConfigurationContents",
"(",
"SplFileInfo",
"$",
"file",
",",
"array",
"$",
"contents",
")",
"{",
"$",
"key",
"=",
"$",
"file",
"->",
"getBasename",
"(",
"'.'",
".",
"$",
"file",
"->",
"getExtension",
"(",
")",
")",
";",
"if... | Automatically wrap configuration in their arrays.
@param SplFileInfo $file
@param array $contents
@return array | [
"Automatically",
"wrap",
"configuration",
"in",
"their",
"arrays",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Config/Files/Loaders/ConfigurationLoader.php#L201-L211 | train |
rocketeers/rocketeer | src/Rocketeer/Console/Commands/AbstractCommand.php | AbstractCommand.fireTasksQueue | protected function fireTasksQueue($tasks)
{
$this->prepareEnvironment();
// Fire tasks and events around them
$status = $this->runWithBeforeAfterEvents(function () use ($tasks) {
if ($this->straight) {
return $this->builder->buildTask($tasks)->fire();
}
$pipeline = $this->queue->run($tasks);
return $pipeline->succeeded();
});
// Remove command instance
$this->container->remove('command');
// Save history to logs
$this->explainer->info('Saved logs to '.$this->logs->getLogsRealpath());
return $status ? 0 : 1;
} | php | protected function fireTasksQueue($tasks)
{
$this->prepareEnvironment();
// Fire tasks and events around them
$status = $this->runWithBeforeAfterEvents(function () use ($tasks) {
if ($this->straight) {
return $this->builder->buildTask($tasks)->fire();
}
$pipeline = $this->queue->run($tasks);
return $pipeline->succeeded();
});
// Remove command instance
$this->container->remove('command');
// Save history to logs
$this->explainer->info('Saved logs to '.$this->logs->getLogsRealpath());
return $status ? 0 : 1;
} | [
"protected",
"function",
"fireTasksQueue",
"(",
"$",
"tasks",
")",
"{",
"$",
"this",
"->",
"prepareEnvironment",
"(",
")",
";",
"// Fire tasks and events around them",
"$",
"status",
"=",
"$",
"this",
"->",
"runWithBeforeAfterEvents",
"(",
"function",
"(",
")",
... | Fire a Tasks Queue.
@param string|string[]|Closure|Closure[]|\Rocketeer\Tasks\AbstractTask|\Rocketeer\Tasks\AbstractTask[] $tasks
@return int | [
"Fire",
"a",
"Tasks",
"Queue",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Console/Commands/AbstractCommand.php#L271-L293 | train |
rocketeers/rocketeer | src/Rocketeer/Console/Commands/AbstractCommand.php | AbstractCommand.time | public function time(callable $callback)
{
$results = $this->timer->time($this, $callback);
$time = $this->timer->getLatestTime($this);
$this->explainer->line('Execution time: <comment>'.$time.'s</comment>');
return $results;
} | php | public function time(callable $callback)
{
$results = $this->timer->time($this, $callback);
$time = $this->timer->getLatestTime($this);
$this->explainer->line('Execution time: <comment>'.$time.'s</comment>');
return $results;
} | [
"public",
"function",
"time",
"(",
"callable",
"$",
"callback",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"timer",
"->",
"time",
"(",
"$",
"this",
",",
"$",
"callback",
")",
";",
"$",
"time",
"=",
"$",
"this",
"->",
"timer",
"->",
"getLates... | Time an operation and display it afterwards.
@param callable $callback
@return bool | [
"Time",
"an",
"operation",
"and",
"display",
"it",
"afterwards",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Console/Commands/AbstractCommand.php#L349-L357 | train |
rocketeers/rocketeer | src/Rocketeer/Console/Commands/AbstractCommand.php | AbstractCommand.prepareEnvironment | protected function prepareEnvironment()
{
// Bind command to container
$this->container->add('command', $this);
// Set active connections from flag
if ($connections = $this->command->option('on')) {
$this->connections->setActiveConnections($connections);
}
// Install and load plugins if not setup already
$vendor = $this->paths->getRocketeerPath().DS.'vendor';
if (!$this->files->has($vendor)) {
$this->queue->execute(Installer::class);
$this->bootstrapper->bootstrapRocketeerDependencies();
$this->bootstrapper->bootstrapUserCode();
}
} | php | protected function prepareEnvironment()
{
// Bind command to container
$this->container->add('command', $this);
// Set active connections from flag
if ($connections = $this->command->option('on')) {
$this->connections->setActiveConnections($connections);
}
// Install and load plugins if not setup already
$vendor = $this->paths->getRocketeerPath().DS.'vendor';
if (!$this->files->has($vendor)) {
$this->queue->execute(Installer::class);
$this->bootstrapper->bootstrapRocketeerDependencies();
$this->bootstrapper->bootstrapUserCode();
}
} | [
"protected",
"function",
"prepareEnvironment",
"(",
")",
"{",
"// Bind command to container",
"$",
"this",
"->",
"container",
"->",
"add",
"(",
"'command'",
",",
"$",
"this",
")",
";",
"// Set active connections from flag",
"if",
"(",
"$",
"connections",
"=",
"$",... | Prepare the environment. | [
"Prepare",
"the",
"environment",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Console/Commands/AbstractCommand.php#L362-L379 | train |
rocketeers/rocketeer | src/Rocketeer/Binaries/Vcs/Hg.php | Hg.getCredentials | private function getCredentials()
{
$options = ['--config ui.interactive' => 'no', '--config auth.x.prefix' => 'http://'];
$repository = $this->credentials->getCurrentRepository();
if ($user = $repository->username) {
$options['--config auth.x.username'] = $user;
}
if ($pass = $repository->password) {
$options['--config auth.x.password'] = $pass;
}
return $options;
} | php | private function getCredentials()
{
$options = ['--config ui.interactive' => 'no', '--config auth.x.prefix' => 'http://'];
$repository = $this->credentials->getCurrentRepository();
if ($user = $repository->username) {
$options['--config auth.x.username'] = $user;
}
if ($pass = $repository->password) {
$options['--config auth.x.password'] = $pass;
}
return $options;
} | [
"private",
"function",
"getCredentials",
"(",
")",
"{",
"$",
"options",
"=",
"[",
"'--config ui.interactive'",
"=>",
"'no'",
",",
"'--config auth.x.prefix'",
"=>",
"'http://'",
"]",
";",
"$",
"repository",
"=",
"$",
"this",
"->",
"credentials",
"->",
"getCurrent... | Get the credentials required for cloning.
@return array | [
"Get",
"the",
"credentials",
"required",
"for",
"cloning",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Binaries/Vcs/Hg.php#L125-L138 | train |
rocketeers/rocketeer | src/Rocketeer/Tasks/Cleanup.php | Cleanup.getReleasesToCleanup | protected function getReleasesToCleanup()
{
return $this->getOption('clean-all', true)
? $this->releasesManager->getNonCurrentReleases()
: $this->releasesManager->getDeprecatedReleases();
} | php | protected function getReleasesToCleanup()
{
return $this->getOption('clean-all', true)
? $this->releasesManager->getNonCurrentReleases()
: $this->releasesManager->getDeprecatedReleases();
} | [
"protected",
"function",
"getReleasesToCleanup",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getOption",
"(",
"'clean-all'",
",",
"true",
")",
"?",
"$",
"this",
"->",
"releasesManager",
"->",
"getNonCurrentReleases",
"(",
")",
":",
"$",
"this",
"->",
"relea... | Get an array of releases to prune.
@return int[] | [
"Get",
"an",
"array",
"of",
"releases",
"to",
"prune",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Tasks/Cleanup.php#L64-L69 | train |
rocketeers/rocketeer | src/Rocketeer/Console/Console.php | Console.getHelp | public function getHelp()
{
$help = str_replace($this->getLongVersion(), null, parent::getHelp());
$state = $this->buildBlock('Current state', $this->getCurrentState());
$help = sprintf('%s'.PHP_EOL.PHP_EOL.'%s%s', $this->getLongVersion(), $state, $help);
return $help;
} | php | public function getHelp()
{
$help = str_replace($this->getLongVersion(), null, parent::getHelp());
$state = $this->buildBlock('Current state', $this->getCurrentState());
$help = sprintf('%s'.PHP_EOL.PHP_EOL.'%s%s', $this->getLongVersion(), $state, $help);
return $help;
} | [
"public",
"function",
"getHelp",
"(",
")",
"{",
"$",
"help",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getLongVersion",
"(",
")",
",",
"null",
",",
"parent",
"::",
"getHelp",
"(",
")",
")",
";",
"$",
"state",
"=",
"$",
"this",
"->",
"buildBlock",
... | Display the application's help.
@return string | [
"Display",
"the",
"application",
"s",
"help",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Console/Console.php#L62-L69 | train |
rocketeers/rocketeer | src/Rocketeer/Console/Console.php | Console.buildBlock | protected function buildBlock($title, $informations)
{
$message = '<comment>'.$title.'</comment>';
foreach ($informations as $name => $info) {
$message .= PHP_EOL.sprintf(' <info>%-15s</info> %s', $name, $info);
}
return $message;
} | php | protected function buildBlock($title, $informations)
{
$message = '<comment>'.$title.'</comment>';
foreach ($informations as $name => $info) {
$message .= PHP_EOL.sprintf(' <info>%-15s</info> %s', $name, $info);
}
return $message;
} | [
"protected",
"function",
"buildBlock",
"(",
"$",
"title",
",",
"$",
"informations",
")",
"{",
"$",
"message",
"=",
"'<comment>'",
".",
"$",
"title",
".",
"'</comment>'",
";",
"foreach",
"(",
"$",
"informations",
"as",
"$",
"name",
"=>",
"$",
"info",
")",... | Build an help block.
@param string $title
@param string[] $informations
@return string | [
"Build",
"an",
"help",
"block",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Console/Console.php#L93-L101 | train |
rocketeers/rocketeer | src/Rocketeer/Console/Console.php | Console.getCurrentState | protected function getCurrentState()
{
return [
'application_name' => $this->config->get('application_name'),
'application' => realpath($this->paths->getBasePath()),
'configuration' => realpath($this->paths->getConfigurationPath()),
'logs' => $this->paths->getLogsPath(),
];
} | php | protected function getCurrentState()
{
return [
'application_name' => $this->config->get('application_name'),
'application' => realpath($this->paths->getBasePath()),
'configuration' => realpath($this->paths->getConfigurationPath()),
'logs' => $this->paths->getLogsPath(),
];
} | [
"protected",
"function",
"getCurrentState",
"(",
")",
"{",
"return",
"[",
"'application_name'",
"=>",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'application_name'",
")",
",",
"'application'",
"=>",
"realpath",
"(",
"$",
"this",
"->",
"paths",
"->",
"ge... | Get current state of the CLI.
@return string[] | [
"Get",
"current",
"state",
"of",
"the",
"CLI",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Console/Console.php#L108-L116 | train |
rocketeers/rocketeer | src/Rocketeer/Services/History/LogsHandler.php | LogsHandler.log | public function log($message)
{
$messages = (array) $message;
foreach ($messages as $message) {
$this->getLogger()->info($this->prependHandle($message));
}
} | php | public function log($message)
{
$messages = (array) $message;
foreach ($messages as $message) {
$this->getLogger()->info($this->prependHandle($message));
}
} | [
"public",
"function",
"log",
"(",
"$",
"message",
")",
"{",
"$",
"messages",
"=",
"(",
"array",
")",
"$",
"message",
";",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
... | Save something for the logs.
@param string|string[] $message | [
"Save",
"something",
"for",
"the",
"logs",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/History/LogsHandler.php#L42-L48 | train |
rocketeers/rocketeer | src/Rocketeer/Services/History/LogsHandler.php | LogsHandler.getLogsRealpath | public function getLogsRealpath()
{
// Get the namer closure
$namer = $this->config->get('logs');
$name = is_callable($namer) ? $namer($this->connections) : $namer;
if (!$name) {
return false;
}
// Save for reuse
$name = $this->paths->getLogsPath().DS.$name;
return $name;
} | php | public function getLogsRealpath()
{
// Get the namer closure
$namer = $this->config->get('logs');
$name = is_callable($namer) ? $namer($this->connections) : $namer;
if (!$name) {
return false;
}
// Save for reuse
$name = $this->paths->getLogsPath().DS.$name;
return $name;
} | [
"public",
"function",
"getLogsRealpath",
"(",
")",
"{",
"// Get the namer closure",
"$",
"namer",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'logs'",
")",
";",
"$",
"name",
"=",
"is_callable",
"(",
"$",
"namer",
")",
"?",
"$",
"namer",
"(",
"... | Get the logs file being currently used.
@return string|false | [
"Get",
"the",
"logs",
"file",
"being",
"currently",
"used",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/History/LogsHandler.php#L92-L105 | train |
rocketeers/rocketeer | src/Rocketeer/Services/History/LogsHandler.php | LogsHandler.createLogsFile | protected function createLogsFile($file)
{
$directory = dirname($file);
// Create directory
if (!$this->files->isDirectory($directory)) {
$this->files->createDir($directory);
}
// Create file
if (!$this->files->has($file)) {
$this->files->put($file, '');
}
} | php | protected function createLogsFile($file)
{
$directory = dirname($file);
// Create directory
if (!$this->files->isDirectory($directory)) {
$this->files->createDir($directory);
}
// Create file
if (!$this->files->has($file)) {
$this->files->put($file, '');
}
} | [
"protected",
"function",
"createLogsFile",
"(",
"$",
"file",
")",
"{",
"$",
"directory",
"=",
"dirname",
"(",
"$",
"file",
")",
";",
"// Create directory",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"isDirectory",
"(",
"$",
"directory",
")",
")",
... | Create a logs file if it doesn't exist.
@param string $file | [
"Create",
"a",
"logs",
"file",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/History/LogsHandler.php#L112-L125 | train |
rocketeers/rocketeer | src/Rocketeer/Services/History/LogsHandler.php | LogsHandler.getLogs | public function getLogs()
{
$realpath = (string) $this->getLogsRealpath();
if (!$realpath) {
return [];
}
$logs = trim($this->files->read($realpath));
$logs = explode(PHP_EOL, $logs);
return $logs;
} | php | public function getLogs()
{
$realpath = (string) $this->getLogsRealpath();
if (!$realpath) {
return [];
}
$logs = trim($this->files->read($realpath));
$logs = explode(PHP_EOL, $logs);
return $logs;
} | [
"public",
"function",
"getLogs",
"(",
")",
"{",
"$",
"realpath",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"getLogsRealpath",
"(",
")",
";",
"if",
"(",
"!",
"$",
"realpath",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"logs",
"=",
"trim",
"(",... | Get the current logs.
@return array | [
"Get",
"the",
"current",
"logs",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/History/LogsHandler.php#L136-L147 | train |
rocketeers/rocketeer | src/Rocketeer/Services/History/LogsHandler.php | LogsHandler.formatEntries | protected function formatEntries($entries)
{
$entries = Arr::flatten($entries);
$entries = implode(PHP_EOL, $entries);
$entries = trim($entries);
return $entries;
} | php | protected function formatEntries($entries)
{
$entries = Arr::flatten($entries);
$entries = implode(PHP_EOL, $entries);
$entries = trim($entries);
return $entries;
} | [
"protected",
"function",
"formatEntries",
"(",
"$",
"entries",
")",
"{",
"$",
"entries",
"=",
"Arr",
"::",
"flatten",
"(",
"$",
"entries",
")",
";",
"$",
"entries",
"=",
"implode",
"(",
"PHP_EOL",
",",
"$",
"entries",
")",
";",
"$",
"entries",
"=",
"... | Format entries to a string.
@param array $entries
@return string | [
"Format",
"entries",
"to",
"a",
"string",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/History/LogsHandler.php#L170-L177 | train |
rocketeers/rocketeer | src/Rocketeer/Services/History/LogsHandler.php | LogsHandler.prependHandle | protected function prependHandle($entries)
{
$entries = (array) $entries;
$handle = $this->connections->getCurrentConnectionKey()->toLongHandle();
foreach ($entries as &$entry) {
$entry = str_replace('<comment>['.$handle.']</comment> ', null, $entry);
}
return count($entries) === 1 ? $entries[0] : $entries;
} | php | protected function prependHandle($entries)
{
$entries = (array) $entries;
$handle = $this->connections->getCurrentConnectionKey()->toLongHandle();
foreach ($entries as &$entry) {
$entry = str_replace('<comment>['.$handle.']</comment> ', null, $entry);
}
return count($entries) === 1 ? $entries[0] : $entries;
} | [
"protected",
"function",
"prependHandle",
"(",
"$",
"entries",
")",
"{",
"$",
"entries",
"=",
"(",
"array",
")",
"$",
"entries",
";",
"$",
"handle",
"=",
"$",
"this",
"->",
"connections",
"->",
"getCurrentConnectionKey",
"(",
")",
"->",
"toLongHandle",
"("... | Prepend the connection handle to each log entry.
@param string|string[] $entries
@return string|string[] | [
"Prepend",
"the",
"connection",
"handle",
"to",
"each",
"log",
"entry",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/History/LogsHandler.php#L186-L196 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.buildTask | public function buildTask($task, $name = null, $description = null)
{
// Compose the task from their various types
$task = $this->composeTask($task);
// If the built class is invalid, cancel
if (!$task instanceof AbstractTask) {
throw new TaskCompositionException($task);
}
// Set task properties
$task->setName($name);
$task->setDescription($description);
$task = $this->modulable->registerBashModulesOn($task);
// Bind instance for later user
if (!$task instanceof ClosureTask) {
$this->container->add('rocketeer.'.$task->getIdentifier(), $task);
}
return $task;
} | php | public function buildTask($task, $name = null, $description = null)
{
// Compose the task from their various types
$task = $this->composeTask($task);
// If the built class is invalid, cancel
if (!$task instanceof AbstractTask) {
throw new TaskCompositionException($task);
}
// Set task properties
$task->setName($name);
$task->setDescription($description);
$task = $this->modulable->registerBashModulesOn($task);
// Bind instance for later user
if (!$task instanceof ClosureTask) {
$this->container->add('rocketeer.'.$task->getIdentifier(), $task);
}
return $task;
} | [
"public",
"function",
"buildTask",
"(",
"$",
"task",
",",
"$",
"name",
"=",
"null",
",",
"$",
"description",
"=",
"null",
")",
"{",
"// Compose the task from their various types",
"$",
"task",
"=",
"$",
"this",
"->",
"composeTask",
"(",
"$",
"task",
")",
"... | Build a task from anything.
@param string|Closure|\Rocketeer\Tasks\AbstractTask $task
@param string|null $name
@param string|null $description
@throws \Rocketeer\Services\Builders\TaskCompositionException
@return AbstractTask | [
"Build",
"a",
"task",
"from",
"anything",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L51-L72 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.composeTask | protected function composeTask($task)
{
// If already built, return it
if ($task instanceof AbstractTask) {
return $task;
}
// If we passed a callable, build a Closure Task
if ($this->isCallable($task)) {
return $this->buildTaskFromCallable($task);
}
// If we provided a Closure, build a Closure Task
if ($task instanceof Closure || $task instanceof SerializableClosure) {
return $this->buildTaskFromClosure($task);
}
// If we passed a task handle, return it
if ($handle = $this->getTaskHandle($task)) {
return $this->container->get($handle);
}
// If we passed a command, build a Closure Task
if (is_array($task) || $this->isStringCommand($task) || $task === null) {
return $this->buildTaskFromString($task);
}
// Else it's a class name, get the appropriated task
if (!$task instanceof AbstractTask) {
return $this->buildTaskFromClass($task);
}
} | php | protected function composeTask($task)
{
// If already built, return it
if ($task instanceof AbstractTask) {
return $task;
}
// If we passed a callable, build a Closure Task
if ($this->isCallable($task)) {
return $this->buildTaskFromCallable($task);
}
// If we provided a Closure, build a Closure Task
if ($task instanceof Closure || $task instanceof SerializableClosure) {
return $this->buildTaskFromClosure($task);
}
// If we passed a task handle, return it
if ($handle = $this->getTaskHandle($task)) {
return $this->container->get($handle);
}
// If we passed a command, build a Closure Task
if (is_array($task) || $this->isStringCommand($task) || $task === null) {
return $this->buildTaskFromString($task);
}
// Else it's a class name, get the appropriated task
if (!$task instanceof AbstractTask) {
return $this->buildTaskFromClass($task);
}
} | [
"protected",
"function",
"composeTask",
"(",
"$",
"task",
")",
"{",
"// If already built, return it",
"if",
"(",
"$",
"task",
"instanceof",
"AbstractTask",
")",
"{",
"return",
"$",
"task",
";",
"}",
"// If we passed a callable, build a Closure Task",
"if",
"(",
"$",... | Compose a Task from its various types.
@param string|Closure|AbstractTask $task
@throws \Rocketeer\Services\Builders\TaskCompositionException
@return mixed|\Rocketeer\Tasks\AbstractTask | [
"Compose",
"a",
"Task",
"from",
"its",
"various",
"types",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L87-L118 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.buildTaskFromString | public function buildTaskFromString($task)
{
$closure = $this->wrapStringTasks($task);
return $this->buildTaskFromClosure($closure, $task);
} | php | public function buildTaskFromString($task)
{
$closure = $this->wrapStringTasks($task);
return $this->buildTaskFromClosure($closure, $task);
} | [
"public",
"function",
"buildTaskFromString",
"(",
"$",
"task",
")",
"{",
"$",
"closure",
"=",
"$",
"this",
"->",
"wrapStringTasks",
"(",
"$",
"task",
")",
";",
"return",
"$",
"this",
"->",
"buildTaskFromClosure",
"(",
"$",
"closure",
",",
"$",
"task",
")... | Build a task from a string.
@param string|string[] $task
@return AbstractTask | [
"Build",
"a",
"task",
"from",
"a",
"string",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L127-L132 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.buildTaskFromClosure | public function buildTaskFromClosure($callback, $stringTask = null)
{
/** @var ClosureTask $task */
$task = $this->buildTaskFromClass(ClosureTask::class);
$task->setClosure($callback);
// If we had an original string used, store it on
// the task for easier reflection
if ($stringTask) {
$task->setStringTask($stringTask);
}
return $task;
} | php | public function buildTaskFromClosure($callback, $stringTask = null)
{
/** @var ClosureTask $task */
$task = $this->buildTaskFromClass(ClosureTask::class);
$task->setClosure($callback);
// If we had an original string used, store it on
// the task for easier reflection
if ($stringTask) {
$task->setStringTask($stringTask);
}
return $task;
} | [
"public",
"function",
"buildTaskFromClosure",
"(",
"$",
"callback",
",",
"$",
"stringTask",
"=",
"null",
")",
"{",
"/** @var ClosureTask $task */",
"$",
"task",
"=",
"$",
"this",
"->",
"buildTaskFromClass",
"(",
"ClosureTask",
"::",
"class",
")",
";",
"$",
"ta... | Build a task from a Closure or a string command.
@param SerializableClosure|Closure $callback
@param string|null $stringTask
@return \Rocketeer\Tasks\AbstractTask | [
"Build",
"a",
"task",
"from",
"a",
"Closure",
"or",
"a",
"string",
"command",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L142-L155 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.buildTaskFromClass | public function buildTaskFromClass($task)
{
if (is_object($task) && $task instanceof AbstractTask) {
return $task;
}
// Cancel if class doesn't exist
if (!$class = $this->taskClassExists($task)) {
throw new TaskCompositionException($task);
}
// Build class
$class = new $class();
if ($class instanceof ContainerAwareInterface) {
$class->setContainer($this->container);
}
return $class;
} | php | public function buildTaskFromClass($task)
{
if (is_object($task) && $task instanceof AbstractTask) {
return $task;
}
// Cancel if class doesn't exist
if (!$class = $this->taskClassExists($task)) {
throw new TaskCompositionException($task);
}
// Build class
$class = new $class();
if ($class instanceof ContainerAwareInterface) {
$class->setContainer($this->container);
}
return $class;
} | [
"public",
"function",
"buildTaskFromClass",
"(",
"$",
"task",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"task",
")",
"&&",
"$",
"task",
"instanceof",
"AbstractTask",
")",
"{",
"return",
"$",
"task",
";",
"}",
"// Cancel if class doesn't exist",
"if",
"(",
... | Build a task from its name.
@param string|\Rocketeer\Tasks\AbstractTask $task
@throws TaskCompositionException
@return AbstractTask | [
"Build",
"a",
"task",
"from",
"its",
"name",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L166-L184 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.buildTaskFromCallable | protected function buildTaskFromCallable($callable)
{
$task = new ClosureTask();
$task->setContainer($this->container);
$task->setClosure(function () use ($callable, $task) {
list($class, $method) = is_array($callable) ? $callable : explode('::', $callable);
return $this->getContainer()->get($class)->$method($task);
});
return $task;
} | php | protected function buildTaskFromCallable($callable)
{
$task = new ClosureTask();
$task->setContainer($this->container);
$task->setClosure(function () use ($callable, $task) {
list($class, $method) = is_array($callable) ? $callable : explode('::', $callable);
return $this->getContainer()->get($class)->$method($task);
});
return $task;
} | [
"protected",
"function",
"buildTaskFromCallable",
"(",
"$",
"callable",
")",
"{",
"$",
"task",
"=",
"new",
"ClosureTask",
"(",
")",
";",
"$",
"task",
"->",
"setContainer",
"(",
"$",
"this",
"->",
"container",
")",
";",
"$",
"task",
"->",
"setClosure",
"(... | Build a task from a callable.
@param callable $callable
@return ClosureTask | [
"Build",
"a",
"task",
"from",
"a",
"callable",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L193-L204 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.getTaskHandle | protected function getTaskHandle($task)
{
// Check the handle if possible
if (!is_string($task)) {
return;
}
// Compute the handle and check it's bound
$handle = 'rocketeer.tasks.'.Str::snake(class_basename($task), '-');
$task = $this->container->has($handle) ? $handle : null;
return $task;
} | php | protected function getTaskHandle($task)
{
// Check the handle if possible
if (!is_string($task)) {
return;
}
// Compute the handle and check it's bound
$handle = 'rocketeer.tasks.'.Str::snake(class_basename($task), '-');
$task = $this->container->has($handle) ? $handle : null;
return $task;
} | [
"protected",
"function",
"getTaskHandle",
"(",
"$",
"task",
")",
"{",
"// Check the handle if possible",
"if",
"(",
"!",
"is_string",
"(",
"$",
"task",
")",
")",
"{",
"return",
";",
"}",
"// Compute the handle and check it's bound",
"$",
"handle",
"=",
"'rocketeer... | Get the handle of a task from its name.
@param string|AbstractTask $task
@return string|null | [
"Get",
"the",
"handle",
"of",
"a",
"task",
"from",
"its",
"name",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L233-L245 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.isStringCommand | protected function isStringCommand($string)
{
return is_string($string) && !$this->taskClassExists($string) && !$this->container->has('rocketeer.tasks.'.$string);
} | php | protected function isStringCommand($string)
{
return is_string($string) && !$this->taskClassExists($string) && !$this->container->has('rocketeer.tasks.'.$string);
} | [
"protected",
"function",
"isStringCommand",
"(",
"$",
"string",
")",
"{",
"return",
"is_string",
"(",
"$",
"string",
")",
"&&",
"!",
"$",
"this",
"->",
"taskClassExists",
"(",
"$",
"string",
")",
"&&",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
... | Check if a string is a command or a task.
@param string|Closure|\Rocketeer\Tasks\AbstractTask $string
@return bool | [
"Check",
"if",
"a",
"string",
"is",
"a",
"command",
"or",
"a",
"task",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L254-L257 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Modules/TasksBuilder.php | TasksBuilder.isCallable | public function isCallable($task)
{
// Check for container bindings
if (is_array($task)) {
return count($task) === 2 && ($this->container->has($task[0]) || is_callable($task));
}
return is_callable($task) && !$task instanceof Closure && !$task instanceof SerializableClosure;
} | php | public function isCallable($task)
{
// Check for container bindings
if (is_array($task)) {
return count($task) === 2 && ($this->container->has($task[0]) || is_callable($task));
}
return is_callable($task) && !$task instanceof Closure && !$task instanceof SerializableClosure;
} | [
"public",
"function",
"isCallable",
"(",
"$",
"task",
")",
"{",
"// Check for container bindings",
"if",
"(",
"is_array",
"(",
"$",
"task",
")",
")",
"{",
"return",
"count",
"(",
"$",
"task",
")",
"===",
"2",
"&&",
"(",
"$",
"this",
"->",
"container",
... | Check if a task is a callable.
@param array|string|Closure $task
@return bool | [
"Check",
"if",
"a",
"task",
"is",
"a",
"callable",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Modules/TasksBuilder.php#L266-L274 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Bootstrapper/Modules/TasksBootstrapper.php | TasksBootstrapper.bootstrapTasks | public function bootstrapTasks()
{
$tasks = [
Check::class,
Cleanup::class,
CreateRelease::class,
CurrentRelease::class,
Dependencies::class,
Deploy::class,
FridayDeploy::class,
Ignite::class,
Installer::class,
Migrate::class,
Notify::class,
Primer::class,
Rollback::class,
Setup::class,
SwapSymlink::class,
Teardown::class,
Test::class,
Update::class,
Updater::class,
];
foreach ($tasks as $task) {
$task = new $task();
$task->setContainer($this->container);
$this->builder->buildTask($task);
}
} | php | public function bootstrapTasks()
{
$tasks = [
Check::class,
Cleanup::class,
CreateRelease::class,
CurrentRelease::class,
Dependencies::class,
Deploy::class,
FridayDeploy::class,
Ignite::class,
Installer::class,
Migrate::class,
Notify::class,
Primer::class,
Rollback::class,
Setup::class,
SwapSymlink::class,
Teardown::class,
Test::class,
Update::class,
Updater::class,
];
foreach ($tasks as $task) {
$task = new $task();
$task->setContainer($this->container);
$this->builder->buildTask($task);
}
} | [
"public",
"function",
"bootstrapTasks",
"(",
")",
"{",
"$",
"tasks",
"=",
"[",
"Check",
"::",
"class",
",",
"Cleanup",
"::",
"class",
",",
"CreateRelease",
"::",
"class",
",",
"CurrentRelease",
"::",
"class",
",",
"Dependencies",
"::",
"class",
",",
"Deplo... | Bootstrap tasks registration. | [
"Bootstrap",
"tasks",
"registration",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Bootstrapper/Modules/TasksBootstrapper.php#L44-L73 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueTimer.php | QueueTimer.time | public function time(IdentifierInterface $entity, callable $callback)
{
// Start timer, execute callback, close timer
$timerStart = microtime(true);
$results = $callback();
$time = round(microtime(true) - $timerStart, 4);
$this->saveTime($entity, $time);
return $results;
} | php | public function time(IdentifierInterface $entity, callable $callback)
{
// Start timer, execute callback, close timer
$timerStart = microtime(true);
$results = $callback();
$time = round(microtime(true) - $timerStart, 4);
$this->saveTime($entity, $time);
return $results;
} | [
"public",
"function",
"time",
"(",
"IdentifierInterface",
"$",
"entity",
",",
"callable",
"$",
"callback",
")",
"{",
"// Start timer, execute callback, close timer",
"$",
"timerStart",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"results",
"=",
"$",
"callback",
... | Time a task operation.
@param IdentifierInterface $entity
@param callable $callback
@return mixed | [
"Time",
"a",
"task",
"operation",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueTimer.php#L38-L48 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueTimer.php | QueueTimer.saveTime | public function saveTime(IdentifierInterface $entity, $time)
{
// Don't save times in pretend mode
if ($this->getOption('pretend')) {
return;
}
// Append the new time to past ones
$past = $this->getTimes($entity);
$past[] = $time;
$this->saveTimes($entity, $past);
} | php | public function saveTime(IdentifierInterface $entity, $time)
{
// Don't save times in pretend mode
if ($this->getOption('pretend')) {
return;
}
// Append the new time to past ones
$past = $this->getTimes($entity);
$past[] = $time;
$this->saveTimes($entity, $past);
} | [
"public",
"function",
"saveTime",
"(",
"IdentifierInterface",
"$",
"entity",
",",
"$",
"time",
")",
"{",
"// Don't save times in pretend mode",
"if",
"(",
"$",
"this",
"->",
"getOption",
"(",
"'pretend'",
")",
")",
"{",
"return",
";",
"}",
"// Append the new tim... | Save the execution time of a task for future reference.
@param IdentifierInterface $entity
@param float $time | [
"Save",
"the",
"execution",
"time",
"of",
"a",
"task",
"for",
"future",
"reference",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueTimer.php#L56-L68 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueTimer.php | QueueTimer.getTime | public function getTime(IdentifierInterface $entity)
{
$past = $this->getTimes($entity);
if (!$past) {
return;
}
// Compute average time
$average = array_sum($past) / count($past);
$average = round($average, 2);
return $average;
} | php | public function getTime(IdentifierInterface $entity)
{
$past = $this->getTimes($entity);
if (!$past) {
return;
}
// Compute average time
$average = array_sum($past) / count($past);
$average = round($average, 2);
return $average;
} | [
"public",
"function",
"getTime",
"(",
"IdentifierInterface",
"$",
"entity",
")",
"{",
"$",
"past",
"=",
"$",
"this",
"->",
"getTimes",
"(",
"$",
"entity",
")",
";",
"if",
"(",
"!",
"$",
"past",
")",
"{",
"return",
";",
"}",
"// Compute average time",
"... | Compute the predicted execution time of a task.
@param IdentifierInterface $entity
@return float|null | [
"Compute",
"the",
"predicted",
"execution",
"time",
"of",
"a",
"task",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueTimer.php#L77-L89 | train |
rocketeers/rocketeer | src/Rocketeer/Binaries/PackageManagers/AbstractPackageManager.php | AbstractPackageManager.hasManifest | public function hasManifest()
{
$server = $this->releasesManager->getCurrentReleasePath($this->manifest);
$server = $this->bash->fileExists($server);
$local = $this->getManifestPath();
$local = $this->files->has($local);
return $local || $server;
} | php | public function hasManifest()
{
$server = $this->releasesManager->getCurrentReleasePath($this->manifest);
$server = $this->bash->fileExists($server);
$local = $this->getManifestPath();
$local = $this->files->has($local);
return $local || $server;
} | [
"public",
"function",
"hasManifest",
"(",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"releasesManager",
"->",
"getCurrentReleasePath",
"(",
"$",
"this",
"->",
"manifest",
")",
";",
"$",
"server",
"=",
"$",
"this",
"->",
"bash",
"->",
"fileExists",
... | Check if the manifest file exists, locally or on server.
@return bool | [
"Check",
"if",
"the",
"manifest",
"file",
"exists",
"locally",
"or",
"on",
"server",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Binaries/PackageManagers/AbstractPackageManager.php#L44-L53 | train |
rocketeers/rocketeer | src/Rocketeer/Binaries/PackageManagers/AbstractPackageManager.php | AbstractPackageManager.getManifestContents | public function getManifestContents()
{
$manifest = $this->getManifestPath();
if ($this->files->has($manifest)) {
return $this->files->read($manifest);
}
} | php | public function getManifestContents()
{
$manifest = $this->getManifestPath();
if ($this->files->has($manifest)) {
return $this->files->read($manifest);
}
} | [
"public",
"function",
"getManifestContents",
"(",
")",
"{",
"$",
"manifest",
"=",
"$",
"this",
"->",
"getManifestPath",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"has",
"(",
"$",
"manifest",
")",
")",
"{",
"return",
"$",
"this",
"->... | Get the contents of the manifest file.
@return false|string|null | [
"Get",
"the",
"contents",
"of",
"the",
"manifest",
"file",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Binaries/PackageManagers/AbstractPackageManager.php#L60-L66 | train |
rocketeers/rocketeer | src/Rocketeer/Tasks/Setup.php | Setup.createStages | protected function createStages()
{
// Get stages
$availableStages = $this->connections->getAvailableStages();
$originalStage = $this->connections->getCurrentConnectionKey()->stage;
if (empty($availableStages)) {
$availableStages = [null];
}
// Create folders
$mapping = $this->config->get('remote.directories');
foreach ($availableStages as $stage) {
$this->connections->setStage($stage);
$this->createFolder($mapping['releases']);
$this->createFolder($mapping['current']);
$this->createFolder($mapping['shared']);
}
if ($originalStage) {
$this->connections->setStage($originalStage);
}
} | php | protected function createStages()
{
// Get stages
$availableStages = $this->connections->getAvailableStages();
$originalStage = $this->connections->getCurrentConnectionKey()->stage;
if (empty($availableStages)) {
$availableStages = [null];
}
// Create folders
$mapping = $this->config->get('remote.directories');
foreach ($availableStages as $stage) {
$this->connections->setStage($stage);
$this->createFolder($mapping['releases']);
$this->createFolder($mapping['current']);
$this->createFolder($mapping['shared']);
}
if ($originalStage) {
$this->connections->setStage($originalStage);
}
} | [
"protected",
"function",
"createStages",
"(",
")",
"{",
"// Get stages",
"$",
"availableStages",
"=",
"$",
"this",
"->",
"connections",
"->",
"getAvailableStages",
"(",
")",
";",
"$",
"originalStage",
"=",
"$",
"this",
"->",
"connections",
"->",
"getCurrentConne... | Create the Application's folders. | [
"Create",
"the",
"Application",
"s",
"folders",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Tasks/Setup.php#L71-L92 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.displayBelow | public function displayBelow(callable $callback, $offset = 1)
{
if (!$this->hasCommand()) {
return $callback();
}
$this->level += $offset;
$results = $callback();
$this->level -= $offset;
return $results;
} | php | public function displayBelow(callable $callback, $offset = 1)
{
if (!$this->hasCommand()) {
return $callback();
}
$this->level += $offset;
$results = $callback();
$this->level -= $offset;
return $results;
} | [
"public",
"function",
"displayBelow",
"(",
"callable",
"$",
"callback",
",",
"$",
"offset",
"=",
"1",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasCommand",
"(",
")",
")",
"{",
"return",
"$",
"callback",
"(",
")",
";",
"}",
"$",
"this",
"->",
... | Execute a task in a level below.
@param callable $callback
@param int $offset
@return mixed | [
"Execute",
"a",
"task",
"in",
"a",
"level",
"below",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L56-L67 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.display | public function display($info = null, $details = null, $origin = null, $time = null)
{
if (!$this->hasCommand()) {
return;
}
// Build handle
$comment = $this->getTree().$this->getFork();
// Add details
if ($info) {
$comment .= ' <info>'.$info.'</info>';
}
if ($details) {
$comment .= ' <comment>('.$details.')</comment>';
}
if ($origin) {
$comment .= ' fired by <info>'.$origin.'</info>';
}
if ($time) {
$comment .= ' [~'.$time.'s]';
}
$this->command->writeln($comment);
} | php | public function display($info = null, $details = null, $origin = null, $time = null)
{
if (!$this->hasCommand()) {
return;
}
// Build handle
$comment = $this->getTree().$this->getFork();
// Add details
if ($info) {
$comment .= ' <info>'.$info.'</info>';
}
if ($details) {
$comment .= ' <comment>('.$details.')</comment>';
}
if ($origin) {
$comment .= ' fired by <info>'.$origin.'</info>';
}
if ($time) {
$comment .= ' [~'.$time.'s]';
}
$this->command->writeln($comment);
} | [
"public",
"function",
"display",
"(",
"$",
"info",
"=",
"null",
",",
"$",
"details",
"=",
"null",
",",
"$",
"origin",
"=",
"null",
",",
"$",
"time",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasCommand",
"(",
")",
")",
"{",
"re... | Display a status.
@param string|null $info
@param string|null $details
@param string|null $origin
@param float|null $time | [
"Display",
"a",
"status",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L77-L101 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.line | public function line($message, $color = null, $withTree = true)
{
$message = $this->toLines($message);
if (!$this->hasCommand()) {
return;
}
// Format the message
$formatted = $message;
foreach ($formatted as &$line) {
$line = $this->colorize($line, $color);
$line = $withTree ? $this->getTree().'|'.str_repeat(' ', $this->padding).$this->getFork().' '.$line : $line;
}
// Rejoin strings
$formatted = implode(PHP_EOL, $formatted);
$message = implode(PHP_EOL, $message);
// Pass to command and log
$this->command->writeln($formatted);
$this->logs->log($message);
return $formatted;
} | php | public function line($message, $color = null, $withTree = true)
{
$message = $this->toLines($message);
if (!$this->hasCommand()) {
return;
}
// Format the message
$formatted = $message;
foreach ($formatted as &$line) {
$line = $this->colorize($line, $color);
$line = $withTree ? $this->getTree().'|'.str_repeat(' ', $this->padding).$this->getFork().' '.$line : $line;
}
// Rejoin strings
$formatted = implode(PHP_EOL, $formatted);
$message = implode(PHP_EOL, $message);
// Pass to command and log
$this->command->writeln($formatted);
$this->logs->log($message);
return $formatted;
} | [
"public",
"function",
"line",
"(",
"$",
"message",
",",
"$",
"color",
"=",
"null",
",",
"$",
"withTree",
"=",
"true",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"toLines",
"(",
"$",
"message",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
... | Format and send a message by the command.
@param string|string[] $message
@param string|null $color
@param bool $withTree
@return string|null | [
"Format",
"and",
"send",
"a",
"message",
"by",
"the",
"command",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L116-L139 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.getProgressBarFormat | public function getProgressBarFormat($format)
{
return $this->displayBelow(function () use (&$format) {
$tree = $this->getTree().$this->getFork();
$format = explode(PHP_EOL, $format);
$format = $tree.implode(PHP_EOL.$tree.' ', $format);
return $format;
}, 2);
} | php | public function getProgressBarFormat($format)
{
return $this->displayBelow(function () use (&$format) {
$tree = $this->getTree().$this->getFork();
$format = explode(PHP_EOL, $format);
$format = $tree.implode(PHP_EOL.$tree.' ', $format);
return $format;
}, 2);
} | [
"public",
"function",
"getProgressBarFormat",
"(",
"$",
"format",
")",
"{",
"return",
"$",
"this",
"->",
"displayBelow",
"(",
"function",
"(",
")",
"use",
"(",
"&",
"$",
"format",
")",
"{",
"$",
"tree",
"=",
"$",
"this",
"->",
"getTree",
"(",
")",
".... | Get the format for a progress bar
embedded within the tree.
@param string $format
@return string | [
"Get",
"the",
"format",
"for",
"a",
"progress",
"bar",
"embedded",
"within",
"the",
"tree",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L149-L159 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.server | public function server($message)
{
$message = $this->toLines($message);
foreach ($message as &$line) {
$line = sprintf('<comment>[%s]</comment> %s', $this->connections->getCurrentConnectionKey()->toLongHandle(), $line);
}
return $this->line($message, null);
} | php | public function server($message)
{
$message = $this->toLines($message);
foreach ($message as &$line) {
$line = sprintf('<comment>[%s]</comment> %s', $this->connections->getCurrentConnectionKey()->toLongHandle(), $line);
}
return $this->line($message, null);
} | [
"public",
"function",
"server",
"(",
"$",
"message",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"toLines",
"(",
"$",
"message",
")",
";",
"foreach",
"(",
"$",
"message",
"as",
"&",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"sprintf",
"(",
"... | Display a server-related message.
@param string|string[] $message
@return string|null | [
"Display",
"a",
"server",
"-",
"related",
"message",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L168-L176 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.getLongestSize | protected function getLongestSize()
{
if ($this->longest) {
return $this->longest;
}
// Build possible handles
$strings = [];
$connections = $this->connections->getActiveConnections();
$stages = (array) $this->connections->getAvailableStages() ?: [''];
foreach ($connections as $handle => $connection) {
$servers = $connection->getConnectionKey()->servers;
if (count($servers) > 1) {
$handle .= '/'.count($servers);
}
foreach ($stages as $stage) {
$strings[] = trim($handle.'/'.$stage, '/');
}
}
// Get longest string
$strings = array_map('strlen', $strings);
$strings = $strings ? max($strings) : 0;
// Cache value
$this->longest = $strings;
return $this->longest;
} | php | protected function getLongestSize()
{
if ($this->longest) {
return $this->longest;
}
// Build possible handles
$strings = [];
$connections = $this->connections->getActiveConnections();
$stages = (array) $this->connections->getAvailableStages() ?: [''];
foreach ($connections as $handle => $connection) {
$servers = $connection->getConnectionKey()->servers;
if (count($servers) > 1) {
$handle .= '/'.count($servers);
}
foreach ($stages as $stage) {
$strings[] = trim($handle.'/'.$stage, '/');
}
}
// Get longest string
$strings = array_map('strlen', $strings);
$strings = $strings ? max($strings) : 0;
// Cache value
$this->longest = $strings;
return $this->longest;
} | [
"protected",
"function",
"getLongestSize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"longest",
")",
"{",
"return",
"$",
"this",
"->",
"longest",
";",
"}",
"// Build possible handles",
"$",
"strings",
"=",
"[",
"]",
";",
"$",
"connections",
"=",
"$",
... | Get the longest size an handle can have.
@return int | [
"Get",
"the",
"longest",
"size",
"an",
"handle",
"can",
"have",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L227-L256 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Display/QueueExplainer.php | QueueExplainer.colorize | protected function colorize($message, $color = null)
{
if (!$color) {
return $message;
}
// Create tag
$tag = in_array($color, ['error', 'comment', 'info'], true) ? $color : 'fg='.$color;
return sprintf('<%s>%s</%s>', $tag, $message, $tag);
} | php | protected function colorize($message, $color = null)
{
if (!$color) {
return $message;
}
// Create tag
$tag = in_array($color, ['error', 'comment', 'info'], true) ? $color : 'fg='.$color;
return sprintf('<%s>%s</%s>', $tag, $message, $tag);
} | [
"protected",
"function",
"colorize",
"(",
"$",
"message",
",",
"$",
"color",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"color",
")",
"{",
"return",
"$",
"message",
";",
"}",
"// Create tag",
"$",
"tag",
"=",
"in_array",
"(",
"$",
"color",
",",
"[... | Colorize text using Symfony Console tags.
@param string $message
@param string|null $color
@return string | [
"Colorize",
"text",
"using",
"Symfony",
"Console",
"tags",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Display/QueueExplainer.php#L307-L317 | train |
rocketeers/rocketeer | src/Rocketeer/Strategies/CreateRelease/CloneStrategy.php | CloneStrategy.update | public function update($reset = true)
{
$this->explainer->info('Pulling changes');
$tasks = [$this->vcs->update()];
// Reset if requested
if ($reset) {
array_unshift($tasks, $this->vcs->reset());
}
return $this->bash->runForCurrentRelease($tasks);
} | php | public function update($reset = true)
{
$this->explainer->info('Pulling changes');
$tasks = [$this->vcs->update()];
// Reset if requested
if ($reset) {
array_unshift($tasks, $this->vcs->reset());
}
return $this->bash->runForCurrentRelease($tasks);
} | [
"public",
"function",
"update",
"(",
"$",
"reset",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"explainer",
"->",
"info",
"(",
"'Pulling changes'",
")",
";",
"$",
"tasks",
"=",
"[",
"$",
"this",
"->",
"vcs",
"->",
"update",
"(",
")",
"]",
";",
"// Re... | Update the latest version of the application.
@param bool $reset
@return string | [
"Update",
"the",
"latest",
"version",
"of",
"the",
"application",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Strategies/CreateRelease/CloneStrategy.php#L69-L80 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Coordinator.php | Coordinator.whenAllServersReadyTo | public function whenAllServersReadyTo($event, callable $listener)
{
// Set status
$event = $this->getPromiseHandle($event);
$handle = (string) $this->connections->getCurrentConnectionKey();
// Initiate statuses
if (!isset($this->statuses[$event])) {
$this->statuses[$event] = [];
}
// Bind listener
$this->statuses[$event][$handle] = self::WAITING;
$this->registerJobListener($event, $listener);
// Fire when all servers are ready
if ($this->allServerAre($event, static::WAITING)) {
$this->events->emit($event);
}
return true;
} | php | public function whenAllServersReadyTo($event, callable $listener)
{
// Set status
$event = $this->getPromiseHandle($event);
$handle = (string) $this->connections->getCurrentConnectionKey();
// Initiate statuses
if (!isset($this->statuses[$event])) {
$this->statuses[$event] = [];
}
// Bind listener
$this->statuses[$event][$handle] = self::WAITING;
$this->registerJobListener($event, $listener);
// Fire when all servers are ready
if ($this->allServerAre($event, static::WAITING)) {
$this->events->emit($event);
}
return true;
} | [
"public",
"function",
"whenAllServersReadyTo",
"(",
"$",
"event",
",",
"callable",
"$",
"listener",
")",
"{",
"// Set status",
"$",
"event",
"=",
"$",
"this",
"->",
"getPromiseHandle",
"(",
"$",
"event",
")",
";",
"$",
"handle",
"=",
"(",
"string",
")",
... | Execute a listener when all servers are at the same point.
@param string $event
@param callable $listener
@return bool | [
"Execute",
"a",
"listener",
"when",
"all",
"servers",
"are",
"at",
"the",
"same",
"point",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Coordinator.php#L60-L81 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Coordinator.php | Coordinator.allServerAre | public function allServerAre($event, $expected)
{
$targets = $this->computeNumberOfTargets();
$statuses = array_filter($this->statuses[$event], function ($server) use ($expected) {
return $server === $expected;
});
return $targets === count($statuses);
} | php | public function allServerAre($event, $expected)
{
$targets = $this->computeNumberOfTargets();
$statuses = array_filter($this->statuses[$event], function ($server) use ($expected) {
return $server === $expected;
});
return $targets === count($statuses);
} | [
"public",
"function",
"allServerAre",
"(",
"$",
"event",
",",
"$",
"expected",
")",
"{",
"$",
"targets",
"=",
"$",
"this",
"->",
"computeNumberOfTargets",
"(",
")",
";",
"$",
"statuses",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"statuses",
"[",
"$",
... | Assert whether all servers are at a particular state.
@param string $event
@param int $expected
@return bool | [
"Assert",
"whether",
"all",
"servers",
"are",
"at",
"a",
"particular",
"state",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Coordinator.php#L95-L103 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Coordinator.php | Coordinator.setStatus | public function setStatus($event, $status)
{
$handle = (string) $this->connections->getCurrentConnectionKey();
$this->statuses[$event][$handle] = $status;
} | php | public function setStatus($event, $status)
{
$handle = (string) $this->connections->getCurrentConnectionKey();
$this->statuses[$event][$handle] = $status;
} | [
"public",
"function",
"setStatus",
"(",
"$",
"event",
",",
"$",
"status",
")",
"{",
"$",
"handle",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"connections",
"->",
"getCurrentConnectionKey",
"(",
")",
";",
"$",
"this",
"->",
"statuses",
"[",
"$",
"even... | Update a status.
@param string $event
@param int $status | [
"Update",
"a",
"status",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Coordinator.php#L111-L116 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Coordinator.php | Coordinator.computeNumberOfTargets | protected function computeNumberOfTargets()
{
$targets = [];
/** @var ConnectionInterface[] $connections */
$connections = $this->connections->getActiveConnections();
foreach ($connections as $connection) {
$stages = $this->connections->getAvailableStages();
$connectionKey = $connection->getConnectionKey();
$targets[$connectionKey->name] = count($connectionKey->servers) * count($stages);
}
return array_sum($targets);
} | php | protected function computeNumberOfTargets()
{
$targets = [];
/** @var ConnectionInterface[] $connections */
$connections = $this->connections->getActiveConnections();
foreach ($connections as $connection) {
$stages = $this->connections->getAvailableStages();
$connectionKey = $connection->getConnectionKey();
$targets[$connectionKey->name] = count($connectionKey->servers) * count($stages);
}
return array_sum($targets);
} | [
"protected",
"function",
"computeNumberOfTargets",
"(",
")",
"{",
"$",
"targets",
"=",
"[",
"]",
";",
"/** @var ConnectionInterface[] $connections */",
"$",
"connections",
"=",
"$",
"this",
"->",
"connections",
"->",
"getActiveConnections",
"(",
")",
";",
"foreach",... | Get the number of servers to wait for
before triggering a promise.
@return int | [
"Get",
"the",
"number",
"of",
"servers",
"to",
"wait",
"for",
"before",
"triggering",
"a",
"promise",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Coordinator.php#L167-L181 | train |
rocketeers/rocketeer | src/Rocketeer/Traits/StepsRunnerTrait.php | StepsRunnerTrait.runSteps | public function runSteps()
{
$steps = $this->steps()->pullSteps();
foreach ($steps as list($method, $arguments)) {
$callable = is_callable($method) ? $method : [$this, $method];
$arguments = (array) $arguments;
$results = $callable(...$arguments);
$results = $this->checkResults($results);
if (!$results) {
return false;
}
}
return true;
} | php | public function runSteps()
{
$steps = $this->steps()->pullSteps();
foreach ($steps as list($method, $arguments)) {
$callable = is_callable($method) ? $method : [$this, $method];
$arguments = (array) $arguments;
$results = $callable(...$arguments);
$results = $this->checkResults($results);
if (!$results) {
return false;
}
}
return true;
} | [
"public",
"function",
"runSteps",
"(",
")",
"{",
"$",
"steps",
"=",
"$",
"this",
"->",
"steps",
"(",
")",
"->",
"pullSteps",
"(",
")",
";",
"foreach",
"(",
"$",
"steps",
"as",
"list",
"(",
"$",
"method",
",",
"$",
"arguments",
")",
")",
"{",
"$",... | Execute an array of calls until one halts.
@return bool | [
"Execute",
"an",
"array",
"of",
"calls",
"until",
"one",
"halts",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Traits/StepsRunnerTrait.php#L45-L60 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Environment/Environment.php | Environment.computeServerVariable | protected function computeServerVariable($variable, callable $callback)
{
$user = $this->config->getContextually('remote.variables.'.$variable);
if ($user) {
return $user;
}
return $this->localStorage->get($this->getVariablePath($variable), $callback);
} | php | protected function computeServerVariable($variable, callable $callback)
{
$user = $this->config->getContextually('remote.variables.'.$variable);
if ($user) {
return $user;
}
return $this->localStorage->get($this->getVariablePath($variable), $callback);
} | [
"protected",
"function",
"computeServerVariable",
"(",
"$",
"variable",
",",
"callable",
"$",
"callback",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'remote.variables.'",
".",
"$",
"variable",
")",
";",
"if",
"(",... | Get a cached server variable or compute it.
@param string $variable
@param callable $callback
@return string | [
"Get",
"a",
"cached",
"server",
"variable",
"or",
"compute",
"it",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Environment/Environment.php#L79-L87 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Environment/Environment.php | Environment.getPhpConstant | protected function getPhpConstant($variable, $constant)
{
return $this->computeServerVariable($variable, function () use ($variable, $constant) {
$value = $this->bash->runRaw('php -r "echo '.$constant.';"');
$this->localStorage->set($this->getVariablePath($variable), $value);
return $value ?: constant($constant);
});
} | php | protected function getPhpConstant($variable, $constant)
{
return $this->computeServerVariable($variable, function () use ($variable, $constant) {
$value = $this->bash->runRaw('php -r "echo '.$constant.';"');
$this->localStorage->set($this->getVariablePath($variable), $value);
return $value ?: constant($constant);
});
} | [
"protected",
"function",
"getPhpConstant",
"(",
"$",
"variable",
",",
"$",
"constant",
")",
"{",
"return",
"$",
"this",
"->",
"computeServerVariable",
"(",
"$",
"variable",
",",
"function",
"(",
")",
"use",
"(",
"$",
"variable",
",",
"$",
"constant",
")",
... | Get a PHP constant from the server.
@param string $variable
@param string $constant
@return string | [
"Get",
"a",
"PHP",
"constant",
"from",
"the",
"server",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Environment/Environment.php#L97-L105 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Storages/Storage.php | Storage.get | public function get($key = null, $fallback = null)
{
$contents = $this->getContents();
return Arr::get($contents, $key, $fallback);
} | php | public function get($key = null, $fallback = null)
{
$contents = $this->getContents();
return Arr::get($contents, $key, $fallback);
} | [
"public",
"function",
"get",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"fallback",
"=",
"null",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"getContents",
"(",
")",
";",
"return",
"Arr",
"::",
"get",
"(",
"$",
"contents",
",",
"$",
"key",
",... | Get a value in storage.
@param string|null $key
@param array|string|callable|null $fallback
@return string|int|array | [
"Get",
"a",
"value",
"in",
"storage",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Storages/Storage.php#L126-L131 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Storages/Storage.php | Storage.set | public function set($key, $value = null)
{
// Set the value on the contents
$contents = (array) $this->getContents();
if (is_array($key)) {
$contents = $key;
} else {
Arr::set($contents, $key, $value);
}
$this->saveContents($contents);
} | php | public function set($key, $value = null)
{
// Set the value on the contents
$contents = (array) $this->getContents();
if (is_array($key)) {
$contents = $key;
} else {
Arr::set($contents, $key, $value);
}
$this->saveContents($contents);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"// Set the value on the contents",
"$",
"contents",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"getContents",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"key"... | Set a value in storage.
@param string|array $key
@param mixed|null $value | [
"Set",
"a",
"value",
"in",
"storage",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Storages/Storage.php#L139-L150 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Storages/Storage.php | Storage.forget | public function forget($key)
{
$contents = $this->getContents();
Arr::forget($contents, $key);
$this->saveContents($contents);
} | php | public function forget($key)
{
$contents = $this->getContents();
Arr::forget($contents, $key);
$this->saveContents($contents);
} | [
"public",
"function",
"forget",
"(",
"$",
"key",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"getContents",
"(",
")",
";",
"Arr",
"::",
"forget",
"(",
"$",
"contents",
",",
"$",
"key",
")",
";",
"$",
"this",
"->",
"saveContents",
"(",
"$",
... | Forget a value from storage.
@param string $key | [
"Forget",
"a",
"value",
"from",
"storage",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Storages/Storage.php#L157-L163 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Storages/Storage.php | Storage.getContents | protected function getContents()
{
// Cancel if the file doesn't exist
if (!$this->getFilesystem()->has($this->getFilepath())) {
return [];
}
// Get and parse file
if ($this->contents === null) {
$this->contents = $this->getFilesystem()->read($this->getFilepath());
$this->contents = json_decode($this->contents, true);
}
return (array) $this->contents;
} | php | protected function getContents()
{
// Cancel if the file doesn't exist
if (!$this->getFilesystem()->has($this->getFilepath())) {
return [];
}
// Get and parse file
if ($this->contents === null) {
$this->contents = $this->getFilesystem()->read($this->getFilepath());
$this->contents = json_decode($this->contents, true);
}
return (array) $this->contents;
} | [
"protected",
"function",
"getContents",
"(",
")",
"{",
"// Cancel if the file doesn't exist",
"if",
"(",
"!",
"$",
"this",
"->",
"getFilesystem",
"(",
")",
"->",
"has",
"(",
"$",
"this",
"->",
"getFilepath",
"(",
")",
")",
")",
"{",
"return",
"[",
"]",
"... | Get the full contents of the storage file.
@return array | [
"Get",
"the",
"full",
"contents",
"of",
"the",
"storage",
"file",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Storages/Storage.php#L170-L184 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Storages/Storage.php | Storage.saveContents | protected function saveContents($contents)
{
$this->contents = $contents;
try {
$this->getFilesystem()->put($this->getFilepath(), json_encode($contents));
} catch (Exception $e) {
// ...
}
} | php | protected function saveContents($contents)
{
$this->contents = $contents;
try {
$this->getFilesystem()->put($this->getFilepath(), json_encode($contents));
} catch (Exception $e) {
// ...
}
} | [
"protected",
"function",
"saveContents",
"(",
"$",
"contents",
")",
"{",
"$",
"this",
"->",
"contents",
"=",
"$",
"contents",
";",
"try",
"{",
"$",
"this",
"->",
"getFilesystem",
"(",
")",
"->",
"put",
"(",
"$",
"this",
"->",
"getFilepath",
"(",
")",
... | Save the contents of the storage file.
@param array $contents | [
"Save",
"the",
"contents",
"of",
"the",
"storage",
"file",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Storages/Storage.php#L191-L200 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Storages/Storage.php | Storage.destroy | public function destroy()
{
$this->contents = [];
$filepath = $this->getFilepath();
if ($this->getFilesystem()->has($filepath)) {
return $this->getFilesystem()->delete($filepath);
}
} | php | public function destroy()
{
$this->contents = [];
$filepath = $this->getFilepath();
if ($this->getFilesystem()->has($filepath)) {
return $this->getFilesystem()->delete($filepath);
}
} | [
"public",
"function",
"destroy",
"(",
")",
"{",
"$",
"this",
"->",
"contents",
"=",
"[",
"]",
";",
"$",
"filepath",
"=",
"$",
"this",
"->",
"getFilepath",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getFilesystem",
"(",
")",
"->",
"has",
"(",
"... | Destroy the storage file.
@return bool | [
"Destroy",
"the",
"storage",
"file",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Storages/Storage.php#L207-L215 | train |
rocketeers/rocketeer | src/Rocketeer/Traits/SluggableTrait.php | SluggableTrait.getName | public function getName()
{
return isset($this->name) && $this->name ? $this->name : class_basename($this);
} | php | public function getName()
{
return isset($this->name) && $this->name ? $this->name : class_basename($this);
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"name",
")",
"&&",
"$",
"this",
"->",
"name",
"?",
"$",
"this",
"->",
"name",
":",
"class_basename",
"(",
"$",
"this",
")",
";",
"}"
] | Get the name of the entity.
@return string | [
"Get",
"the",
"name",
"of",
"the",
"entity",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Traits/SluggableTrait.php#L31-L34 | train |
rocketeers/rocketeer | src/Rocketeer/Traits/SluggableTrait.php | SluggableTrait.getSlug | public function getSlug()
{
$name = $this->getName();
if (!isset($this->slugs[$name])) {
$slug = Str::snake($name, '-');
$this->slugs[$name] = Str::slug($slug);
}
return $this->slugs[$name];
} | php | public function getSlug()
{
$name = $this->getName();
if (!isset($this->slugs[$name])) {
$slug = Str::snake($name, '-');
$this->slugs[$name] = Str::slug($slug);
}
return $this->slugs[$name];
} | [
"public",
"function",
"getSlug",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"slugs",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"slug",
"=",
"Str",
"::",
"sna... | Get the basic name of the entity.
@return string | [
"Get",
"the",
"basic",
"name",
"of",
"the",
"entity",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Traits/SluggableTrait.php#L41-L50 | train |
rocketeers/rocketeer | src/Rocketeer/Tasks/Check.php | Check.checkVcs | public function checkVcs()
{
// Cancel if not using any VCS
if (mb_strtolower($this->config->getContextually('strategies.create-release')) !== 'clone') {
return true;
}
$this->explainer->line('Checking presence of '.$this->vcs->getBinary());
$results = $this->vcs->run('check');
$this->toOutput($results);
$isPresent = $this->status();
if (!$isPresent) {
$this->explainer->error($this->vcs->getBinary().' could not be found');
}
return $isPresent;
} | php | public function checkVcs()
{
// Cancel if not using any VCS
if (mb_strtolower($this->config->getContextually('strategies.create-release')) !== 'clone') {
return true;
}
$this->explainer->line('Checking presence of '.$this->vcs->getBinary());
$results = $this->vcs->run('check');
$this->toOutput($results);
$isPresent = $this->status();
if (!$isPresent) {
$this->explainer->error($this->vcs->getBinary().' could not be found');
}
return $isPresent;
} | [
"public",
"function",
"checkVcs",
"(",
")",
"{",
"// Cancel if not using any VCS",
"if",
"(",
"mb_strtolower",
"(",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'strategies.create-release'",
")",
")",
"!==",
"'clone'",
")",
"{",
"return",
"true",
... | Check the presence of an VCS on the server.
@return bool | [
"Check",
"the",
"presence",
"of",
"an",
"VCS",
"on",
"the",
"server",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Tasks/Check.php#L63-L80 | train |
rocketeers/rocketeer | src/Rocketeer/Strategies/Rollback/RollingStrategy.php | RollingStrategy.getRollbackRelease | protected function getRollbackRelease()
{
$release = $this->command->argument('release');
if (!$release) {
$release = $this->releasesManager->getPreviousRelease();
}
return (string) $release;
} | php | protected function getRollbackRelease()
{
$release = $this->command->argument('release');
if (!$release) {
$release = $this->releasesManager->getPreviousRelease();
}
return (string) $release;
} | [
"protected",
"function",
"getRollbackRelease",
"(",
")",
"{",
"$",
"release",
"=",
"$",
"this",
"->",
"command",
"->",
"argument",
"(",
"'release'",
")",
";",
"if",
"(",
"!",
"$",
"release",
")",
"{",
"$",
"release",
"=",
"$",
"this",
"->",
"releasesMa... | Get the release to rollback to.
@return int|null | [
"Get",
"the",
"release",
"to",
"rollback",
"to",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Strategies/Rollback/RollingStrategy.php#L64-L72 | train |
rocketeers/rocketeer | src/Rocketeer/Tasks/AbstractTask.php | AbstractTask.setName | public function setName($name)
{
$this->name = is_string($name) ? ucfirst($name) : $this->name;
} | php | public function setName($name)
{
$this->name = is_string($name) ? ucfirst($name) : $this->name;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"is_string",
"(",
"$",
"name",
")",
"?",
"ucfirst",
"(",
"$",
"name",
")",
":",
"$",
"this",
"->",
"name",
";",
"}"
] | Change the task's name.
@param string $name | [
"Change",
"the",
"task",
"s",
"name",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Tasks/AbstractTask.php#L99-L102 | train |
rocketeers/rocketeer | src/Rocketeer/Strategies/Deploy/AbstractLocalDeployStrategy.php | AbstractLocalDeployStrategy.deploy | public function deploy()
{
$isFtp = $this->connections->getCurrentConnectionKey()->isFtp();
$from = $this->on('dummy', function () {
$this->setupIfNecessary();
$this->executeTask('CreateRelease');
$this->executeTask('PrepareRelease');
return $this->releasesManager->getCurrentReleasePath();
});
$to = $isFtp
? $this->paths->getFolder()
: $this->releasesManager->getCurrentReleasePath();
return $this->onReleaseReady($from, $to);
} | php | public function deploy()
{
$isFtp = $this->connections->getCurrentConnectionKey()->isFtp();
$from = $this->on('dummy', function () {
$this->setupIfNecessary();
$this->executeTask('CreateRelease');
$this->executeTask('PrepareRelease');
return $this->releasesManager->getCurrentReleasePath();
});
$to = $isFtp
? $this->paths->getFolder()
: $this->releasesManager->getCurrentReleasePath();
return $this->onReleaseReady($from, $to);
} | [
"public",
"function",
"deploy",
"(",
")",
"{",
"$",
"isFtp",
"=",
"$",
"this",
"->",
"connections",
"->",
"getCurrentConnectionKey",
"(",
")",
"->",
"isFtp",
"(",
")",
";",
"$",
"from",
"=",
"$",
"this",
"->",
"on",
"(",
"'dummy'",
",",
"function",
"... | Prepare a release and mark it as deployed.
@return bool | [
"Prepare",
"a",
"release",
"and",
"mark",
"it",
"as",
"deployed",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Strategies/Deploy/AbstractLocalDeployStrategy.php#L27-L44 | train |
rocketeers/rocketeer | src/Rocketeer/Plugins/AbstractNotifier.php | AbstractNotifier.onQueue | public function onQueue(TasksHandler $tasks)
{
// Create the task instance
$notify = new Notify($this->container);
$notify->setNotifier($this);
$tasks->addTaskListeners('deploy', 'before', [clone $notify], -10);
$tasks->addTaskListeners('deploy', 'after', [clone $notify], -10);
$tasks->addTaskListeners('deploy', 'halt', [clone $notify], -10);
$tasks->addTaskListeners('rollback', 'after', [clone $notify], -10);
} | php | public function onQueue(TasksHandler $tasks)
{
// Create the task instance
$notify = new Notify($this->container);
$notify->setNotifier($this);
$tasks->addTaskListeners('deploy', 'before', [clone $notify], -10);
$tasks->addTaskListeners('deploy', 'after', [clone $notify], -10);
$tasks->addTaskListeners('deploy', 'halt', [clone $notify], -10);
$tasks->addTaskListeners('rollback', 'after', [clone $notify], -10);
} | [
"public",
"function",
"onQueue",
"(",
"TasksHandler",
"$",
"tasks",
")",
"{",
"// Create the task instance",
"$",
"notify",
"=",
"new",
"Notify",
"(",
"$",
"this",
"->",
"container",
")",
";",
"$",
"notify",
"->",
"setNotifier",
"(",
"$",
"this",
")",
";",... | Register Tasks with Rocketeer.
@param \Rocketeer\Services\Tasks\TasksHandler $tasks | [
"Register",
"Tasks",
"with",
"Rocketeer",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Plugins/AbstractNotifier.php#L28-L38 | train |
rocketeers/rocketeer | src/Rocketeer/Tasks/Migrate.php | Migrate.runStrategyCommand | protected function runStrategyCommand($method, $message)
{
if (!$this->getOption($method)) {
return;
}
$this->explainer->line($message);
$this->results[] = $this->strategy->$method();
} | php | protected function runStrategyCommand($method, $message)
{
if (!$this->getOption($method)) {
return;
}
$this->explainer->line($message);
$this->results[] = $this->strategy->$method();
} | [
"protected",
"function",
"runStrategyCommand",
"(",
"$",
"method",
",",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getOption",
"(",
"$",
"method",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"explainer",
"->",
"line",
"("... | Run a method on the strategy if asked to.
@param string $method
@param string $message | [
"Run",
"a",
"method",
"on",
"the",
"strategy",
"if",
"asked",
"to",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Tasks/Migrate.php#L73-L81 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getReleases | public function getReleases()
{
// Get releases on server
$connection = $this->connections->getCurrentConnectionKey()->toHandle();
if (!array_key_exists($connection, $this->releases)) {
$releases = $this->paths->getReleasesFolder();
$releases = (array) $this->bash->listContents($releases);
// Filter and sort releases
$releases = array_filter($releases, function ($release) {
return $this->isRelease($release);
});
rsort($releases);
$this->releases[$connection] = (array) $releases;
}
return $this->releases[$connection];
} | php | public function getReleases()
{
// Get releases on server
$connection = $this->connections->getCurrentConnectionKey()->toHandle();
if (!array_key_exists($connection, $this->releases)) {
$releases = $this->paths->getReleasesFolder();
$releases = (array) $this->bash->listContents($releases);
// Filter and sort releases
$releases = array_filter($releases, function ($release) {
return $this->isRelease($release);
});
rsort($releases);
$this->releases[$connection] = (array) $releases;
}
return $this->releases[$connection];
} | [
"public",
"function",
"getReleases",
"(",
")",
"{",
"// Get releases on server",
"$",
"connection",
"=",
"$",
"this",
"->",
"connections",
"->",
"getCurrentConnectionKey",
"(",
")",
"->",
"toHandle",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",... | Get all the releases on the server.
@return int[] | [
"Get",
"all",
"the",
"releases",
"on",
"the",
"server",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L67-L86 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getDeprecatedReleases | public function getDeprecatedReleases($treshold = null)
{
$releases = $this->getReleases();
$treshold = $treshold ?: $this->config->get('remote.keep_releases');
// Get first X valid releases
$keep = $this->getValidReleases();
$keep = array_slice($keep, 0, $treshold);
// Compute diff
$deprecated = array_diff($releases, $keep);
$deprecated = array_values($deprecated);
return $deprecated;
} | php | public function getDeprecatedReleases($treshold = null)
{
$releases = $this->getReleases();
$treshold = $treshold ?: $this->config->get('remote.keep_releases');
// Get first X valid releases
$keep = $this->getValidReleases();
$keep = array_slice($keep, 0, $treshold);
// Compute diff
$deprecated = array_diff($releases, $keep);
$deprecated = array_values($deprecated);
return $deprecated;
} | [
"public",
"function",
"getDeprecatedReleases",
"(",
"$",
"treshold",
"=",
"null",
")",
"{",
"$",
"releases",
"=",
"$",
"this",
"->",
"getReleases",
"(",
")",
";",
"$",
"treshold",
"=",
"$",
"treshold",
"?",
":",
"$",
"this",
"->",
"config",
"->",
"get"... | Get an array of deprecated releases.
@param int|null $treshold
@return int[] | [
"Get",
"an",
"array",
"of",
"deprecated",
"releases",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L116-L130 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getInvalidReleases | public function getInvalidReleases()
{
$releases = $this->getReleases();
$invalid = array_diff($this->state, array_filter($this->state));
$invalid = array_keys($invalid);
return array_intersect($releases, $invalid);
} | php | public function getInvalidReleases()
{
$releases = $this->getReleases();
$invalid = array_diff($this->state, array_filter($this->state));
$invalid = array_keys($invalid);
return array_intersect($releases, $invalid);
} | [
"public",
"function",
"getInvalidReleases",
"(",
")",
"{",
"$",
"releases",
"=",
"$",
"this",
"->",
"getReleases",
"(",
")",
";",
"$",
"invalid",
"=",
"array_diff",
"(",
"$",
"this",
"->",
"state",
",",
"array_filter",
"(",
"$",
"this",
"->",
"state",
... | Get an array of invalid releases.
@return int[] | [
"Get",
"an",
"array",
"of",
"invalid",
"releases",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L150-L157 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getCurrentReleasePath | public function getCurrentReleasePath($folder = null)
{
if ($folder) {
$folder = '/'.$folder;
}
return $this->getPathToRelease($this->getCurrentRelease().$folder);
} | php | public function getCurrentReleasePath($folder = null)
{
if ($folder) {
$folder = '/'.$folder;
}
return $this->getPathToRelease($this->getCurrentRelease().$folder);
} | [
"public",
"function",
"getCurrentReleasePath",
"(",
"$",
"folder",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"folder",
")",
"{",
"$",
"folder",
"=",
"'/'",
".",
"$",
"folder",
";",
"}",
"return",
"$",
"this",
"->",
"getPathToRelease",
"(",
"$",
"this",
... | Get the path to the current release.
@param string|null $folder A folder in the release
@return string | [
"Get",
"the",
"path",
"to",
"the",
"current",
"release",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L182-L189 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getValidationFile | public function getValidationFile()
{
$file = (array) $this->remoteStorage->get();
// Fill the missing releases
$releases = $this->getReleases();
$releases = array_fill_keys($releases, false);
// Sort entries
ksort($file);
ksort($releases);
// Replace and resort
$releases = array_replace($releases, $file);
krsort($releases);
return $releases;
} | php | public function getValidationFile()
{
$file = (array) $this->remoteStorage->get();
// Fill the missing releases
$releases = $this->getReleases();
$releases = array_fill_keys($releases, false);
// Sort entries
ksort($file);
ksort($releases);
// Replace and resort
$releases = array_replace($releases, $file);
krsort($releases);
return $releases;
} | [
"public",
"function",
"getValidationFile",
"(",
")",
"{",
"$",
"file",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"remoteStorage",
"->",
"get",
"(",
")",
";",
"// Fill the missing releases",
"$",
"releases",
"=",
"$",
"this",
"->",
"getReleases",
"(",
")",... | Get the validation file.
@return array | [
"Get",
"the",
"validation",
"file",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L200-L217 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.markRelease | public function markRelease($release = null, $state = true)
{
$release = $release ?: $this->getCurrentRelease();
// If the release is not null, mark it as valid
if ($release) {
$this->state[$release] = $state;
$this->remoteStorage->set($release, $state);
krsort($this->state);
}
} | php | public function markRelease($release = null, $state = true)
{
$release = $release ?: $this->getCurrentRelease();
// If the release is not null, mark it as valid
if ($release) {
$this->state[$release] = $state;
$this->remoteStorage->set($release, $state);
krsort($this->state);
}
} | [
"public",
"function",
"markRelease",
"(",
"$",
"release",
"=",
"null",
",",
"$",
"state",
"=",
"true",
")",
"{",
"$",
"release",
"=",
"$",
"release",
"?",
":",
"$",
"this",
"->",
"getCurrentRelease",
"(",
")",
";",
"// If the release is not null, mark it as ... | Assign a state to a release.
@param string|null $release
@param bool $state | [
"Assign",
"a",
"state",
"to",
"a",
"release",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L225-L235 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getCurrentRelease | public function getCurrentRelease()
{
$current = Arr::get($this->getValidReleases(), 0);
$current = $this->sanitizeRelease($current);
return $this->nextRelease ?: $current;
} | php | public function getCurrentRelease()
{
$current = Arr::get($this->getValidReleases(), 0);
$current = $this->sanitizeRelease($current);
return $this->nextRelease ?: $current;
} | [
"public",
"function",
"getCurrentRelease",
"(",
")",
"{",
"$",
"current",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"getValidReleases",
"(",
")",
",",
"0",
")",
";",
"$",
"current",
"=",
"$",
"this",
"->",
"sanitizeRelease",
"(",
"$",
"current",... | Get the current release.
@return string|int|null | [
"Get",
"the",
"current",
"release",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L268-L274 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getPreviousRelease | public function getPreviousRelease($release = null)
{
// Get all releases and the current one
$releases = $this->getReleases();
$current = $release ?: $this->getCurrentRelease();
// Get the one before that, or default to current
$key = array_search($current, $releases, true);
$key = !is_int($key) ? -1 : $key;
$next = 1;
do {
$release = Arr::get($releases, $key + $next);
++$next;
} while (!$this->checkReleaseState($release) && isset($this->state[$release]));
return $release ?: $current;
} | php | public function getPreviousRelease($release = null)
{
// Get all releases and the current one
$releases = $this->getReleases();
$current = $release ?: $this->getCurrentRelease();
// Get the one before that, or default to current
$key = array_search($current, $releases, true);
$key = !is_int($key) ? -1 : $key;
$next = 1;
do {
$release = Arr::get($releases, $key + $next);
++$next;
} while (!$this->checkReleaseState($release) && isset($this->state[$release]));
return $release ?: $current;
} | [
"public",
"function",
"getPreviousRelease",
"(",
"$",
"release",
"=",
"null",
")",
"{",
"// Get all releases and the current one",
"$",
"releases",
"=",
"$",
"this",
"->",
"getReleases",
"(",
")",
";",
"$",
"current",
"=",
"$",
"release",
"?",
":",
"$",
"thi... | Get the release before the current one.
@param string|null $release A release name
@return string | [
"Get",
"the",
"release",
"before",
"the",
"current",
"one",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L283-L299 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Releases/ReleasesManager.php | ReleasesManager.getNextRelease | public function getNextRelease()
{
if (!$this->nextRelease) {
$manual = $this->getOption('release');
$manual = $this->isRelease($manual) ? $manual : null;
$this->nextRelease = $manual ?: $this->bash->getTimestamp();
}
return $this->nextRelease;
} | php | public function getNextRelease()
{
if (!$this->nextRelease) {
$manual = $this->getOption('release');
$manual = $this->isRelease($manual) ? $manual : null;
$this->nextRelease = $manual ?: $this->bash->getTimestamp();
}
return $this->nextRelease;
} | [
"public",
"function",
"getNextRelease",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nextRelease",
")",
"{",
"$",
"manual",
"=",
"$",
"this",
"->",
"getOption",
"(",
"'release'",
")",
";",
"$",
"manual",
"=",
"$",
"this",
"->",
"isRelease",
"("... | Get the next release to come.
@return string | [
"Get",
"the",
"next",
"release",
"to",
"come",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Releases/ReleasesManager.php#L306-L316 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.execute | public function execute($queue, $connections = null)
{
if ($connections) {
$this->connections->setActiveConnections($connections);
}
// Run tasks
$this->run($queue);
$history = $this->history->getFlattenedOutput();
return end($history);
} | php | public function execute($queue, $connections = null)
{
if ($connections) {
$this->connections->setActiveConnections($connections);
}
// Run tasks
$this->run($queue);
$history = $this->history->getFlattenedOutput();
return end($history);
} | [
"public",
"function",
"execute",
"(",
"$",
"queue",
",",
"$",
"connections",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"connections",
")",
"{",
"$",
"this",
"->",
"connections",
"->",
"setActiveConnections",
"(",
"$",
"connections",
")",
";",
"}",
"// Run t... | Execute Tasks on the default connection and
return their output.
@param string|array|Closure $queue
@param string|string[]|null $connections
@return string|string[]|false | [
"Execute",
"Tasks",
"on",
"the",
"default",
"connection",
"and",
"return",
"their",
"output",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L65-L76 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.run | public function run($tasks)
{
$tasks = is_array($tasks) ? $tasks : [$tasks];
$queue = $this->builder->buildTasks($tasks);
$pipeline = $this->buildPipeline($queue);
// Wrap job in closure pipeline
foreach ($pipeline as $key => $job) {
$pipeline[$key] = function () use ($job) {
return $this->executeJob($job);
};
}
// Run the tasks and store the results
if ($this->getOption('parallel')) {
$pipeline = $this->runAsynchronously($pipeline);
} else {
$pipeline = $this->runSynchronously($pipeline);
}
return $pipeline;
} | php | public function run($tasks)
{
$tasks = is_array($tasks) ? $tasks : [$tasks];
$queue = $this->builder->buildTasks($tasks);
$pipeline = $this->buildPipeline($queue);
// Wrap job in closure pipeline
foreach ($pipeline as $key => $job) {
$pipeline[$key] = function () use ($job) {
return $this->executeJob($job);
};
}
// Run the tasks and store the results
if ($this->getOption('parallel')) {
$pipeline = $this->runAsynchronously($pipeline);
} else {
$pipeline = $this->runSynchronously($pipeline);
}
return $pipeline;
} | [
"public",
"function",
"run",
"(",
"$",
"tasks",
")",
"{",
"$",
"tasks",
"=",
"is_array",
"(",
"$",
"tasks",
")",
"?",
"$",
"tasks",
":",
"[",
"$",
"tasks",
"]",
";",
"$",
"queue",
"=",
"$",
"this",
"->",
"builder",
"->",
"buildTasks",
"(",
"$",
... | Run the queue
Run an array of Tasks instances on the various
connections and stages provided.
@param string|array $tasks An array of tasks
@throws Exception
@return Pipeline | [
"Run",
"the",
"queue",
"Run",
"an",
"array",
"of",
"Tasks",
"instances",
"on",
"the",
"various",
"connections",
"and",
"stages",
"provided",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L106-L127 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.buildPipeline | public function buildPipeline(array $queue)
{
// First we'll build the queue
$pipeline = new Pipeline();
// Get the connections to execute the tasks on
/** @var ConnectionInterface[] $connections */
$connections = $this->connections->getActiveConnections();
foreach ($connections as $connection) {
$connectionKey = $connection->getConnectionKey();
$stages = $this->getStages($connectionKey);
// Add job to pipeline
foreach ($stages as $stage) {
$connectionKey->stage = $stage;
$pipeline[] = new Job([
'connectionKey' => clone $connectionKey,
'queue' => $queue,
]);
}
}
return $pipeline;
} | php | public function buildPipeline(array $queue)
{
// First we'll build the queue
$pipeline = new Pipeline();
// Get the connections to execute the tasks on
/** @var ConnectionInterface[] $connections */
$connections = $this->connections->getActiveConnections();
foreach ($connections as $connection) {
$connectionKey = $connection->getConnectionKey();
$stages = $this->getStages($connectionKey);
// Add job to pipeline
foreach ($stages as $stage) {
$connectionKey->stage = $stage;
$pipeline[] = new Job([
'connectionKey' => clone $connectionKey,
'queue' => $queue,
]);
}
}
return $pipeline;
} | [
"public",
"function",
"buildPipeline",
"(",
"array",
"$",
"queue",
")",
"{",
"// First we'll build the queue",
"$",
"pipeline",
"=",
"new",
"Pipeline",
"(",
")",
";",
"// Get the connections to execute the tasks on",
"/** @var ConnectionInterface[] $connections */",
"$",
"c... | Build a pipeline of jobs for Parallel to execute.
@param array $queue
@return Pipeline | [
"Build",
"a",
"pipeline",
"of",
"jobs",
"for",
"Parallel",
"to",
"execute",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L136-L160 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.executeJob | public function executeJob(Job $job)
{
// Set proper server
$connectionKey = $job->connectionKey;
$this->connections->setCurrentConnection($connectionKey);
foreach ($job->queue as $key => $task) {
if ($task->usesStages()) {
$stage = $task->usesStages() ? $connectionKey->stage : null;
$this->connections->setStage($stage);
}
// Check if the current server can run the task
if (!$this->connections->getCurrentConnection()->isCompatibleWith($task)) {
continue;
}
// Here we fire the task, save its
// output and return its status
$state = $task->fire();
$this->toOutput($state);
// If the task didn't finish, display what the error was
if ($task->wasHalted() || $state === false) {
$this->explainer->error('The tasks queue was canceled by task "'.$task->getName().'"');
return false;
}
}
return true;
} | php | public function executeJob(Job $job)
{
// Set proper server
$connectionKey = $job->connectionKey;
$this->connections->setCurrentConnection($connectionKey);
foreach ($job->queue as $key => $task) {
if ($task->usesStages()) {
$stage = $task->usesStages() ? $connectionKey->stage : null;
$this->connections->setStage($stage);
}
// Check if the current server can run the task
if (!$this->connections->getCurrentConnection()->isCompatibleWith($task)) {
continue;
}
// Here we fire the task, save its
// output and return its status
$state = $task->fire();
$this->toOutput($state);
// If the task didn't finish, display what the error was
if ($task->wasHalted() || $state === false) {
$this->explainer->error('The tasks queue was canceled by task "'.$task->getName().'"');
return false;
}
}
return true;
} | [
"public",
"function",
"executeJob",
"(",
"Job",
"$",
"job",
")",
"{",
"// Set proper server",
"$",
"connectionKey",
"=",
"$",
"job",
"->",
"connectionKey",
";",
"$",
"this",
"->",
"connections",
"->",
"setCurrentConnection",
"(",
"$",
"connectionKey",
")",
";"... | Run the queue, taking into account the stage.
@param Job $job
@return bool | [
"Run",
"the",
"queue",
"taking",
"into",
"account",
"the",
"stage",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L169-L200 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.runSynchronously | protected function runSynchronously(Pipeline $pipeline)
{
$results = [];
/** @var Closure $task */
foreach ($pipeline as $key => $task) {
$results[$key] = $this->bash->checkResults($task());
if (!$results[$key]) {
break;
}
}
// Update Pipeline results
$pipeline->setResults($results);
return $pipeline;
} | php | protected function runSynchronously(Pipeline $pipeline)
{
$results = [];
/** @var Closure $task */
foreach ($pipeline as $key => $task) {
$results[$key] = $this->bash->checkResults($task());
if (!$results[$key]) {
break;
}
}
// Update Pipeline results
$pipeline->setResults($results);
return $pipeline;
} | [
"protected",
"function",
"runSynchronously",
"(",
"Pipeline",
"$",
"pipeline",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"/** @var Closure $task */",
"foreach",
"(",
"$",
"pipeline",
"as",
"$",
"key",
"=>",
"$",
"task",
")",
"{",
"$",
"results",
"[",
... | Run the pipeline in order.
As long as the previous entry didn't fail, continue.
@param Pipeline $pipeline
@return Pipeline | [
"Run",
"the",
"pipeline",
"in",
"order",
".",
"As",
"long",
"as",
"the",
"previous",
"entry",
"didn",
"t",
"fail",
"continue",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L214-L230 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.runAsynchronously | protected function runAsynchronously(Pipeline $pipeline)
{
$this->parallel = $this->parallel ?: new Parallel();
// Check if supported
if (!$this->parallel->isSupported()) {
throw new Exception('Parallel jobs require the PCNTL extension');
}
try {
$results = $this->parallel->values($pipeline->all());
$pipeline->setResults($results);
} catch (LogicException $exception) {
return $this->runSynchronously($pipeline);
}
return $pipeline;
} | php | protected function runAsynchronously(Pipeline $pipeline)
{
$this->parallel = $this->parallel ?: new Parallel();
// Check if supported
if (!$this->parallel->isSupported()) {
throw new Exception('Parallel jobs require the PCNTL extension');
}
try {
$results = $this->parallel->values($pipeline->all());
$pipeline->setResults($results);
} catch (LogicException $exception) {
return $this->runSynchronously($pipeline);
}
return $pipeline;
} | [
"protected",
"function",
"runAsynchronously",
"(",
"Pipeline",
"$",
"pipeline",
")",
"{",
"$",
"this",
"->",
"parallel",
"=",
"$",
"this",
"->",
"parallel",
"?",
":",
"new",
"Parallel",
"(",
")",
";",
"// Check if supported",
"if",
"(",
"!",
"$",
"this",
... | Run the pipeline in parallel order.
@param Pipeline $pipeline
@throws \Exception
@return Pipeline | [
"Run",
"the",
"pipeline",
"in",
"parallel",
"order",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L241-L258 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Tasks/TasksQueue.php | TasksQueue.getStages | public function getStages($connection)
{
$this->connections->setCurrentConnection($connection);
$stage = $this->config->getContextually('stages.default');
if ($this->hasCommand()) {
$stage = $this->getOption('stage') ?: $stage;
}
// Return all stages if "all"
if ($stage === 'all' || !$stage) {
$stage = $this->connections->getAvailableStages();
}
// Sanitize and filter
$stages = (array) $stage;
$stages = array_filter($stages, [$this, 'isValidStage']);
return $stages ?: [null];
} | php | public function getStages($connection)
{
$this->connections->setCurrentConnection($connection);
$stage = $this->config->getContextually('stages.default');
if ($this->hasCommand()) {
$stage = $this->getOption('stage') ?: $stage;
}
// Return all stages if "all"
if ($stage === 'all' || !$stage) {
$stage = $this->connections->getAvailableStages();
}
// Sanitize and filter
$stages = (array) $stage;
$stages = array_filter($stages, [$this, 'isValidStage']);
return $stages ?: [null];
} | [
"public",
"function",
"getStages",
"(",
"$",
"connection",
")",
"{",
"$",
"this",
"->",
"connections",
"->",
"setCurrentConnection",
"(",
"$",
"connection",
")",
";",
"$",
"stage",
"=",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'stages.defa... | Get the stages of a connection.
@param string $connection
@return array | [
"Get",
"the",
"stages",
"of",
"a",
"connection",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Tasks/TasksQueue.php#L271-L290 | train |
rocketeers/rocketeer | src/Rocketeer/Traits/Properties/HasEventsTrait.php | HasEventsTrait.halt | public function halt($errors = null)
{
// Display errors
if ($errors) {
$this->explainer->error($errors);
}
$this->fireEvent('halt');
$this->halted = true;
if ($this->event) {
$this->getEvent()->stopPropagation();
}
return false;
} | php | public function halt($errors = null)
{
// Display errors
if ($errors) {
$this->explainer->error($errors);
}
$this->fireEvent('halt');
$this->halted = true;
if ($this->event) {
$this->getEvent()->stopPropagation();
}
return false;
} | [
"public",
"function",
"halt",
"(",
"$",
"errors",
"=",
"null",
")",
"{",
"// Display errors",
"if",
"(",
"$",
"errors",
")",
"{",
"$",
"this",
"->",
"explainer",
"->",
"error",
"(",
"$",
"errors",
")",
";",
"}",
"$",
"this",
"->",
"fireEvent",
"(",
... | Cancel the task.
@param string|null $errors Potential errors to display
@return bool | [
"Cancel",
"the",
"task",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Traits/Properties/HasEventsTrait.php#L87-L102 | train |
rocketeers/rocketeer | src/Rocketeer/Traits/Properties/HasEventsTrait.php | HasEventsTrait.fireEvent | public function fireEvent($event)
{
$handle = $this->getQualifiedEvent($event);
// Fire the event
/** @var \League\Event\EventInterface $event */
$event = $this->explainer->displayBelow(function () use ($handle) {
return $this->events->emit($handle, [$this]);
});
// If the event returned a strict false, halt the task
$wasHalted = $event && $event->isPropagationStopped();
if ($wasHalted && $event !== 'halt' && method_exists($this, 'halt')) {
$this->halt();
}
return !$wasHalted;
} | php | public function fireEvent($event)
{
$handle = $this->getQualifiedEvent($event);
// Fire the event
/** @var \League\Event\EventInterface $event */
$event = $this->explainer->displayBelow(function () use ($handle) {
return $this->events->emit($handle, [$this]);
});
// If the event returned a strict false, halt the task
$wasHalted = $event && $event->isPropagationStopped();
if ($wasHalted && $event !== 'halt' && method_exists($this, 'halt')) {
$this->halt();
}
return !$wasHalted;
} | [
"public",
"function",
"fireEvent",
"(",
"$",
"event",
")",
"{",
"$",
"handle",
"=",
"$",
"this",
"->",
"getQualifiedEvent",
"(",
"$",
"event",
")",
";",
"// Fire the event",
"/** @var \\League\\Event\\EventInterface $event */",
"$",
"event",
"=",
"$",
"this",
"-... | Fire an event related to this task.
@param string $event
@return bool | [
"Fire",
"an",
"event",
"related",
"to",
"this",
"task",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Traits/Properties/HasEventsTrait.php#L147-L164 | train |
rocketeers/rocketeer | src/Rocketeer/Strategies/Dependencies/AbstractDependenciesStrategy.php | AbstractDependenciesStrategy.install | public function install()
{
$this->shareDependenciesFolder();
return $this->runWithBeforeAfterEvents(function () {
return $this->getBinary()->runForApplication('install', [], $this->getInstallationOptions('install'));
});
} | php | public function install()
{
$this->shareDependenciesFolder();
return $this->runWithBeforeAfterEvents(function () {
return $this->getBinary()->runForApplication('install', [], $this->getInstallationOptions('install'));
});
} | [
"public",
"function",
"install",
"(",
")",
"{",
"$",
"this",
"->",
"shareDependenciesFolder",
"(",
")",
";",
"return",
"$",
"this",
"->",
"runWithBeforeAfterEvents",
"(",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getBinary",
"(",
")",
"->",
... | Install the dependencies.
@return bool | [
"Install",
"the",
"dependencies",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Strategies/Dependencies/AbstractDependenciesStrategy.php#L60-L67 | train |
rocketeers/rocketeer | src/Rocketeer/Strategies/Dependencies/AbstractDependenciesStrategy.php | AbstractDependenciesStrategy.shareDependenciesFolder | protected function shareDependenciesFolder()
{
$folder = $this->getBinary()->getDependenciesFolder();
$sharedDependencies = $this->getOption('shared_dependencies', true);
if (!$sharedDependencies || !$folder) {
return;
}
if ($sharedDependencies === 'copy') {
$this->bash->copyFromPreviousRelease($folder);
} else {
$this->bash->share($folder);
}
} | php | protected function shareDependenciesFolder()
{
$folder = $this->getBinary()->getDependenciesFolder();
$sharedDependencies = $this->getOption('shared_dependencies', true);
if (!$sharedDependencies || !$folder) {
return;
}
if ($sharedDependencies === 'copy') {
$this->bash->copyFromPreviousRelease($folder);
} else {
$this->bash->share($folder);
}
} | [
"protected",
"function",
"shareDependenciesFolder",
"(",
")",
"{",
"$",
"folder",
"=",
"$",
"this",
"->",
"getBinary",
"(",
")",
"->",
"getDependenciesFolder",
"(",
")",
";",
"$",
"sharedDependencies",
"=",
"$",
"this",
"->",
"getOption",
"(",
"'shared_depende... | Share the dependencies folder if possible. | [
"Share",
"the",
"dependencies",
"folder",
"if",
"possible",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Strategies/Dependencies/AbstractDependenciesStrategy.php#L88-L101 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php | RepositoriesKeychain.getCurrentRepository | public function getCurrentRepository()
{
$credentials = $this->getRepositoryCredentials();
$credentials['repository'] = $this->getRepositoryEndpoint();
$credentials['branch'] = $this->getRepositoryBranch();
return new RepositoryKey($credentials);
} | php | public function getCurrentRepository()
{
$credentials = $this->getRepositoryCredentials();
$credentials['repository'] = $this->getRepositoryEndpoint();
$credentials['branch'] = $this->getRepositoryBranch();
return new RepositoryKey($credentials);
} | [
"public",
"function",
"getCurrentRepository",
"(",
")",
"{",
"$",
"credentials",
"=",
"$",
"this",
"->",
"getRepositoryCredentials",
"(",
")",
";",
"$",
"credentials",
"[",
"'repository'",
"]",
"=",
"$",
"this",
"->",
"getRepositoryEndpoint",
"(",
")",
";",
... | Get the current repository in use.
@return RepositoryKey | [
"Get",
"the",
"current",
"repository",
"in",
"use",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php#L29-L36 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php | RepositoriesKeychain.getRepositoryCredentials | protected function getRepositoryCredentials()
{
$config = (array) $this->config->getContextually('vcs');
$credentials = (array) $this->localStorage->get('credentials');
return array_merge($config, $credentials);
} | php | protected function getRepositoryCredentials()
{
$config = (array) $this->config->getContextually('vcs');
$credentials = (array) $this->localStorage->get('credentials');
return array_merge($config, $credentials);
} | [
"protected",
"function",
"getRepositoryCredentials",
"(",
")",
"{",
"$",
"config",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'vcs'",
")",
";",
"$",
"credentials",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"local... | Get the credentials for the repository.
@return array | [
"Get",
"the",
"credentials",
"for",
"the",
"repository",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php#L43-L49 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php | RepositoriesKeychain.getRepositoryEndpoint | protected function getRepositoryEndpoint()
{
// Get credentials
$repository = $this->getRepositoryCredentials();
$username = Arr::get($repository, 'username');
$password = Arr::get($repository, 'password');
$repository = Arr::get($repository, 'repository');
// Add credentials if possible
if ($username || $password) {
// Encore parameters
$username = urlencode($username);
$password = urlencode($password);
// Build credentials chain
$credentials = $password ? $username.':'.$password : $username;
$credentials .= '@';
// Add them in chain
$repository = preg_replace('#https://(.+)@#', 'https://', $repository);
$repository = str_replace('https://', 'https://'.$credentials, $repository);
}
return $repository;
} | php | protected function getRepositoryEndpoint()
{
// Get credentials
$repository = $this->getRepositoryCredentials();
$username = Arr::get($repository, 'username');
$password = Arr::get($repository, 'password');
$repository = Arr::get($repository, 'repository');
// Add credentials if possible
if ($username || $password) {
// Encore parameters
$username = urlencode($username);
$password = urlencode($password);
// Build credentials chain
$credentials = $password ? $username.':'.$password : $username;
$credentials .= '@';
// Add them in chain
$repository = preg_replace('#https://(.+)@#', 'https://', $repository);
$repository = str_replace('https://', 'https://'.$credentials, $repository);
}
return $repository;
} | [
"protected",
"function",
"getRepositoryEndpoint",
"(",
")",
"{",
"// Get credentials",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepositoryCredentials",
"(",
")",
";",
"$",
"username",
"=",
"Arr",
"::",
"get",
"(",
"$",
"repository",
",",
"'username'",
")... | Get the URL to the Git repository.
@return string | [
"Get",
"the",
"URL",
"to",
"the",
"Git",
"repository",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php#L56-L80 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php | RepositoriesKeychain.getRepositoryBranch | protected function getRepositoryBranch()
{
// If we passed a branch, use it
if ($branch = $this->getOption('branch')) {
return $branch;
}
// Get branch from config, else compute the fallback
$branch = $this->config->getContextually('vcs.branch');
if (!$branch) {
$fallback = $this->bash->on('local', function () {
return $this->vcs->runSilently('currentBranch');
});
$fallback = $fallback ?: 'master';
$branch = trim($fallback);
}
return $branch;
} | php | protected function getRepositoryBranch()
{
// If we passed a branch, use it
if ($branch = $this->getOption('branch')) {
return $branch;
}
// Get branch from config, else compute the fallback
$branch = $this->config->getContextually('vcs.branch');
if (!$branch) {
$fallback = $this->bash->on('local', function () {
return $this->vcs->runSilently('currentBranch');
});
$fallback = $fallback ?: 'master';
$branch = trim($fallback);
}
return $branch;
} | [
"protected",
"function",
"getRepositoryBranch",
"(",
")",
"{",
"// If we passed a branch, use it",
"if",
"(",
"$",
"branch",
"=",
"$",
"this",
"->",
"getOption",
"(",
"'branch'",
")",
")",
"{",
"return",
"$",
"branch",
";",
"}",
"// Get branch from config, else co... | Get the repository branch to use.
@return string | [
"Get",
"the",
"repository",
"branch",
"to",
"use",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Credentials/Modules/RepositoriesKeychain.php#L87-L106 | train |
rocketeers/rocketeer | src/Rocketeer/Tasks/Subtasks/Notify.php | Notify.getComponents | protected function getComponents()
{
// Get user name
$user = $this->localStorage->get('notifier.name');
if (!$user) {
$user = $this->command->ask('Who is deploying ?') ?: 'Someone';
$this->localStorage->set('notifier.name', $user);
}
// Get what was deployed
$repository = $this->credentials->getCurrentRepository();
$connection = $this->connections->getCurrentConnectionKey();
return [
'user' => $user,
'branch' => $repository->branch,
'handle' => $connection->toHandle(),
'host' => $connection->host,
'repository' => $repository->getName(),
];
} | php | protected function getComponents()
{
// Get user name
$user = $this->localStorage->get('notifier.name');
if (!$user) {
$user = $this->command->ask('Who is deploying ?') ?: 'Someone';
$this->localStorage->set('notifier.name', $user);
}
// Get what was deployed
$repository = $this->credentials->getCurrentRepository();
$connection = $this->connections->getCurrentConnectionKey();
return [
'user' => $user,
'branch' => $repository->branch,
'handle' => $connection->toHandle(),
'host' => $connection->host,
'repository' => $repository->getName(),
];
} | [
"protected",
"function",
"getComponents",
"(",
")",
"{",
"// Get user name",
"$",
"user",
"=",
"$",
"this",
"->",
"localStorage",
"->",
"get",
"(",
"'notifier.name'",
")",
";",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",... | Get the message's components.
@return string[] | [
"Get",
"the",
"message",
"s",
"components",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Tasks/Subtasks/Notify.php#L87-L107 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Builder.php | Builder.registerLookup | public function registerLookup($type, $lookups = [])
{
$lookups = (array) $lookups;
$this->lookups[$type] = array_unique(array_merge($this->lookups[$type], $lookups));
} | php | public function registerLookup($type, $lookups = [])
{
$lookups = (array) $lookups;
$this->lookups[$type] = array_unique(array_merge($this->lookups[$type], $lookups));
} | [
"public",
"function",
"registerLookup",
"(",
"$",
"type",
",",
"$",
"lookups",
"=",
"[",
"]",
")",
"{",
"$",
"lookups",
"=",
"(",
"array",
")",
"$",
"lookups",
";",
"$",
"this",
"->",
"lookups",
"[",
"$",
"type",
"]",
"=",
"array_unique",
"(",
"arr... | Add additional places to look for classes.
@param string $type
@param string|array $lookups | [
"Add",
"additional",
"places",
"to",
"look",
"for",
"classes",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Builder.php#L129-L134 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Builder.php | Builder.registerLookups | public function registerLookups(array $lookups)
{
$this->lookedUp = [];
foreach ($lookups as $type => $lookup) {
$this->registerLookup($type, $lookup);
}
} | php | public function registerLookups(array $lookups)
{
$this->lookedUp = [];
foreach ($lookups as $type => $lookup) {
$this->registerLookup($type, $lookup);
}
} | [
"public",
"function",
"registerLookups",
"(",
"array",
"$",
"lookups",
")",
"{",
"$",
"this",
"->",
"lookedUp",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"lookups",
"as",
"$",
"type",
"=>",
"$",
"lookup",
")",
"{",
"$",
"this",
"->",
"registerLookup",
... | Add additional places to look for multiple types.
@param array $lookups | [
"Add",
"additional",
"places",
"to",
"look",
"for",
"multiple",
"types",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Builder.php#L141-L147 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Builders/Builder.php | Builder.findQualifiedName | public function findQualifiedName($class, $type, $namespace = null)
{
// Check if we already resolved that name
if (array_key_exists($class, $this->lookedUp)) {
return $this->lookedUp[$type][$class];
}
$paths = $this->getLookups($type);
$paths[] = '%s';
// Create classes array
$class = ucfirst($class);
$classes = $namespace ? [ucfirst($namespace).'\\'.$class, $class] : [$class];
// Search for first existing class
$qualified = false;
foreach ($classes as $class) {
foreach ($paths as $path) {
$path = sprintf($path, $class);
if (class_exists($path)) {
$qualified = $path;
break 2;
}
}
}
return $this->lookedUp[$type][$class] = $qualified;
} | php | public function findQualifiedName($class, $type, $namespace = null)
{
// Check if we already resolved that name
if (array_key_exists($class, $this->lookedUp)) {
return $this->lookedUp[$type][$class];
}
$paths = $this->getLookups($type);
$paths[] = '%s';
// Create classes array
$class = ucfirst($class);
$classes = $namespace ? [ucfirst($namespace).'\\'.$class, $class] : [$class];
// Search for first existing class
$qualified = false;
foreach ($classes as $class) {
foreach ($paths as $path) {
$path = sprintf($path, $class);
if (class_exists($path)) {
$qualified = $path;
break 2;
}
}
}
return $this->lookedUp[$type][$class] = $qualified;
} | [
"public",
"function",
"findQualifiedName",
"(",
"$",
"class",
",",
"$",
"type",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"// Check if we already resolved that name",
"if",
"(",
"array_key_exists",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"lookedUp",
")"... | Find a class in various predefined namespaces.
@param string $class
@param string $type
@param string|null $namespace
@return false|string | [
"Find",
"a",
"class",
"in",
"various",
"predefined",
"namespaces",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Builders/Builder.php#L162-L189 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Shell/Modules/Flow.php | Flow.setupIfNecessary | public function setupIfNecessary()
{
// Check if local is ready for deployment
return $this->modulable->on('local', function () {
$primer = $this->modulable->executeTask('Primer');
return $primer ?: $this->modulable->halt('Project is not ready for deploy. You were almost fired.');
});
if (!$this->isSetup()) {
$this->explainer->error('Server is not ready, running Setup task');
return $this->modulable->executeTask('Setup');
}
} | php | public function setupIfNecessary()
{
// Check if local is ready for deployment
return $this->modulable->on('local', function () {
$primer = $this->modulable->executeTask('Primer');
return $primer ?: $this->modulable->halt('Project is not ready for deploy. You were almost fired.');
});
if (!$this->isSetup()) {
$this->explainer->error('Server is not ready, running Setup task');
return $this->modulable->executeTask('Setup');
}
} | [
"public",
"function",
"setupIfNecessary",
"(",
")",
"{",
"// Check if local is ready for deployment",
"return",
"$",
"this",
"->",
"modulable",
"->",
"on",
"(",
"'local'",
",",
"function",
"(",
")",
"{",
"$",
"primer",
"=",
"$",
"this",
"->",
"modulable",
"->"... | Setup the server if necessary.
@return bool | [
"Setup",
"the",
"server",
"if",
"necessary",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Shell/Modules/Flow.php#L44-L58 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Shell/Modules/Flow.php | Flow.runForApplication | public function runForApplication($tasks)
{
$folder = $this->config->getContextually('remote.directories.subdirectory');
$folder = $this->releasesManager->getCurrentReleasePath($folder);
return $this->modulable->runInFolder($folder, $tasks);
} | php | public function runForApplication($tasks)
{
$folder = $this->config->getContextually('remote.directories.subdirectory');
$folder = $this->releasesManager->getCurrentReleasePath($folder);
return $this->modulable->runInFolder($folder, $tasks);
} | [
"public",
"function",
"runForApplication",
"(",
"$",
"tasks",
")",
"{",
"$",
"folder",
"=",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'remote.directories.subdirectory'",
")",
";",
"$",
"folder",
"=",
"$",
"this",
"->",
"releasesManager",
"->"... | Run actions for the core of the application itself.
@param string|array $tasks
@return string | [
"Run",
"actions",
"for",
"the",
"core",
"of",
"the",
"application",
"itself",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Shell/Modules/Flow.php#L91-L97 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Shell/Modules/Flow.php | Flow.setApplicationPermissions | public function setApplicationPermissions()
{
$files = (array) $this->config->getContextually('remote.permissions.files');
foreach ($files as &$file) {
$this->modulable->setPermissions($file);
}
return true;
} | php | public function setApplicationPermissions()
{
$files = (array) $this->config->getContextually('remote.permissions.files');
foreach ($files as &$file) {
$this->modulable->setPermissions($file);
}
return true;
} | [
"public",
"function",
"setApplicationPermissions",
"(",
")",
"{",
"$",
"files",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'remote.permissions.files'",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"&",
"$",
"file",
... | Set permissions for the folders used by the application.
@return bool | [
"Set",
"permissions",
"for",
"the",
"folders",
"used",
"by",
"the",
"application",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Shell/Modules/Flow.php#L108-L116 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Shell/Modules/Flow.php | Flow.syncSharedFolders | public function syncSharedFolders()
{
$shared = (array) $this->config->getContextually('remote.shared');
foreach ($shared as &$file) {
$this->share($file);
}
return true;
} | php | public function syncSharedFolders()
{
$shared = (array) $this->config->getContextually('remote.shared');
foreach ($shared as &$file) {
$this->share($file);
}
return true;
} | [
"public",
"function",
"syncSharedFolders",
"(",
")",
"{",
"$",
"shared",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"config",
"->",
"getContextually",
"(",
"'remote.shared'",
")",
";",
"foreach",
"(",
"$",
"shared",
"as",
"&",
"$",
"file",
")",
"{",
"$... | Sync the requested folders and files.
@return bool | [
"Sync",
"the",
"requested",
"folders",
"and",
"files",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Shell/Modules/Flow.php#L127-L135 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Shell/Modules/Flow.php | Flow.updateSymlink | public function updateSymlink($release = null)
{
// If the release is specified, update to make it the current one
if ($release) {
$this->releasesManager->setNextRelease($release);
}
// Get path to current/ folder and latest release
$currentReleasePath = $this->releasesManager->getCurrentReleasePath();
$currentFolder = $this->paths->getCurrentFolder();
return $this->modulable->symlink($currentReleasePath, $currentFolder);
} | php | public function updateSymlink($release = null)
{
// If the release is specified, update to make it the current one
if ($release) {
$this->releasesManager->setNextRelease($release);
}
// Get path to current/ folder and latest release
$currentReleasePath = $this->releasesManager->getCurrentReleasePath();
$currentFolder = $this->paths->getCurrentFolder();
return $this->modulable->symlink($currentReleasePath, $currentFolder);
} | [
"public",
"function",
"updateSymlink",
"(",
"$",
"release",
"=",
"null",
")",
"{",
"// If the release is specified, update to make it the current one",
"if",
"(",
"$",
"release",
")",
"{",
"$",
"this",
"->",
"releasesManager",
"->",
"setNextRelease",
"(",
"$",
"rele... | Update the current symlink.
@param int|null $release A release to mark as current
@return string | [
"Update",
"the",
"current",
"symlink",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Shell/Modules/Flow.php#L144-L156 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Connections/Shell/Modules/Flow.php | Flow.share | public function share($file)
{
$mapping = $this->config->get('remote.directories');
// Get path to current file and shared file
$currentFile = $this->releasesManager->getCurrentReleasePath($file);
$sharedFile = preg_replace('#'.$mapping['releases'].'/[0-9]+/#', $mapping['shared'].'/', $currentFile);
// If no instance of the shared file exists, use current one
if (!$this->modulable->fileExists($sharedFile)) {
$this->modulable->move($currentFile, $sharedFile);
}
$this->explainer->line('Sharing file '.$currentFile);
return $this->modulable->symlink($sharedFile, $currentFile);
} | php | public function share($file)
{
$mapping = $this->config->get('remote.directories');
// Get path to current file and shared file
$currentFile = $this->releasesManager->getCurrentReleasePath($file);
$sharedFile = preg_replace('#'.$mapping['releases'].'/[0-9]+/#', $mapping['shared'].'/', $currentFile);
// If no instance of the shared file exists, use current one
if (!$this->modulable->fileExists($sharedFile)) {
$this->modulable->move($currentFile, $sharedFile);
}
$this->explainer->line('Sharing file '.$currentFile);
return $this->modulable->symlink($sharedFile, $currentFile);
} | [
"public",
"function",
"share",
"(",
"$",
"file",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'remote.directories'",
")",
";",
"// Get path to current file and shared file",
"$",
"currentFile",
"=",
"$",
"this",
"->",
"release... | Share a file or folder between releases.
@param string $file Path to the file in a release folder
@return string | [
"Share",
"a",
"file",
"or",
"folder",
"between",
"releases",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Connections/Shell/Modules/Flow.php#L165-L181 | train |
rocketeers/rocketeer | src/Rocketeer/Services/Environment/Modules/HomePathfinder.php | HomePathfinder.getUserHomeFolder | public static function getUserHomeFolder()
{
// Get home folder if available (Unix)
if (!empty($_SERVER['HOME'])) {
return $_SERVER['HOME'];
// Else use the home drive (Windows)
} elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
return $_SERVER['HOMEDRIVE'].$_SERVER['HOMEPATH'];
}
throw new Exception('Cannot determine user home directory.');
} | php | public static function getUserHomeFolder()
{
// Get home folder if available (Unix)
if (!empty($_SERVER['HOME'])) {
return $_SERVER['HOME'];
// Else use the home drive (Windows)
} elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
return $_SERVER['HOMEDRIVE'].$_SERVER['HOMEPATH'];
}
throw new Exception('Cannot determine user home directory.');
} | [
"public",
"static",
"function",
"getUserHomeFolder",
"(",
")",
"{",
"// Get home folder if available (Unix)",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'HOME'",
"]",
")",
")",
"{",
"return",
"$",
"_SERVER",
"[",
"'HOME'",
"]",
";",
"// Else use the h... | Get the path to the users home folder.
@throws Exception
@return string | [
"Get",
"the",
"path",
"to",
"the",
"users",
"home",
"folder",
"."
] | 8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0 | https://github.com/rocketeers/rocketeer/blob/8a381d5b03a5554c2c0d466bd49c3bdf6a6e20c0/src/Rocketeer/Services/Environment/Modules/HomePathfinder.php#L30-L41 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.