diff --git a/.codeclimate.yml b/.codeclimate.yml index e76294d..6eb7e4e 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -21,6 +21,9 @@ engines: enabled: true markdownlint: enabled: true + checks: + MD024: + enabled: false ratings: paths: - "**.php" diff --git a/README.md b/README.md index d7bc790..5bbde4e 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,62 @@ General Packaging/Compile tasks for Robo Task Runner [![Code Climate](https://codeclimate.com/github/digipolisgent/robo-digipolis-package/badges/gpa.svg)](https://codeclimate.com/github/digipolisgent/robo-digipolis-package) [![Test Coverage](https://codeclimate.com/github/digipolisgent/robo-digipolis-package/badges/coverage.svg)](https://codeclimate.com/github/digipolisgent/robo-digipolis-package/coverage) [![Dependency Status](https://www.versioneye.com/user/projects/588617eab194d40039c906dd/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/588617eab194d40039c906dd) + +## Commands + +This package provides default commands wich you can use in your `RoboFile.php` +like so: + +```php +class RoboFile extends \Robo\Tasks +{ + use \DigipolisGent\Robo\Task\Package\Commands\loadCommands; +} +``` + +### digipolis:package-project + +`vendor/bin/robo digipolis:package-project FILE [DIR] [OPTIONS]` + +#### Arguments + +##### FILE + +The name of the archive file that will be created. + +##### DIR + +The directory to package. Defaults to the config value `digipolis.root.project` +if it is set (see for +more information), or the current working directory otherwise. + +#### Options + +##### --ignore, -i + +Comma separated list of filenames to ignore. + +### digipolis:theme-clean + +`vendor/bin/robo digipolis:theme-clean [DIR]` + +#### Arguments + +##### DIR + +The theme directory to clean. Defaults to the current working directory. + +### digipolis:theme-compile + +`vendor/bin/robo digipolis:theme-compile [DIR] [COMMAND]` + +#### Arguments + +##### DIR + +The directory of the theme to compile. Defaults to the current working +directory. + +##### COMMAND + +The grunt/gulp command to execute if grunt or gulp is available. diff --git a/src/Commands/PackageProject.php b/src/Commands/PackageProject.php new file mode 100644 index 0000000..c04849c --- /dev/null +++ b/src/Commands/PackageProject.php @@ -0,0 +1,19 @@ + '']) + { + if (is_callable([$this, 'readProperties'])) { + $this->readProperties(); + } + $this->taskPackageProject($archiveFile, $dir) + ->ignoreFileNames(array_map('trim', explode(',', $opts['ignore']))) + ->run(); + } +} diff --git a/src/Commands/ThemeClean.php b/src/Commands/ThemeClean.php new file mode 100644 index 0000000..b768d0c --- /dev/null +++ b/src/Commands/ThemeClean.php @@ -0,0 +1,16 @@ +readProperties(); + } + $this->taskThemeClean($dir)->run(); + } +} diff --git a/src/Commands/ThemeCompile.php b/src/Commands/ThemeCompile.php new file mode 100644 index 0000000..283b568 --- /dev/null +++ b/src/Commands/ThemeCompile.php @@ -0,0 +1,16 @@ +readProperties(); + } + $this->taskThemeCompile($dir, $command)->run(); + } +} diff --git a/src/Commands/loadCommands.php b/src/Commands/loadCommands.php new file mode 100644 index 0000000..4d8713f --- /dev/null +++ b/src/Commands/loadCommands.php @@ -0,0 +1,10 @@ +task(PackageProject::class, $archiveFile, $dir); + } +} diff --git a/src/Traits/ThemeCleanTrait.php b/src/Traits/ThemeCleanTrait.php new file mode 100644 index 0000000..af80b16 --- /dev/null +++ b/src/Traits/ThemeCleanTrait.php @@ -0,0 +1,22 @@ +task(ThemeClean::class, $dir); + } +} diff --git a/src/Traits/ThemeCompileTrait.php b/src/Traits/ThemeCompileTrait.php new file mode 100644 index 0000000..469a63b --- /dev/null +++ b/src/Traits/ThemeCompileTrait.php @@ -0,0 +1,25 @@ +task(ThemeCompile::class, $dir, $command); + } +} diff --git a/src/loadTasks.php b/src/loadTasks.php index c6a3565..3bd3784 100644 --- a/src/loadTasks.php +++ b/src/loadTasks.php @@ -4,51 +4,7 @@ trait loadTasks { - /** - * Creates a PackageProject task. - * - * @param string $archiveFile - * The full path and name of the archive file to create. - * @param string $dir - * The directory to package. Defaults to digipolis.root.project, or to the - * current working directory if that's not set. - * - * @return \DigipolisGent\Robo\Task\Package\PackageProject - * The package project task. - */ - protected function taskPackageProject($archiveFile, $dir = null) - { - return $this->task(PackageProject::class, $archiveFile, $dir); - } - - /** - * Creates a ThemeCompile task. - * - * @param string $dir - * The directory of the theme to compile. Defaults to the current - * directory. - * @param string $command - * The grunt/gulp command to execute. Defaults to 'compile'. - * - * @return \DigipolisGent\Robo\Task\Package\ThemeCompile - * The theme compile task. - */ - protected function taskThemeCompile($dir = null, $command = 'compile') - { - return $this->task(ThemeCompile::class, $dir, $command); - } - - /** - * Creates a ThemeClean task. - * - * @param string $dir - * The directory of the theme to clean, defaults to the current directory. - * - * @return \DigipolisGent\Robo\Task\Package\ThemeClean - * The theme clean task. - */ - protected function taskThemeClean($dir = null) - { - return $this->task(ThemeClean::class, $dir); - } + use Traits\PackageProjectTrait; + use Traits\ThemeCleanTrait; + use Traits\ThemeCompileTrait; }