{"id":18248227,"url":"https://github.com/district09/robo-digipolis-general","last_synced_at":"2025-04-04T15:32:18.620Z","repository":{"id":56968664,"uuid":"77902323","full_name":"district09/robo-digipolis-general","owner":"district09","description":"General Digipolis tasks for Robo Task Runner: read properties files, determine project and web root.","archived":false,"fork":false,"pushed_at":"2025-01-13T13:26:52.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-03-20T15:01:35.471Z","etag":null,"topics":["d09check22","robo","robo-digipolis-general","robo-tasks","web"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/district09.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-03T09:25:29.000Z","updated_at":"2025-01-13T13:26:36.000Z","dependencies_parsed_at":"2024-11-05T09:38:20.460Z","dependency_job_id":"e838abdf-21fc-4b84-be50-79c02d1cf17c","html_url":"https://github.com/district09/robo-digipolis-general","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.1071428571428571,"last_synced_commit":"3e26110c1237ad7b64ab68e7e5976247de06f778"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-general","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-general/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-general/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-general/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/district09","download_url":"https://codeload.github.com/district09/robo-digipolis-general/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247203049,"owners_count":20900903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["d09check22","robo","robo-digipolis-general","robo-tasks","web"],"created_at":"2024-11-05T09:36:17.539Z","updated_at":"2025-04-04T15:32:13.605Z","avatar_url":"https://github.com/district09.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robo Digipolis General\n\nGeneral Digipolis tasks for Robo Task Runner\n\n[![Latest Stable Version](https://poser.pugx.org/digipolisgent/robo-digipolis-general/v/stable)](https://packagist.org/packages/digipolisgent/robo-digipolis-general)\n[![Latest Unstable Version](https://poser.pugx.org/digipolisgent/robo-digipolis-general/v/unstable)](https://packagist.org/packages/digipolisgent/robo-digipolis-general)\n[![Total Downloads](https://poser.pugx.org/digipolisgent/robo-digipolis-general/downloads)](https://packagist.org/packages/digipolisgent/robo-digipolis-general)\n[![License](https://poser.pugx.org/digipolisgent/robo-digipolis-general/license)](https://packagist.org/packages/digipolisgent/robo-digipolis-general)\n\n[![Build Status](https://travis-ci.org/digipolisgent/robo-digipolis-general.svg?branch=develop)](https://travis-ci.org/digipolisgent/robo-digipolis-general)\n[![Maintainability](https://api.codeclimate.com/v1/badges/37c4961b0a0d7f6ff3d0/maintainability)](https://codeclimate.com/github/digipolisgent/robo-digipolis-general/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/37c4961b0a0d7f6ff3d0/test_coverage)](https://codeclimate.com/github/digipolisgent/robo-digipolis-general/test_coverage)\n[![PHP 7 ready](https://php7ready.timesplinter.ch/digipolisgent/robo-digipolis-general/develop/badge.svg)](https://travis-ci.org/digipolisgent/robo-digipolis-general)\n\n## Tasks in this package\n\n### DetermineProjectRoot\n\nDetermines the root folder of the project by looking for certain files in the\ngiven folder. By default it looks for a `properties.yml` or a `composer.json`\nfile. Usually this task is ran before running an other task in the same command\nso the config value can be passed to that task.\n\n```php\n// Recursively search for a project root folder in the current directory with a\n// maximum depth of 2.\n$result = $this-\u003etaskDetermineProjectRoot(getcwd(), 2)\n    // Do not search in the tests and vendor folders.\n    -\u003eexclude(['tests', 'vendor'])\n    // A folder containing a composer.json is considered a project root.\n    -\u003esearchFiles(['composer.json'])\n    -\u003erun();\n// The project root is stored in the digipolis.root.project config.\n$root = $this-\u003egetConfig()-\u003eget('digipolis.root.project');\n```\n\n### DetermineWebRoot\n\nDetermines the web root folder of the project by looking for certain files in\nthe given folder. By default it looks for a `index.php`, `index.html`,\n`index.htm`, `home.php`, `home.html` or a `home.htm` file. Usually this task is\nran before running an other task in the same command so the config value can be\npassed to that task.\n\n```php\n// Recursively search for a web root folder in the current directory with a\n// maximum depth of 2.\n$result = $this-\u003etaskDetermineWebRoot(getcwd(), 2)\n    // Do not search in the tests and vendor folders.\n    -\u003eexclude(['tests', 'vendor'])\n    // A folder containing an index.php is considered a project root.\n    -\u003esearchFiles(['index.php'])\n    -\u003erun();\n// The project root is stored in the digipolis.root.web config.\n$root = $this-\u003egetConfig()-\u003eget('digipolis.root.web');\n```\n\n### ReadProperties\n\nReads values from yaml files (`default.properties.yml` and `properties.yml`) and\nstores them in config. Values from `default.properties.yml` will be overridden\nif they exist in a `properties.yml`. If a valid path is set for\n`digipolis.root.web` in config, and a `properties.yml` file exists in that path,\nthose values will have top priority. Property files (both\n`default.properties.yml` and `properties.yml`) can define a `_priority` key at\nthe root of the yaml. Higher priorities (lower number) take precedence over\nlower priorities (higher number).\n\n```php\n// Search for default.properties.yml and properties.yml files in the current\n// directory.\n$result = $this-\u003etaskReadProperties([getcwd()])\n    -\u003erun();\n// Values are stored in config.\n$root = $this-\u003egetConfig()-\u003eget('my.config.value');\n```\n\n## Using these tasks in a command\n\nIf you want to use these tasks in a command, you can use the\n`\\DigipolisGent\\Robo\\Task\\General\\Common\\DigipolisPropertiesAware` trait and\nimplement the\n`\\DigipolisGent\\Robo\\Task\\General\\Common\\DigipolisPropertiesAwareInterface`\ninterface. This will expose a readProperties method to which you can pass the\npaths to the project root, the web root and the vendor folder. If the tasks to\ndetermine the project and web root are available on the class using the trait,\nand no project or web root are given as a parameter to the `readProperties`\nmethod, these tasks will be used to determine the paths. They both default to\nthe current working directory. The vendor folder defaults to the vendor folder\nin the web root. Your `RoboFile.php` might look something like this:\n\n```php\nclass RoboFile extends \\Robo\\Tasks implements \\DigipolisGent\\Robo\\Task\\General\\Common\\DigipolisPropertiesAwareInterface\n{\n    use \\DigipolisGent\\Robo\\Task\\General\\Common\\DigipolisPropertiesAware;\n    use \\DigipolisGent\\Robo\\Task\\General\\loadTasks;\n\n    public function myCommand(\n        $arg1,\n        $arg2,\n        $opts = [\n            'root|r' =\u003e null,\n            'webroot|wr' =\u003e null,\n            'vendor-folder|vf' =\u003e null,\n        ]\n    )\n    {\n        $this-\u003ereadProperties(\n            $opts['root'],\n            $opts['webroot'],\n            $opts['vendor-folder']\n        );\n        // All properties are stored in config now, so execute the command.\n        $this-\u003edoCommand();\n    }\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict09%2Frobo-digipolis-general","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistrict09%2Frobo-digipolis-general","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict09%2Frobo-digipolis-general/lists"}