Robo v1.0.0 Release Notes

Release Date: 2016-10-10 // over 7 years ago
    • ⏪ [Collection] Add tasks to a collection, and implement them as a group with rollback
      • Tasks may be added to a collection via $collection->add($task);
      • $collection->run(); runs all tasks in the collection
      • $collection->addCode(function () { ... } ); to add arbitrary code to a collection
      • $collection->progressMessage(...); will log a message
      • $collection->rollback($task); and $collection->rollbackCode($callable); add a rollback function to clean up after a failed task
      • $collection->completion($task); and $collection->completionCode($callable); add a function that is called once the collection completes or rolls back.
      • $collection->before(); and $collection->after(); can be used to add a task or function that runs before or after (respectively) the specified named task. To use this feature, tasks must be given names via an optional $taskName parameter when they are added.
      • Collections may be added to collections, if desired.
    • [CollectionBuilder] Create tasks and add them to a collection in a single operation.
      • $this->collectionBuilder()->taskExec('pwd')->taskExec('ls')->run()
    • ➕ Add output formatters
      • If a Robo command returns a string, or a Result object with a $message, then it will be printed
      • Commands may be annotated to describe output formats that may be used
      • Structured arrays returned from function results may be converted into different formats, such as a table, yml, json, etc.
      • Tasks must use TaskIO for output methods. It is no longer possible to use IO from a task. For direct access use Robo::output() (not recommended).
    • 👉 Use league/container to do Dependency Injection
      • Breaking Tasks' loadTasks traits must use $this->task(TaskClass::class); instead of new TaskClass();
      • Breaking Tasks that use other tasks must use $this->collectionBuilder()->taskName(); instead of new TaskClass(); when creating task objects to call. Implement Robo\Contract\BuilderAwareInterface and use Robo\Contract\BuilderAwareTrait to add the collectionBuilder() method to your task class.
    • 💥 Breaking The arg(), args() and option() methods in CommandArguments now escape the values passed in to them. There is now a rawArg() method if you need to add just one argument that has already been escaped.
    • 💥 Breaking taskWrite is now called taskWriteToFile
    • [Extract] task added
    • [Pack] task added
    • [TmpDir], [WorkDir] and [TmpFile] tasks added
    • 👌 Support Robo scripts that allows scripts starting with #!/usr/bin/env robo to define multiple robo commands. Use #!/usr/bin/env robo run to define a single robo command implemented by the run() method.
    • Provide ProgresIndicatorAwareInterface and ProgressIndicatorAwareTrait that make it easy to add progress indicators to tasks
    • ➕ Add --simulate mode that causes tasks to print what they would have done, but make no changes
    • ➕ Add robo generate:task code-generator to make new stack-based task wrappers around existing classes
    • ➕ Add robo sniff by @dustinleblanc. Runs the PHP code sniffer followed by the code beautifier, if needed.
    • Implement ArrayInterface for Result class, so result data may be accessed like an array
    • Defer execution of operations in taskWriteToFile until the run() method
    • ➕ Add Write::textIfMatch() for taskWriteToFile
    • ResourceExistenceChecker used for error checking in DeleteDir, CopyDir, CleanDir and Concat tasks by @burzum
    • Provide ResultData base class for Result; ResultData may be used in instances where a specific $task instance is not available (e.g. in a Robo command)
    • ArgvInput now available via $this->getInput() in RoboFile by Thomas Spigel
    • ➕ Add optional message to git tag task by Tim Tegeler
    • 📇 Rename 'FileSystem' to 'Filesystem' wherever it occurs.
    • Current directory is changed with chdir only if specified via the --load-from option (RC2)