Tobias Gritschacher has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311411

Change subject: Create boilerplate extension for Electron PDF Service
......................................................................

Create boilerplate extension for Electron PDF Service

Bug: T142201
Change-Id: I0f0c9a02dfbbd5c2189d01f3de7fffc14be0c0b0
---
A .gitignore
A .jscsrc
A .jshintignore
A .jshintrc
A ElectronPdfService.hooks.php
A ElectronPdfService.php
A Gruntfile.js
A README.md
A composer.json
A extension.json
A i18n/en.json
A i18n/qqq.json
A modules/ext.ElectronPdfService.css
A modules/ext.ElectronPdfService.init.js
A modules/ext.ElectronPdfService.js
A package.json
A phpcs.xml
17 files changed, 210 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ElectronPdfService 
refs/changes/11/311411/1

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..51d4694
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.*.swp
+*~
+/.project
+/.idea
+/composer.lock
+/vendor
+/node_modules
diff --git a/.jscsrc b/.jscsrc
new file mode 100644
index 0000000..04baa68
--- /dev/null
+++ b/.jscsrc
@@ -0,0 +1,4 @@
+{
+       "preset": "wikimedia",
+       "excludeFiles": [ "node_modules/**", "vendor/**" ]
+}
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..82eaa05
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,2 @@
+node_modules/**
+vendor/**
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..d43c482
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,20 @@
+{
+       // Enforcing
+       "bitwise": true,
+       "eqeqeq": true,
+       "es3": true,
+       "latedef": true,
+       "noarg": true,
+       "nonew": true,
+       "undef": true,
+       "unused": true,
+       "strict": false,
+
+       // Environment
+       "browser": true,
+
+       "globals": {
+               "mw": false,
+               "$": false
+       }
+}
diff --git a/ElectronPdfService.hooks.php b/ElectronPdfService.hooks.php
new file mode 100644
index 0000000..5b5e015
--- /dev/null
+++ b/ElectronPdfService.hooks.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Hooks for ElectronPdfService extension
+ *
+ * @file
+ * @ingroup Extensions
+ * @license GPL-2.0+
+ */
+
+class ElectronPdfServiceHooks {
+    public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
+    }
+}
diff --git a/ElectronPdfService.php b/ElectronPdfService.php
new file mode 100644
index 0000000..f7976be
--- /dev/null
+++ b/ElectronPdfService.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * ElectronPdfService MediaWiki Extension
+ */
+
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'ElectronPdfService' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['ElectronPdfService'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for ElectronPdfService 
extension. Please use wfLoadExtension ' .
+               'instead, see 
https://www.mediawiki.org/wiki/Extension_registration for more details.'
+       );
+       return true;
+} else {
+       die( 'This version of the ElectronPdfService extension requires 
MediaWiki 1.25+' );
+}
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..36b41e8
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,35 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
+       grunt.loadNpmTasks( 'grunt-banana-checker' );
+       grunt.loadNpmTasks( 'grunt-jscs' );
+
+       grunt.initConfig( {
+               jshint: {
+                       options: {
+                               jshintrc: true
+                       },
+                       all: [
+                               '*.js',
+                               'modules/**/*.js'
+                       ]
+               },
+               jscs: {
+                       src: '<%= jshint.all %>'
+               },
+               banana: {
+                       all: 'i18n/'
+               },
+               jsonlint: {
+                       all: [
+                               '**/*.json',
+                               '!node_modules/**',
+                               '!vendor/**'
+                       ]
+               }
+       } );
+
+       grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] 
);
+       grunt.registerTask( 'default', 'test' );
+};
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b526c4c
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+This is an extension for adding browser based PDF rendering support through 
Electron PDF service
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..98d41d9
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,13 @@
+{
+       "require-dev": {
+               "jakub-onderka/php-parallel-lint": "0.9.2",
+               "mediawiki/mediawiki-codesniffer": "0.7.2"
+       },
+       "scripts": {
+               "fix": "phpcbf",
+               "test": [
+                       "parallel-lint . --exclude vendor",
+                       "phpcs -p -s"
+               ]
+       }
+}
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..f0b675b
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,42 @@
+{
+       "name": "ElectronPdfService",
+       "version": "0.0.1",
+       "author": [
+               "WMDE"
+       ],
+       "url": "https://phabricator.wikimedia.org/T142201";,
+       "descriptionmsg": "electronPdfService-desc",
+       "license-name": "GPL-2.0+",
+       "type": "other",
+       "manifest_version": 1,
+       "AutoloadClasses": {
+               "TwoColConflictHooks": "ElectronPdfService.hooks.php"
+       },
+       "Hooks": {
+               "BeforePageDisplay": [
+                       "ElectronPdfServiceHooks::onBeforePageDisplay"
+               ]
+       },
+       "MessagesDirs": {
+               "ElectronPdfService": [
+                       "i18n"
+               ]
+       },
+       "ResourceModules": {
+               "ext.ElectronPdfService.init": {
+                       "scripts": [
+                               "modules/ext.ElectronPdfService.js",
+                               "modules/ext.ElectronPdfService.init.js"
+                       ],
+                       "styles": [
+                               "modules/ext.ElectronPdfService.css"
+                       ],
+                       "messages": [],
+                       "dependencies": []
+               }
+       },
+       "ResourceFileModulePaths": {
+               "localBasePath": "",
+               "remoteExtPath": "ElectronPdfService"
+       }
+}
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 0000000..784bc5a
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,9 @@
+{
+       "@metadata": {
+               "authors": [
+                       "WMDE"
+               ]
+       },
+       "electronPdfService": "ElectronPdfService",
+       "electronPdfService-desc": "This is an extension for adding browser 
based PDF rendering support through Electron PDF service"
+}
\ No newline at end of file
diff --git a/i18n/qqq.json b/i18n/qqq.json
new file mode 100644
index 0000000..2e5096b
--- /dev/null
+++ b/i18n/qqq.json
@@ -0,0 +1,9 @@
+{
+       "@metadata": {
+               "authors": [
+                       "WMDE"
+               ]
+       },
+       "electronPdfService": "electronPdfService",
+       "electronPdfService-desc": "{{desc|name=ElectronPdfService|url=}}"
+}
\ No newline at end of file
diff --git a/modules/ext.ElectronPdfService.css 
b/modules/ext.ElectronPdfService.css
new file mode 100644
index 0000000..4806220
--- /dev/null
+++ b/modules/ext.ElectronPdfService.css
@@ -0,0 +1,3 @@
+.mw-electronpdfservice-foo {
+       float: left;
+}
diff --git a/modules/ext.ElectronPdfService.init.js 
b/modules/ext.ElectronPdfService.init.js
new file mode 100644
index 0000000..a18ebbb
--- /dev/null
+++ b/modules/ext.ElectronPdfService.init.js
@@ -0,0 +1,3 @@
+( function () {
+
+}() );
diff --git a/modules/ext.ElectronPdfService.js 
b/modules/ext.ElectronPdfService.js
new file mode 100644
index 0000000..c203f4b
--- /dev/null
+++ b/modules/ext.ElectronPdfService.js
@@ -0,0 +1,10 @@
+( function () {
+
+       /**
+        * @class mw.electronPdfService
+        * @singleton
+        */
+       mw.electronPdfService = {
+       };
+
+}() );
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..d6d0f28
--- /dev/null
+++ b/package.json
@@ -0,0 +1,14 @@
+{
+  "private": true,
+  "scripts": {
+    "test": "grunt test"
+  },
+  "devDependencies": {
+    "grunt": "0.4.5",
+    "grunt-cli": "0.1.13",
+    "grunt-contrib-jshint": "0.11.3",
+    "grunt-banana-checker": "0.4.0",
+    "grunt-jscs": "2.5.0",
+    "grunt-jsonlint": "1.0.7"
+  }
+}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..d81a292
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<ruleset>
+       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
+       <file>.</file>
+       <arg name="extensions" value="php,php5,inc"/>
+       <arg name="encoding" value="utf8"/>
+       <exclude-pattern>vendor</exclude-pattern>
+</ruleset>

-- 
To view, visit https://gerrit.wikimedia.org/r/311411
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f0c9a02dfbbd5c2189d01f3de7fffc14be0c0b0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ElectronPdfService
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to