Skip to content

Start using extension.json and enable PHPCS on Travis #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ php:
sudo: false

before_script:
- composer install --prefer-source
- nvm install 4

script: npm install && npm run eslint
script:
- composer test
- npm install && npm run eslint

notifications:
irc:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ version 2.0 of this package:

## Release notes

### 2.1.0 (dev)

* Updated the MediaWiki entry point to use the extension.json format.
* Added code sniffers for JavaScript as well as PHP.
* Dropped compatibility with PHP 5.3.

### 2.0.8 (2016-09-09)

* Fix an issue with MediaWiki loading (init.mw.php)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"scripts": {
"fix": "phpcbf",
"test": [
"vendor/bin/phpcs . -p -s"
"phpcs -p -s"
]
}
}
14 changes: 3 additions & 11 deletions init.mw.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@
die( 'Not an entry point.' );
}

$GLOBALS['wgExtensionCredits']['wikibase'][] = [
'path' => __FILE__,
'name' => 'Wikibase Serialization JavaScript',
'version' => WIKIBASE_SERIALIZATION_JAVASCRIPT_VERSION,
'author' => [
'[http://www.snater.com H. Snater]',
],
'url' => 'https://github.com/wmde/WikibaseSerializationJavaScript',
'description' => 'JavaScript library containing serializers and deserializers for the Wikibase DataModel.',
'license-name' => 'GPL-2.0+',
];
if ( function_exists( 'wfLoadExtension' ) ) {
wfLoadExtension( 'WikibaseSerializationJavaScript', __DIR__ . '/mediawiki-extension.json' );
}

include __DIR__ . '/resources.php';
include __DIR__ . '/resources.tests.php';
2 changes: 1 addition & 1 deletion init.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

define( 'WIKIBASE_SERIALIZATION_JAVASCRIPT_VERSION', '2.0.8' );
define( 'WIKIBASE_SERIALIZATION_JAVASCRIPT_VERSION', '2.1.0' );

if ( defined( 'MEDIAWIKI' ) ) {
call_user_func( function() {
Expand Down
12 changes: 12 additions & 0 deletions mediawiki-extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Wikibase Serialization JavaScript",
"version": "2.1.0",
"author": [
"[http://www.snater.com H. Snater]"
],
"url": "https://github.com/wmde/WikibaseSerializationJavaScript",
"description": "JavaScript library containing serializers and deserializers for the Wikibase DataModel.",
"license-name": "GPL-2.0+",
"type": "wikibase",
"manifest_version": 1
}
6 changes: 5 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0"?>
<ruleset name="SerializationJavaScript">
<rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase" />
<rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase" />

<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="108" />
</properties>
</rule>

<file>.</file>
<exclude-pattern>node_modules</exclude-pattern>
</ruleset>
2 changes: 1 addition & 1 deletion tests/SerializerFactory.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QUnit.test( 'registerSerializer(), newSerializerFor()', function( assert ) {
);

assert.ok(
serializerFactory.newSerializerFor( new ( testSets[0].Constructor ) ).constructor
serializerFactory.newSerializerFor( new testSets[0].Constructor() ).constructor
=== testSets[0].Serializer,
'Retrieved serializer by object.'
);
Expand Down