From 67ecaee1f664b75f17a0696c14f0fddd08c93325 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 19 Dec 2017 22:19:34 -0500 Subject: [PATCH] Robo task for CS fixes --- RoboFile.php | 9 +++++++++ robo | 6 +++++- robo.bat | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/RoboFile.php b/RoboFile.php index 4653e4c8..39edfd39 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -128,4 +128,13 @@ class RoboFile extends \Robo\Tasks { $this->_exec("git worktree prune"); return $out; } + + public function clean($opts = ['demo|d' => false]): Result { + $t = $this->taskExec(realpath(self::BASE."vendor/bin/php-cs-fixer")); + $t->arg("fix"); + if ($opts['demo']) { + $t->args("--dry-run", "--diff")->option("--diff-format", "udiff"); + } + return $t->run(); + } } \ No newline at end of file diff --git a/robo b/robo index ab928f77..7d4d4d76 100755 --- a/robo +++ b/robo @@ -3,4 +3,8 @@ base=`dirname "$0"` roboCommand="$1" shift -"$base/vendor/bin/robo" "$roboCommand" -- $* \ No newline at end of file +if [ "$1" == "clean" ]; then + "$base/vendor/bin/robo" "$roboCommand" $* +else + "$base/vendor/bin/robo" "$roboCommand" -- $* +fi \ No newline at end of file diff --git a/robo.bat b/robo.bat index f0c1de40..6b634b11 100644 --- a/robo.bat +++ b/robo.bat @@ -14,4 +14,7 @@ if "%~1" neq "" ( ) if defined args set args=%args:~1% +if not "%1"=="clean" ( + call "%base%vendor\bin\robo" "%roboCommand%" %args% +) call "%base%vendor\bin\robo" "%roboCommand%" -- %args% \ No newline at end of file