public function toGruntTask($task)
    {
        $workingDirectory = $this->moodle->directory;
        if (is_file($this->plugin->directory.'/Gruntfile.js')) {
            $workingDirectory = $this->plugin->directory;
        }
        $defaultTask = new GruntTaskModel($task, $workingDirectory);

        switch ($task) {
            case 'amd':
                $amdDir = $this->plugin->directory.'/amd';
                if (!is_dir($amdDir)) {
                    return null;
                }

                return new GruntTaskModel($task, $amdDir, 'amd/build');
            case 'shifter':
            case 'yui':
                $yuiDir = $this->plugin->directory.'/yui';
                if (!is_dir($yuiDir)) {
                    return null;
                }

                return new GruntTaskModel($task, $yuiDir.'/src', 'yui/build');
            case 'gherkinlint':
                if ($this->moodle->getBranch() < 33 || !$this->plugin->hasBehatFeatures()) {
                    return null;
                }

                return new GruntTaskModel($task, $this->moodle->directory);
            case 'stylelint:css':
                return $this->plugin->hasFilesWithName('*.css') ? $defaultTask : null;
            case 'stylelint:less':
                return $this->plugin->hasFilesWithName('*.less') ? $defaultTask : null;
            case 'stylelint:scss':
                return $this->plugin->hasFilesWithName('*.scss') ? $defaultTask : null;
            default:
                return $defaultTask;
        }
    }
public function toGruntTask($task)
    {
        $workingDirectory = $this->moodle->directory;
        if (is_file($this->plugin->directory.'/Gruntfile.js')) {
            $workingDirectory = $this->plugin->directory;
        }
        $defaultTask = new GruntTaskModel($task, $workingDirectory);

        switch ($task) {
            case 'amd':
                $amdDir = $this->plugin->directory.'/amd';
                if (!is_dir($amdDir)) {
                    return null;
                }

                return new GruntTaskModel($task, $amdDir, 'amd/build');
            case 'shifter':
            case 'yui':
                $yuiDir = $this->plugin->directory.'/yui';
                if (!is_dir($yuiDir)) {
                    return null;
                }

                return new GruntTaskModel($task, $yuiDir.'/src', 'yui/build');
            case 'gherkinlint':
                if ($this->moodle->getBranch() < 33 || !$this->plugin->hasBehatFeatures()) {
                    return null;
                }

                return new GruntTaskModel($task, $this->moodle->directory);
            case 'stylelint:css':
                return $this->plugin->hasFilesWithName('*.css') ? $defaultTask : null;
            case 'stylelint:less':
                return $this->plugin->hasFilesWithName('*.less') ? $defaultTask : null;
            case 'stylelint:scss':
                return $this->plugin->hasFilesWithName('*.scss') ? $defaultTask : null;
            default:
                return $defaultTask;
        }
    }
public function toGruntTask ( $ task ) { $ workingDirectory = $ this -> moodle -> directory ; if ( is_file ( $ this -> plugin -> directory . '/Gruntfile.js' ) ) { $ workingDirectory = $ this -> plugin -> directory ; } $ defaultTask = new GruntTaskModel ( $ task , $ workingDirectory ) ; switch ( $ task ) { case 'amd' : $ amdDir = $ this -> plugin -> directory . '/amd' ; if ( ! is_dir ( $ amdDir ) ) { return null ; } return new GruntTaskModel ( $ task , $ amdDir , 'amd/build' ) ; case 'shifter' : case 'yui' : $ yuiDir = $ this -> plugin -> directory . '/yui' ; if ( ! is_dir ( $ yuiDir ) ) { return null ; } return new GruntTaskModel ( $ task , $ yuiDir . '/src' , 'yui/build' ) ; case 'gherkinlint' : if ( $ this -> moodle -> getBranch ( ) < 33 || ! $ this -> plugin -> hasBehatFeatures ( ) ) { return null ; } return new GruntTaskModel ( $ task , $ this -> moodle -> directory ) ; case 'stylelint:css' : return $ this -> plugin -> hasFilesWithName ( '*.css' ) ? $ defaultTask : null ; case 'stylelint:less' : return $ this -> plugin -> hasFilesWithName ( '*.less' ) ? $ defaultTask : null ; case 'stylelint:scss' : return $ this -> plugin -> hasFilesWithName ( '*.scss' ) ? $ defaultTask : null ; default : return $ defaultTask ; } }
Create a Grunt Task Model based on the task we are trying to run.

@param string $task

@return GruntTaskModel|null
Create a Grunt Task Model based on the task we are trying to run .