2017 © Pedro Peláez
 

robo-tasks robo-digipolis-general

General Digipolis tasks for Robo Task Runner

image

digipolisgent/robo-digipolis-general

General Digipolis tasks for Robo Task Runner

  • Wednesday, January 24, 2018
  • by zero2one
  • Repository
  • 2 Watchers
  • 0 Stars
  • 8,699 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 17 % Grown

The README.md

Robo Digipolis General

General Digipolis tasks for Robo Task Runner, (*1)

Latest Stable Version Latest Unstable Version Total Downloads License, (*2)

Build Status Maintainability Test Coverage PHP 7 ready, (*3)

Tasks in this package

DetermineProjectRoot

Determines the root folder of the project by looking for certain files in the given folder. By default it looks for a properties.yml or a composer.json file. Usually this task is ran before running an other task in the same command so the config value can be passed to that task., (*4)

// Recursively search for a project root folder in the current directory with a
// maximum depth of 2.
$result = $this->taskDetermineProjectRoot(getcwd(), 2)
    // Do not search in the tests and vendor folders.
    ->exclude(['tests', 'vendor'])
    // A folder containing a composer.json is considered a project root.
    ->searchFiles(['composer.json'])
    ->run();
// The project root is stored in the digipolis.root.project config.
$root = $this->getConfig()->get('digipolis.root.project');

DetermineWebRoot

Determines the web root folder of the project by looking for certain files in the given folder. By default it looks for a index.php, index.html, index.htm, home.php, home.html or a home.htm file. Usually this task is ran before running an other task in the same command so the config value can be passed to that task., (*5)

// Recursively search for a web root folder in the current directory with a
// maximum depth of 2.
$result = $this->taskDetermineWebRoot(getcwd(), 2)
    // Do not search in the tests and vendor folders.
    ->exclude(['tests', 'vendor'])
    // A folder containing an index.php is considered a project root.
    ->searchFiles(['index.php'])
    ->run();
// The project root is stored in the digipolis.root.web config.
$root = $this->getConfig()->get('digipolis.root.web');

ReadProperties

Reads values from yaml files (default.properties.yml and properties.yml) and stores them in config. Values from default.properties.yml will be overridden if they exist in a properties.yml. If a valid path is set for digipolis.root.web in config, and a properties.yml file exists in that path, those values will have top priority. Property files (both default.properties.yml and properties.yml) can define a _priority key at the root of the yaml. Higher priorities (lower number) take precedence over lower priorities (higher number)., (*6)

// Search for default.properties.yml and properties.yml files in the current
// directory.
$result = $this->taskReadProperties([getcwd()])
    ->run();
// Values are stored in config.
$root = $this->getConfig()->get('my.config.value');

Using these tasks in a command

If you want to use these tasks in a command, you can use the \DigipolisGent\Robo\Task\General\Common\DigipolisPropertiesAware trait and implement the \DigipolisGent\Robo\Task\General\Common\DigipolisPropertiesAwareInterface interface. This will expose a readProperties method to which you can pass the paths to the project root, the web root and the vendor folder. If the tasks to determine the project and web root are available on the class using the trait, and no project or web root are given as a parameter to the readProperties method, these tasks will be used to determine the paths. They both default to the current working directory. The vendor folder defaults to the vendor folder in the web root. Your RoboFile.php might look something like this:, (*7)

```php class RoboFile extends \Robo\Tasks implements \DigipolisGent\Robo\Task\General\Common\DigipolisPropertiesAwareInterface { use \DigipolisGent\Robo\Task\General\Common\DigipolisPropertiesAware; use \DigipolisGent\Robo\Task\General\loadTasks;, (*8)

public function myCommand(
    $arg1,
    $arg2,
    $opts = [
        'root|r' => null,
        'webroot|wr' => null,
        'vendor-folder|vf' => null,
    ]
)
{
    $this->readProperties(
        $opts['root'],
        $opts['webroot'],
        $opts['vendor-folder']
    );
    // All properties are stored in config now, so execute the command.
    $this->doCommand();
}

}, (*9)

The Versions

24/01 2018

dev-master

9999999-dev

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

24/01 2018

0.1.5

0.1.5.0

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

24/01 2018

dev-develop

dev-develop

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

24/01 2018

dev-feature/issue-5

dev-feature/issue-5

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

22/12 2017

0.1.4

0.1.4.0

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

22/12 2017

0.1.3

0.1.3.0

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

16/10 2017

0.1.2

0.1.2.0

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

16/03 2017

0.1.1

0.1.1.0

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

09/03 2017

0.1.0

0.1.0.0

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

28/02 2017

0.1.0-rc1

0.1.0.0-RC1

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts

14/02 2017

0.1.0-alpha1

0.1.0.0-alpha1

General Digipolis tasks for Robo Task Runner

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dieter Blomme
by Jelle Sebreghts