Skip to content

Commit

Permalink
Init from 0e48ddffe7ca5b0889b07ed4f1dd9294b72a8787
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianheine committed Jul 3, 2014
0 parents commit 8d75b90
Show file tree
Hide file tree
Showing 8 changed files with 526 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
45 changes: 45 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"supernew": true,
"shadow": true,
"noarg": true,
"noempty": true,
"nonew": true,
"quotmark": "single",
"trailing": true,
"undef": true,
"unused": "vars",
"laxbreak": true,
"laxcomma": false,
"onevar": false,
"bitwise": false,
"forin": false,
"regexp": false,
"strict": true,
"scripturl": true,

// Environment
"browser": true,

// Globals
"predef": [
"dataValues",
"globeCoordinate",
"jQuery",
"mediaWiki",
"QUnit",
"valueFormatters",
"valueParsers",
"time",
"util",
// require.js globals:
"require",
"requirejs",
"define"
]
}
347 changes: 347 additions & 0 deletions LICENCE

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Wikibase datamodel serialization implementation in JavaScript

## Release notes

### 1.0.0 (2014-07-03)

Initial release.
38 changes: 38 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "wikibase/serialization-javascript",
"description": "Wikibase datamodel serialization implementation in JavaScript",
"require": {
"data-values/javascript": "~0.5.0",
"wikibase/data-model-javascript": "~0.2.0"
},
"license": "GPL-2.0+",
"authors": [
{
"name": "Daniel Werner",
"homepage": "https://www.mediawiki.org/wiki/User:Danwe"
},
{
"name": "H. Snater",
"homepage": "http://www.snater.com"
},
{
"name": "Jeroen De Dauw",
"email": "jeroendedauw@gmail.com",
"homepage": "http://jeroendedauw.com"
},
{
"name": "Adrian Lang",
"email": "adrian.lang@wikimedia.de"
}
],
"minimum-stability": "dev",
"support": {
"issues": "https://bugzilla.wikimedia.org/",
"irc": "irc://irc.freenode.net/wikidata"
},
"autoload": {
"files" : [
"init.mw.php"
]
}
}
4 changes: 4 additions & 0 deletions init.mw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

include 'resources.mw.php';
include 'resources.test.mw.php';
57 changes: 57 additions & 0 deletions resources.mw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

/**
* File for Wikibase resourceloader modules.
*
* @since 0.2
*
* @licence GNU GPL v2+
* @author Daniel Werner
* @author H. Snater < mediawiki@snater.com >
*
* @codeCoverageIgnoreStart
*/
return call_user_func( function() {
global $wgResourceModules;

preg_match(
'+^(.*?)' . preg_quote( DIRECTORY_SEPARATOR ) . '(vendor|extensions)' .
preg_quote( DIRECTORY_SEPARATOR ) . '(.*)$+',
__DIR__,
$remoteExtPathParts
);

$moduleTemplate = array(
'localBasePath' => __DIR__,
'remoteExtPath' => '../' . $remoteExtPathParts[2] . DIRECTORY_SEPARATOR . $remoteExtPathParts[3],
);

$modules = array(
'wikibase.serialization' => $moduleTemplate + array(
'scripts' => array(
'src/serialization.js',
'src/serialization.Serializer.js',
'src/serialization.Unserializer.js',
'src/serialization.SerializerFactory.js',
),
'dependencies' => array(
'util.inherit',
'wikibase',
)
),

'wikibase.serialization.entities' => $moduleTemplate + array(
'scripts' => array(
'src/serialization.EntityUnserializer.js',
'src/serialization.EntityUnserializer.propertyExpert.js',
),
'dependencies' => array(
'util.inherit',
'wikibase.serialization',
'wikibase.datamodel',
)
),
);

$wgResourceModules = array_merge( $wgResourceModules, $modules );
} );
27 changes: 27 additions & 0 deletions resources.test.mw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

global $wgHooks;

$wgHooks['ResourceLoaderTestModules'][] = function( array &$testModules, \ResourceLoader &$resourceLoader ) {
preg_match(
'+^(.*?)' . preg_quote( DIRECTORY_SEPARATOR ) . '(vendor|extensions)' .
preg_quote( DIRECTORY_SEPARATOR ) . '(.*)$+',
__DIR__,
$remoteExtPathParts
);

$moduleTemplate = array(
'localBasePath' => __DIR__,
'remoteExtPath' => '../' . $remoteExtPathParts[2] . DIRECTORY_SEPARATOR . $remoteExtPathParts[3],
);

// FIXME: No tests here
$testModules['qunit']['wikibase.serialization.tests'] = $moduleTemplate + array(
'scripts' => array(
),
'dependencies' => array(
)
);

return true;
};

0 comments on commit 8d75b90

Please sign in to comment.