Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Fix code style issues.
  Document commands in README.
  Document digipolis:package-project
  Read properties first if available.
  Fix use statements.
  Add command traits.
  • Loading branch information
Jelle-S committed Feb 16, 2017
2 parents 40ffd54 + e45b000 commit d048e22
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 47 deletions.
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ engines:
enabled: true
markdownlint:
enabled: true
checks:
MD024:
enabled: false
ratings:
paths:
- "**.php"
Expand Down
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/digipolisgent/robo-digipolis-general> 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.
19 changes: 19 additions & 0 deletions src/Commands/PackageProject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Commands;

trait PackageProject
{

use \DigipolisGent\Robo\Task\Package\Traits\PackageProjectTrait;

public function digipolisPackageProject($archiveFile, $dir = null, $opts = ['ignore|i' => ''])
{
if (is_callable([$this, 'readProperties'])) {
$this->readProperties();
}
$this->taskPackageProject($archiveFile, $dir)
->ignoreFileNames(array_map('trim', explode(',', $opts['ignore'])))
->run();
}
}
16 changes: 16 additions & 0 deletions src/Commands/ThemeClean.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Commands;

trait ThemeClean
{
use \DigipolisGent\Robo\Task\Package\Traits\ThemeCleanTrait;

public function digipolisThemeClean($dir = null)
{
if (is_callable([$this, 'readProperties'])) {
$this->readProperties();
}
$this->taskThemeClean($dir)->run();
}
}
16 changes: 16 additions & 0 deletions src/Commands/ThemeCompile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Commands;

trait ThemeCompile
{
use \DigipolisGent\Robo\Task\Package\Traits\ThemeCompileTrait;

public function digipolisThemeCompile($dir = null, $command = 'compile')
{
if (is_callable([$this, 'readProperties'])) {
$this->readProperties();
}
$this->taskThemeCompile($dir, $command)->run();
}
}
10 changes: 10 additions & 0 deletions src/Commands/loadCommands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Commands;

trait loadCommands
{
use PackageProject;
use ThemeClean;
use ThemeCompile;
}
25 changes: 25 additions & 0 deletions src/Traits/PackageProjectTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Traits;

use DigipolisGent\Robo\Task\Package\PackageProject;

trait PackageProjectTrait
{
/**
* 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);
}
}
22 changes: 22 additions & 0 deletions src/Traits/ThemeCleanTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Traits;

use DigipolisGent\Robo\Task\Package\ThemeClean;

trait ThemeCleanTrait
{
/**
* 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);
}
}
25 changes: 25 additions & 0 deletions src/Traits/ThemeCompileTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace DigipolisGent\Robo\Task\Package\Traits;

use DigipolisGent\Robo\Task\Package\ThemeCompile;

trait ThemeCompileTrait
{
/**
* 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);
}
}
50 changes: 3 additions & 47 deletions src/loadTasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit d048e22

Please sign in to comment.