mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 15:36:58 +00:00
Directory reshuffle, add dev tools
* Port Flow Makefile to Echo * Move resources to Resources.php Change-Id: I75e96cc1e51a7768600ffc083550fc94ea9d1e6c
This commit is contained in:
parent
38243e21f5
commit
71c7e02858
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,3 +2,6 @@
|
|||
*~
|
||||
*.kate-swp
|
||||
.*.swp
|
||||
Gemfile.lock
|
||||
node_modules/
|
||||
scripts/remotes/
|
||||
|
|
83
Echo.php
83
Echo.php
|
@ -145,88 +145,7 @@ $wgHooks['ParserTestTables'][] = 'EchoHooks::onParserTestTables';
|
|||
// Extension initialization
|
||||
$wgExtensionFunctions[] = 'EchoHooks::initEchoExtension';
|
||||
|
||||
$echoResourceTemplate = array(
|
||||
'localBasePath' => $dir . 'modules',
|
||||
'remoteExtPath' => 'Echo/modules',
|
||||
);
|
||||
|
||||
$wgResourceModules += array(
|
||||
// ext.echo.base is used by mobile notifications as well, so be sure not to add any
|
||||
// dependencies that do not target mobile.
|
||||
'ext.echo.base' => $echoResourceTemplate + array(
|
||||
'styles' => 'base/ext.echo.base.css',
|
||||
'scripts' => 'base/ext.echo.base.js',
|
||||
'messages' => array(
|
||||
'echo-error-preference',
|
||||
'echo-error-token',
|
||||
),
|
||||
'targets' => array( 'desktop', 'mobile' ),
|
||||
),
|
||||
'ext.echo.desktop' => $echoResourceTemplate + array(
|
||||
'scripts' => 'desktop/ext.echo.desktop.js',
|
||||
'dependencies' => array(
|
||||
'ext.echo.base',
|
||||
'mediawiki.api',
|
||||
'mediawiki.Uri',
|
||||
'mediawiki.jqueryMsg',
|
||||
'mediawiki.user',
|
||||
),
|
||||
),
|
||||
'ext.echo.overlay' => $echoResourceTemplate + array(
|
||||
'scripts' => array(
|
||||
'overlay/ext.echo.overlay.js',
|
||||
),
|
||||
'styles' => 'overlay/ext.echo.overlay.css',
|
||||
'skinStyles' => array(
|
||||
'modern' => 'overlay/ext.echo.overlay.modern.css',
|
||||
'monobook' => 'overlay/ext.echo.overlay.monobook.css',
|
||||
),
|
||||
'dependencies' => array(
|
||||
'ext.echo.desktop',
|
||||
'mediawiki.util',
|
||||
'mediawiki.language',
|
||||
),
|
||||
'messages' => array(
|
||||
'echo-overlay-title',
|
||||
'echo-overlay-title-overflow',
|
||||
'echo-overlay-link',
|
||||
'echo-none',
|
||||
'echo-mark-all-as-read',
|
||||
'echo-more-info',
|
||||
'echo-feedback',
|
||||
),
|
||||
),
|
||||
'ext.echo.special' => $echoResourceTemplate + array(
|
||||
'scripts' => array(
|
||||
'special/ext.echo.special.js',
|
||||
),
|
||||
'styles' => 'special/ext.echo.special.css',
|
||||
'dependencies' => array(
|
||||
'ext.echo.desktop',
|
||||
'mediawiki.ui.button',
|
||||
),
|
||||
'messages' => array(
|
||||
'echo-load-more-error',
|
||||
'echo-more-info',
|
||||
'echo-feedback',
|
||||
),
|
||||
'position' => 'top',
|
||||
),
|
||||
'ext.echo.alert' => $echoResourceTemplate + array(
|
||||
'styles' => 'alert/ext.echo.alert.css',
|
||||
'skinStyles' => array(
|
||||
'modern' => 'alert/ext.echo.alert.modern.css',
|
||||
'monobook' => 'alert/ext.echo.alert.monobook.css',
|
||||
),
|
||||
),
|
||||
'ext.echo.badge' => $echoResourceTemplate + array(
|
||||
'styles' => 'badge/ext.echo.badge.css',
|
||||
'skinStyles' => array(
|
||||
'modern' => 'badge/ext.echo.badge.modern.css',
|
||||
'monobook' => 'badge/ext.echo.badge.monobook.css',
|
||||
),
|
||||
),
|
||||
);
|
||||
include __DIR__ . '/Resources.php';
|
||||
|
||||
/**
|
||||
* This Echo hook can be used to define users who are by default interested in
|
||||
|
|
74
Makefile
Normal file
74
Makefile
Normal file
|
@ -0,0 +1,74 @@
|
|||
MW_INSTALL_PATH ?= ../..
|
||||
MEDIAWIKI_LOAD_URL ?= http://localhost:8080/w/load.php
|
||||
|
||||
# mediawiki-vagrant default to hhvm rather than php5, which is mostly
|
||||
# fine but really slow for commands like phplint
|
||||
PHP=/usr/bin/php5
|
||||
|
||||
###
|
||||
# Meta stuff
|
||||
###
|
||||
|
||||
remotes:
|
||||
@scripts/remotecheck.sh
|
||||
|
||||
# code review/pull patches/etc from command line
|
||||
gerrit: remotes
|
||||
@scripts/remotes/gerrit.py --project 'mediawiki/extensions/Echo' --gtscore -1 --ignorepattern 'WIP'
|
||||
|
||||
# interactively make sure en.json and qqq.json have all the
|
||||
# same message keys
|
||||
message: remotes
|
||||
@python scripts/remotes/message.py
|
||||
|
||||
# non-interactive version of message outputs result via exit code
|
||||
messagecheck: remotes
|
||||
@python scripts/remotes/message.py check
|
||||
|
||||
###
|
||||
# Lints
|
||||
###
|
||||
lint: jshint phplint checkless messagecheck
|
||||
|
||||
# Verify all php in the project has valid syntax
|
||||
phplint:
|
||||
@find ./ -type f -iname '*.php' -print0 | xargs -0 -P 12 -L 1 ${PHP} -l
|
||||
|
||||
# Install nodejs dependencies for jshint
|
||||
nodecheck:
|
||||
@which npm > /dev/null && npm install \
|
||||
|| (echo "You need to install Node.JS! See http://nodejs.org/" && false)
|
||||
|
||||
# Verify all javascript in the project has valid syntax and follows jshint rules
|
||||
jshint: nodecheck
|
||||
@node_modules/.bin/jshint modules/* --config .jshintrc
|
||||
|
||||
# Verify all less files are compilable
|
||||
checkless:
|
||||
@${PHP} ../../maintenance/checkLess.php
|
||||
|
||||
# Check compiled less files for duplicated rules
|
||||
csscss: gems
|
||||
echo "Generating CSS file..."
|
||||
php scripts/generatecss.php ${MEDIAWIKI_LOAD_URL} /tmp/foo.css
|
||||
csscss -v /tmp/foo.css --num 2 --no-match-shorthand --ignore-properties=display,position,top,bottom,left,right
|
||||
|
||||
###
|
||||
# Testing
|
||||
###
|
||||
test: phpunit qunit
|
||||
|
||||
# Run the projects phpunit tests
|
||||
phpunit:
|
||||
cd ${MW_INSTALL_PATH}/tests/phpunit && ${PHP} phpunit.php --configuration ${MW_INSTALL_PATH}/extensions/Echo/tests/echo.suite.xml --group=Echo
|
||||
|
||||
# Run the projects qunit tests
|
||||
qunit:
|
||||
@scripts/qunit.sh
|
||||
|
||||
###
|
||||
# Update this repository for csscss dependencies
|
||||
###
|
||||
gems:
|
||||
bundle install
|
||||
|
108
Resources.php
Normal file
108
Resources.php
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
/**
|
||||
* MediaWiki Extension: Echo
|
||||
* http://www.mediawiki.org/wiki/Extension:Echo
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @file
|
||||
* @ingroup Extensions
|
||||
* @author Andrew Garrett, Benny Situ, Ryan Kaldari, Erik Bernhardson
|
||||
* @licence MIT License
|
||||
*/
|
||||
|
||||
$echoResourceTemplate = array(
|
||||
'localBasePath' => __DIR__ . '/modules',
|
||||
'remoteExtPath' => 'Echo/modules',
|
||||
);
|
||||
|
||||
$wgResourceModules += array(
|
||||
// ext.echo.base is used by mobile notifications as well, so be sure not to add any
|
||||
// dependencies that do not target mobile.
|
||||
'ext.echo.base' => $echoResourceTemplate + array(
|
||||
'styles' => 'base/ext.echo.base.css',
|
||||
'scripts' => 'base/ext.echo.base.js',
|
||||
'messages' => array(
|
||||
'echo-error-preference',
|
||||
'echo-error-token',
|
||||
),
|
||||
'targets' => array( 'desktop', 'mobile' ),
|
||||
),
|
||||
'ext.echo.desktop' => $echoResourceTemplate + array(
|
||||
'scripts' => 'desktop/ext.echo.desktop.js',
|
||||
'dependencies' => array(
|
||||
'ext.echo.base',
|
||||
'mediawiki.api',
|
||||
'mediawiki.Uri',
|
||||
'mediawiki.jqueryMsg',
|
||||
'mediawiki.user',
|
||||
),
|
||||
),
|
||||
'ext.echo.overlay' => $echoResourceTemplate + array(
|
||||
'scripts' => array(
|
||||
'overlay/ext.echo.overlay.js',
|
||||
),
|
||||
'styles' => 'overlay/ext.echo.overlay.css',
|
||||
'skinStyles' => array(
|
||||
'modern' => 'overlay/ext.echo.overlay.modern.css',
|
||||
'monobook' => 'overlay/ext.echo.overlay.monobook.css',
|
||||
),
|
||||
'dependencies' => array(
|
||||
'ext.echo.desktop',
|
||||
'mediawiki.util',
|
||||
'mediawiki.language',
|
||||
),
|
||||
'messages' => array(
|
||||
'echo-overlay-title',
|
||||
'echo-overlay-title-overflow',
|
||||
'echo-overlay-link',
|
||||
'echo-none',
|
||||
'echo-mark-all-as-read',
|
||||
'echo-more-info',
|
||||
'echo-feedback',
|
||||
),
|
||||
),
|
||||
'ext.echo.special' => $echoResourceTemplate + array(
|
||||
'scripts' => array(
|
||||
'special/ext.echo.special.js',
|
||||
),
|
||||
'styles' => 'special/ext.echo.special.css',
|
||||
'dependencies' => array(
|
||||
'ext.echo.desktop',
|
||||
'mediawiki.ui.button',
|
||||
),
|
||||
'messages' => array(
|
||||
'echo-load-more-error',
|
||||
'echo-more-info',
|
||||
'echo-feedback',
|
||||
),
|
||||
'position' => 'top',
|
||||
),
|
||||
'ext.echo.alert' => $echoResourceTemplate + array(
|
||||
'styles' => 'alert/ext.echo.alert.css',
|
||||
'skinStyles' => array(
|
||||
'modern' => 'alert/ext.echo.alert.modern.css',
|
||||
'monobook' => 'alert/ext.echo.alert.monobook.css',
|
||||
),
|
||||
),
|
||||
'ext.echo.badge' => $echoResourceTemplate + array(
|
||||
'styles' => 'badge/ext.echo.badge.css',
|
||||
'skinStyles' => array(
|
||||
'modern' => 'badge/ext.echo.badge.modern.css',
|
||||
'monobook' => 'badge/ext.echo.badge.monobook.css',
|
||||
),
|
||||
),
|
||||
);
|
8
package.json
Normal file
8
package.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "Echo-dependencies",
|
||||
"description": "Node.js dependencies used in Echo development",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"jshint": ">=1.1.0"
|
||||
}
|
||||
}
|
29
scripts/generatecss.php
Executable file
29
scripts/generatecss.php
Executable file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
if ( sizeof( $argv ) < 3 ) {
|
||||
print "Call with 2 arguments: the path to the load url and the file to output to";
|
||||
exit();
|
||||
}
|
||||
$loadUrl = $argv[1];
|
||||
$outputFile = $argv[2];
|
||||
|
||||
define( 'MEDIAWIKI', true );
|
||||
const NS_MAIN = 0;
|
||||
$wgVersion = 1.23;
|
||||
$wgSpecialPages = array();
|
||||
$wgResourceModules = array();
|
||||
|
||||
include "Resources.php";
|
||||
|
||||
$query = array();
|
||||
$blacklist = array(
|
||||
);
|
||||
foreach( $wgResourceModules as $moduleName => $def ) {
|
||||
if ( !in_array( $moduleName, $blacklist ) ) {
|
||||
$query[] = $moduleName;
|
||||
}
|
||||
}
|
||||
|
||||
$url = $loadUrl . '?only=styles&skin=vector&modules=' . implode( $query, '|' );
|
||||
echo $url;
|
||||
$css = file_get_contents($url);
|
||||
file_put_contents( $outputFile, $css );
|
15
scripts/remotecheck.sh
Executable file
15
scripts/remotecheck.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ ! -e "scripts/remotes/gerrit.py" ]
|
||||
then
|
||||
mkdir -p scripts/remotes
|
||||
echo 'Installing GerritCommandLine tool'
|
||||
curl -o scripts/remotes/gerrit.py https://raw.githubusercontent.com/jdlrobson/GerritCommandLine/master/gerrit.py
|
||||
chmod +x scripts/remotes/gerrit.py
|
||||
fi
|
||||
if [ ! -e "scripts/remotes/message.py" ]
|
||||
then
|
||||
mkdir -p scripts/remotes
|
||||
echo 'Installing Message tool'
|
||||
curl -o scripts/remotes/message.py https://raw.githubusercontent.com/jdlrobson/WikimediaMessageDevScript/master/message.py
|
||||
chmod +x scripts/remotes/message.py
|
||||
fi
|
|
@ -4,6 +4,7 @@ require_once __DIR__ . "/../includes/BatchRowUpdate.php";
|
|||
|
||||
/**
|
||||
* Tests for BatchRowUpdate and its components
|
||||
* @group Echo
|
||||
*/
|
||||
class BatchRowUpdateTest extends MediaWikiTestCase {
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class ContainmentSetTest extends MediaWikiTestCase {
|
||||
|
||||
public function testGenericContains() {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class EchoDiffParserTest extends MediaWikiTestCase {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class EchoDiscussionParserTest extends MediaWikiTestCase {
|
||||
// TODO test cases for:
|
||||
// - generateEventsForRevision
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class EchoEmailFormatterTest extends MediaWikiTestCase {
|
||||
|
||||
private $emailSingle;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class MWEchoNotifUserTest extends MediaWikiTestCase {
|
||||
|
||||
protected function setUp() {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class EchoNotificationFormatterTest extends MediaWikiTestCase {
|
||||
|
||||
public function setUp() {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group Echo
|
||||
*/
|
||||
class SuppressionMaintenanceTest extends MediaWikiTestCase {
|
||||
|
||||
public static function provider_updateRow() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @group Echo
|
||||
* @group DataBase
|
||||
* @group medium
|
||||
*/
|
||||
|
|
19
tests/bootstrap.php
Normal file
19
tests/bootstrap.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* Find the correct path to /tests/phpunit/bootstrap.php in core
|
||||
*
|
||||
* Takes MW_INSTALL_PATH environment variable into account. This is used by the
|
||||
* test suite defined in mfe.suite.xml for MobileFrontend phpunit testing.
|
||||
*/
|
||||
|
||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||
if ( $IP === false ) {
|
||||
if ( realpath( '../..' ) ) {
|
||||
$IP = realpath( '../..' );
|
||||
} else {
|
||||
$IP = dirname( dirname( dirname( __DIR__ ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
require_once( $IP . "/tests/phpunit/bootstrap.php" );
|
||||
|
30
tests/echo.suite.xml
Normal file
30
tests/echo.suite.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- colors don't work on Windows! -->
|
||||
<phpunit bootstrap="bootstrap.php"
|
||||
colors="true"
|
||||
backupGlobals="false"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
stopOnFailure="false"
|
||||
timeoutForSmallTests="2"
|
||||
timeoutForMediumTests="10"
|
||||
timeoutForLargeTests="60"
|
||||
strict="true"
|
||||
verbose="true">
|
||||
<testsuites>
|
||||
<testsuite name="extensions">
|
||||
<!-- assumes extension is installed to mediawiki/extensions/Echo -->
|
||||
<file>../../../tests/phpunit/suites/ExtensionsTestSuite.php</file>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>Utility</group>
|
||||
<group>Broken</group>
|
||||
<group>ParserFuzz</group>
|
||||
<group>Stub</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
</phpunit>
|
Loading…
Reference in a new issue