Skip to content

Commit

Permalink
code style + CI change
Browse files Browse the repository at this point in the history
  • Loading branch information
FO-nTTaX committed Jan 17, 2022
1 parent b18a59c commit 914c57f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 59 deletions.
40 changes: 5 additions & 35 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
name: Code Style

on: [ push, pull_request ]
on: [ push, pull_request, workflow_dispatch ]

jobs:
test-php:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install composer dependencies
run: composer install


- name: Run composer tests
run: composer test

uses: Liquipedia/CI-templates/.github/workflows/.php-ci.yml@main
test-javascript:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install npm dependencies
run: npm install

- name: Run npm tests
run: npm run test-script

test-style:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install npm dependencies
run: npm install

- name: Run npm tests
run: npm run test-style
uses: Liquipedia/CI-templates/.github/workflows/.javascript-ci.yml@main
test-css:
uses: Liquipedia/CI-templates/.github/workflows/.css-ci.yml@main
21 changes: 11 additions & 10 deletions extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dota2WebApi",
"version": "1.3.0",
"version": "1.3.1",
"author": [
"[https://liquipedia.net/starcraft2/User:ChapatiyaqPTSM Chapatiyaq]",
"[https://fo-nttax.de FO-nTTaX]",
Expand All @@ -11,7 +11,7 @@
"license-name": "MIT",
"type": "other",
"requires": {
"MediaWiki": ">= 1.35.0",
"MediaWiki": ">= 1.35.3",
"extensions": {
"Dota2DB": "*"
}
Expand All @@ -22,15 +22,16 @@
]
},
"AutoloadNamespaces": {
"Liquipedia\\Dota2WebApi\\": "src/"
"Liquipedia\\Extension\\Dota2WebApi\\": "src/"
},
"HookHandlers": {
"Main": {
"class": "\\Liquipedia\\Extension\\Dota2WebApi\\Hooks\\MainHookHandler"
}
},
"Hooks": {
"EditPage::showEditForm:initial": [
"Liquipedia\\Dota2WebApi\\Hooks::onEditPageShowEditFormInitial"
],
"MakeGlobalVariablesScript": [
"Liquipedia\\Dota2WebApi\\Hooks::onMakeGlobalVariablesScript"
]
"EditPage::showEditForm:initial": "Main",
"MakeGlobalVariablesScript": "Main"
},
"ResourceModules": {
"ext.dota2WebApi.toolbar": {
Expand All @@ -57,5 +58,5 @@
"localBasePath": "",
"remoteExtPath": "Dota2WebApi"
},
"manifest_version": 1
"manifest_version": 2
}
34 changes: 20 additions & 14 deletions src/Hooks.php → src/Hooks/MainHookHandler.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
<?php

namespace Liquipedia\Dota2WebApi;
namespace Liquipedia\Extension\Dota2WebApi\Hooks;

use EditPage;
use MediaWiki\Hook\EditPage__showEditForm_initialHook;
use MediaWiki\Hook\MakeGlobalVariablesScriptHook;
use OutputPage;

class Hooks {
class MainHookHandler implements
EditPage__showEditForm_initialHook,
MakeGlobalVariablesScriptHook
{

// phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName

/**
* @param EditPage $editor
* @param OutputPage $out
* @return bool
*/
public function onEditPage__showEditForm_initial( $editor, $out ) {
$out->addModules( 'ext.dota2WebApi.toolbar' );
return true;
}

/**
* @param array &$vars
* @param OutputPage $out
* @return bool
*/
public static function onMakeGlobalVariablesScript( &$vars, OutputPage $out ) {
public function onMakeGlobalVariablesScript( &$vars, $out ): void {
$config = $out->getConfig();
$extensionAssetsPath = $config->get( 'ExtensionAssetsPath' );
$extensionPath = $config->get( 'ScriptPath' ) . '/extensions';
Expand All @@ -21,17 +38,6 @@ public static function onMakeGlobalVariablesScript( &$vars, OutputPage $out ) {
}
$dota2WebApiImagePath = $extensionPath . '/Dota2WebApi/resources/images/';
$vars[ 'wgDota2WebApiImagePath' ] = $dota2WebApiImagePath;
return true;
}

/**
* @param EditPage &$editPage
* @param OutputPage &$output
* @return bool
*/
public static function onEditPageShowEditFormInitial( EditPage &$editPage, OutputPage &$output ) {
$output->addModules( 'ext.dota2WebApi.toolbar' );
return true;
}

}

0 comments on commit 914c57f

Please sign in to comment.