Browse Source

Robo task for CS fixes

J. King 11 months ago
parent
commit
67ecaee1f6
3 changed files with 17 additions and 1 deletions
  1. 9
    0
      RoboFile.php
  2. 5
    1
      robo
  3. 3
    0
      robo.bat

+ 9
- 0
RoboFile.php View File

@@ -128,4 +128,13 @@ class RoboFile extends \Robo\Tasks {
128 128
         $this->_exec("git worktree prune");
129 129
         return $out;
130 130
     }
131
+
132
+    public function clean($opts = ['demo|d' => false]): Result {
133
+        $t = $this->taskExec(realpath(self::BASE."vendor/bin/php-cs-fixer"));
134
+        $t->arg("fix");
135
+        if ($opts['demo']) {
136
+            $t->args("--dry-run", "--diff")->option("--diff-format", "udiff");
137
+        }
138
+        return $t->run();
139
+    }
131 140
 }

+ 5
- 1
robo View File

@@ -3,4 +3,8 @@ base=`dirname "$0"`
3 3
 roboCommand="$1"
4 4
 
5 5
 shift
6
-"$base/vendor/bin/robo" "$roboCommand" -- $*
6
+if [ "$1" == "clean" ]; then
7
+    "$base/vendor/bin/robo" "$roboCommand" $*
8
+else
9
+    "$base/vendor/bin/robo" "$roboCommand" -- $*
10
+fi

+ 3
- 0
robo.bat View File

@@ -14,4 +14,7 @@ if "%~1" neq "" (
14 14
 )
15 15
 if defined args set args=%args:~1%
16 16
 
17
+if not "%1"=="clean" (
18
+    call "%base%vendor\bin\robo" "%roboCommand%" %args%
19
+)
17 20
 call "%base%vendor\bin\robo" "%roboCommand%" -- %args%

Loading…
Cancel
Save