Skip to content

Instantly share code, notes, and snippets.

@DavertMik
Last active August 17, 2016 10:15
Show Gist options
  • Save DavertMik/172c791318050df3a632 to your computer and use it in GitHub Desktop.
Save DavertMik/172c791318050df3a632 to your computer and use it in GitHub Desktop.
Robo 0.5 changes

Robo Changes

  1. Tasks are located by following PSR-4 standard
  2. Task loading by traits are removed - this is done to simplify loading of tasks. Instead of declaring tasks in traits you can just call them with static initialization methods. Also you won't need to include lots of traits into RoboFile. Usage of static class calls instead of traits is aimed for simplicity. One task = one class = one file.
  3. Tasks initialization syntax changed to
<?php

taskChangelog::init()
    ->change('refactored Robo')
    ->version('0.5.0')
    ->run();
?>

For one-line tasks are simplified to:

<?php
taskExec::_run('cap production deploy');

// equal to 
taskExec::init()
    ->exec('cap production deploy')
    ->run();

// also
taskCopyDir::_run(['/var/log', '/backup/log']);
taskCleanDir::_run(['web/assets','tmp/','log/']);
taskRename::_run('Dockerfile', 'tmpDockerfile');
?>

Those commands will initializa and invoke tasks;

4 Stack tasks changes

<?php
// performs actions one by one
taskGit::stack()
    ->add('-A')
    ->commit("auto-update")
    ->pull()
    ->push()
    ->run();

// clones repo
taskGit::_clone('[email protected]:php-vcr/php-vcr.git');

// equal to
taskGit::stack()
    ->clone('[email protected]:php-vcr/php-vcr.git')
    ->run();
?>

This goes far well for Exec:

<?php
// run 1 command
taskExec::_run('grunt test');

// run 2 commands
taskExec::stack()
    ->exec('grunt test')
    ->exec('phpunit')
    ->run();
?>

5 RoboFile must contain a namespace so FQNs could be simplified by IDE to proposed variants. Namespace can be either:

  • robo
  • Robo
  • ????
  • Robo;

6 Directory Structure would be following:

src/
  Command
    RoboUpdate
    RoboGlobalInstall
  
  Interfaces
    TaskInterface
    RunnableInterface

  Exception
    TaskException

  Commons
    Executable
    DynamicConfig
    CommandStack
    Output

  Task
    BaseTask
    FileSystem
        taskCleanDir
        taskDeleteDir
        task....
    Codeception\
        taskCodeceptRun
    PhpUnit\
        taskPhpUnit
    Minify\
        taskMinify
    Docker\
        task....
    Npm\
        taskNpmInstall
        taskNpmUpdate
    Rsync\
        taskRsync
    Svn\
        taskSvnStack
    Watch\
        taskWatch
    Exec\
        taskExec
        taskExecStack
@amirduran
Copy link

Is there FTP support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment