-
Notifications
You must be signed in to change notification settings - Fork 4
How to create a package
Robert Deutz edited this page Aug 13, 2018
·
2 revisions
-
Create a directory src/Task/Dog
-
Create a Task.php in the directory
namespace JoomlaRobo\Task\Dog;
trait Tasks
{
/**
* Do something
*
* @param string $parameter
*
* @return JoomlaRobo\Task\Dog
*/
protected function taskDoSomething($parameter)
{
return $this->task(DogDoSomething::class, $parameter);
}
}
- Create a file DogDoSomething.php
namespace JoomlaRobo\Task\Test;
/**
* Fun with a Dog
*
* @since 0.1.0
*/
class DogDoSomething extends JoomlaTask
{
/**
* Do Something
*/
public function run()
{
$this->printTaskInfo('We are doing something');
// Execute the task
$this->collectionBuilder()->taskExec()->run();
}
}
- Create a file src/Robo/Plugin/Commands/DogCommands.php
namespace JoomlaRobo\Robo\Plugin\Commands;
class DogCommands extends \Robo\Tasks
{
use \JoomlaRobo\Task\Scaffold\Tasks;
/**
* Do Dog Command
*
* @command Dog:DoSometing
*
* @param string $param
*/
public function Component($param)
{
$this->taskDogDoSomething($param)
->run();
}
}