此包已被放弃,不再维护。作者建议使用 joomla-projects/joomla-testing-robo 包。

Joomla 质量保证的 Robo 任务

0.1.0 2015-08-07 16:24 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:47:49 UTC


README

robo.li tasks for joomla

将 Joomla Robo 任务添加到您的项目中

将以下要求添加到您的 composer.json 中

    "require-dev": {
        "codegyre/robo": "^0.5.3",
        "joomla-projects/robo": "dev-master"
    }

执行: $ vendor/bin/robo init

并确保您的 RoboFile.php 加载了 Joomla 任务

<?php
/**
 * This is project's console commands configuration for Robo task runner.
 *
 * @see http://robo.li/
 */
require 'vendor/autoload.php';

class RoboFile extends \Robo\Tasks
{
	// Load tasks from composer, see composer.json
	use \joomla_projects\robo\loadTasks;
``


## checkCodeStyle task

Use it like this in your RoboFile.php:

private $extension = '';

/**
 * Set the Execute extension for Windows Operating System
 *
 * @return void
 */
private function setExecExtension()
{
	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
	{
		$this->extension = '.exe';
	}
}

/**
 * Check the code style of the project against a passed sniffers using PHP_CodeSniffer_CLI
 *
 * @param   string  $sniffersPath  Path to the sniffers. If not provided Joomla Coding Standards will be used.
 */
public function checkCodestyle($sniffersPath = null)
{
	if(is_null($sniffersPath))
	{
		$this->say('Downloading Joomla Coding Standards Sniffers');
		$this->_exec("git $this->extension clone -b master --single-branch --depth 1 https://github.com/joomla/coding-standards.git .travis/phpcs/Joomla");
		$sniffersPath = __DIR__ . '/.travis/phpcs/Joomla';
	}

	$this->taskCheckCodeStyle()
		->inspect(__DIR__ . '/component')
		->standard($sniffersPath)
		->ignore(__DIR__ . '/component/admin/views/*/tmpl/*')
		->ignore(__DIR__ . '/component/admin/views/*/tmpl/*')
		->ignore(__DIR__ . '/component/admin/views/*/tmpl/*')
		->ignore(__DIR__ . '*.js')
		->run()
		->stopOnFail();
}

use `dontStopOnFail(true)` to always exit(0). Valid to avoid travis failing.