Exemplo n.º 1
0
 /**
  * Available options
  *
  * @return mixed
  */
 public function setOptions()
 {
     $action = new Action('create', 'Create user account');
     $option = new Option('email', 'e', 'User email address');
     $option->setRequired(true);
     $action->addOption($option);
     $option = new Option('password', 'p', 'User password');
     $option->setRequired(true);
     $action->addOption($option);
     $option = new Option('name', 'n', 'User name');
     $option->setRequired(true);
     $action->addOption($option);
     $this->addTaskAction($action);
 }
Exemplo n.º 2
0
 /**
  * Task must implement this method to set available options
  *
  * @return mixed
  */
 public function setupOptions()
 {
     $setupAction = new \Vegas\Cli\Task\Action('setup', 'Setup ACL basic roles');
     $this->addTaskAction($setupAction);
     // add action
     $addAction = new Action('add', 'Add a new role');
     $option = new Option('name', 'n', 'Name of role');
     $option->setRequired(true);
     $addAction->addOption($option);
     $option = new Option('description', 'd', 'Description of role');
     $addAction->addOption($option);
     $this->addTaskAction($addAction);
     // remove action
     $removeAction = new Action('remove', 'Remove a role');
     $option = new Option('name', 'n', 'Name of role to remove');
     $option->setRequired(true);
     $removeAction->addOption($option);
     $this->addTaskAction($removeAction);
     // allow action
     $allowAction = new Action('allow', 'Allow resource for role');
     $option = new Option('name', 'n', 'Name of role');
     $option->setRequired(true);
     $allowAction->addOption($option);
     $option = new Option('resource', 'r', 'Resource to allow');
     $option->setRequired(true);
     $allowAction->addOption($option);
     $option = new Option('access', 'a', 'Access in resource to allow');
     $allowAction->addOption($option);
     $this->addTaskAction($allowAction);
     // deny action
     $denyAction = new Action('deny', 'Deny resource for role');
     $option = new Option('name', 'n', 'Name of role');
     $option->setRequired(true);
     $denyAction->addOption($option);
     $option = new Option('resource', 'r', 'Resource to deny');
     $option->setRequired(true);
     $denyAction->addOption($option);
     $option = new Option('access', 'a', 'Access in resource to deny');
     $denyAction->addOption($option);
     $this->addTaskAction($denyAction);
     // build action
     $buildAction = new \Vegas\Cli\Task\Action('build', 'Build list of resources');
     $removeAction->addOption($option);
     $this->addTaskAction($buildAction);
 }
Exemplo n.º 3
0
 /**
  * Task must implement this method to set available options
  *
  * @return mixed
  */
 public function setupOptions()
 {
     $action = new Action('generate', 'Generate fake data');
     //output adapter
     $option = new Option('o', 'output', 'Specify output adapter. Available outputs: db.[orm|odm], file.[csv|json|xml]');
     $option->setRequired(true);
     $action->addOption($option);
     $option = new Option('d', 'dest', 'Specify the destination point. It might be a file, or database collection or table');
     $option->setRequired(true);
     $action->addOption($option);
     //data specification
     $option = new Option('s', 'spec', 'Specify the file path containing data specification in JSON format');
     $option->setRequired(true);
     $action->addOption($option);
     //count of data
     $option = new Option('c', 'count', 'Specify the count of data to generate');
     $option->setRequired(true);
     $action->addOption($option);
     $this->addTaskAction($action);
 }
Exemplo n.º 4
0
 /**
  * Adds available action for current Task
  *
  * @param Action $action
  * @return $this
  */
 protected final function addTaskAction(Action $action)
 {
     $this->actions[$action->getName()] = $action;
     return $this;
 }
Exemplo n.º 5
0
 /**
  * Task's available options
  *
  * @return mixed
  */
 public function setupOptions()
 {
     $action = new Action('publish', 'Publish all assets');
     $dir = new Option('dir', 'd', 'Assets directory. Usage vegas:assets publish -d /path/to/assets');
     $action->addOption($dir);
     $this->addTaskAction($action);
 }