release 0.1 - 2021.09.11

master
Jean-Christian Paul Denis 2021-09-11 23:01:06 +02:00
parent 84aa0e52b2
commit 3d0d791540
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
7 changed files with 74 additions and 52 deletions

View File

@ -1,10 +1,13 @@
0.0.2
0.2 -dev
- [ ] add global config for file size limit
- [ ] add function to summarize by action what was done
- [x] use _requires_ or dc_min in _fixdcstore_
- [x] fix unwanted translation of module name in _fixdcstore_
- [x] add modifier _first upper case_ : _\u_ in _fixphpheader_
- [x] fix whitespace and newline for bloc content in _fixphpheader_
- [ ] add module to check depracated Dotclear function
- [ ] add module to check deprecated PHP function
- [ ] add module to check directory structure
- [ ] add DA badge to module _gitshields_
0.0.1
0.1 - 2021.09.11
- First release
0.0.1 - 2021.09.11
- First pre-release

View File

@ -2,8 +2,9 @@
[![Release](https://img.shields.io/github/v/release/JcDenis/improve)](https://github.com/JcDenis/improve/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/improve)](https://github.com/JcDenis/improve/releases)
[![Issue](https://img.shields.io/github/issues/JcDenis/improve)](https://github.com/JcDenis/improve/issues)
[![Issues](https://img.shields.io/github/issues/JcDenis/improve)](https://github.com/JcDenis/improve/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download)
[![Dotclear](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/improve)
[![License](https://img.shields.io/github/license/JcDenis/improve)](https://github.com/JcDenis/improve/blob/master/LICENSE)
## WHAT IS IMPROVE ?

View File

@ -19,7 +19,7 @@ $this->registerModule(
'improve',
'Tiny tools to fix things for module devs',
'Jean-Christian Denis and contributors',
'0.0.1',
'0.1',
[
'requires' => [['core', '2.19']],
'permissions' => null,

View File

@ -1,10 +1,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="improve">
<name>improve</name>
<version>0.0.1</version>
<version>0.1</version>
<author>Jean-Christian Denis and contributors</author>
<desc>Tiny tools to fix things for module devs</desc>
<file>https://github.com/JcDenis/improve/releases/download/v0.0.1/plugin-improve.zip</file>
<file>https://github.com/JcDenis/improve/releases/download/v0.1/plugin-improve.zip</file>
<da:dcmin>2.19</da:dcmin>
<da:details>https://github.com/JcDenis/improve</da:details>
<da:support>https://github.com/JcDenis/improve</da:support>

View File

@ -19,11 +19,12 @@ class ImproveActionGitshields extends ImproveAction
'target' => '/^([^\n]+)[\r\n|\n]{1,}/ms'
];
protected $bloc_content = [
'[![Release](https://img.shields.io/github/v/release/%username%/%module%)](https://github.com/%username%/%module%/releases)',
'[![Date](https://img.shields.io/github/release-date/%username%/%module%)](https://github.com/%username%/%module%/releases)',
'[![Issue](https://img.shields.io/github/issues/%username%/%module%)](https://github.com/%username%/%module%/issues)',
'[![Dotclear](https://img.shields.io/badge/dotclear-v%dotclear%-blue.svg)](https://fr.dotclear.org/download)',
'[![License](https://img.shields.io/github/license/%username%/%module%)](https://github.com/%username%/%module%/blob/master/LICENSE)'
'release' => '[![Release](https://img.shields.io/github/v/release/%username%/%module%)](https://github.com/%username%/%module%/releases)',
'date' => '[![Date](https://img.shields.io/github/release-date/%username%/%module%)](https://github.com/%username%/%module%/releases)',
'issues' => '[![Issues](https://img.shields.io/github/issues/%username%/%module%)](https://github.com/%username%/%module%/issues)',
'dotclear' => '[![Dotclear](https://img.shields.io/badge/dotclear-v%dotclear%-blue.svg)](https://fr.dotclear.org/download)',
'dotaddict' => '[![Dotclear](https://img.shields.io/badge/dotaddict-official-green.svg)](https://%type%s.dotaddict.org/dc2/details/%module%)',
'license' => '[![License](https://img.shields.io/github/license/%username%/%module%)](https://github.com/%username%/%module%/blob/master/LICENSE)'
];
protected function init(): bool
@ -48,15 +49,23 @@ class ImproveActionGitshields extends ImproveAction
public function configure($url): ?string
{
if (!empty($_POST['save']) && !empty($_POST['username'])) {
$this->setPreferences('username', (string) $_POST['username']);
$this->setPreferences([
'username' => (string) $_POST['username'],
'dotaddict' => !empty($_POST['dotaddict'])
]);
$this->redirect($url);
}
return '
<p><label for="bloc_action">' . __('Your Github user name :') . '</label>' .
<p><label for="username">' . __('Your Github user name :') . '</label>' .
form::field('username', 60, 100, $this->getPreference('username')) . '
</p><p class="form-note">' . __('Used in your Github URL: http://github.com/username/module_id.') . '<br />' .
__('If you have badges not created by this tool in the README.md file you should remove them manually.') . '</p>';
__('If you have badges not created by this tool in the README.md file you should remove them manually.') . '</p>
<p><label for="dotaddict">' .
form::checkbox('dotaddict', 1, !empty($this->getPreference('dotaddict'))) . ' '.
__('Include Dotaddict badge') . '</label>
</p><p class="form-note">' . __('If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.') . '</p>';
}
public function openModule(string $module_type, array $module_info): ?bool
@ -83,22 +92,19 @@ class ImproveActionGitshields extends ImproveAction
private function replaceInfo()
{
$bloc = $this->bloc_content;
if (empty($bloc)) {
self::notice(__('bloc is empty'), false);
return null;
}
$username = $this->getPreference('username');
$module = $this->module['id'];
$type = $this->module['type'];
$dotclear = $this->getDotclearVersion();
foreach($bloc as $k => $v) {
$bloc = [];
foreach($this->bloc_content as $k => $v) {
if ($k == 'dotaddict' && empty($this->getPreference('dotaddict'))) {
continue;
}
$bloc[$k] = trim(str_replace(
['%username%', '%module%', '%dotclear%', "\r\n", "\n"],
[$username, $module, $dotclear, '', ''],
['%username%', '%module%', '%dotclear%', '%type%', "\r\n", "\n"],
[$username, $module, $dotclear, $type, '', ''],
$v
));
}

View File

@ -1,7 +1,7 @@
<?php
// Language: Français
// Module: improve - 0.0.1
// Date: 2021-09-11 20:19:34
// Module: improve - 0.1
// Date: 2021-09-11 20:59:33
// Translated with dcTranslater - 2021.09.02.1
#inc/class.improve.php:77
@ -64,24 +64,26 @@ $GLOBALS['__l10n']['no details URL'] = 'Lien de détail non défini';
#inc/lib.improve.action.dcstore.php:162
$GLOBALS['__l10n']['no support URL'] = 'Lien de support non défini';
#inc/lib.improve.action.gitshields.php:33
#inc/lib.improve.action.gitshields.php:34
$GLOBALS['__l10n']['Fix shields badges'] = 'Fixer les badges shields.io';
#inc/lib.improve.action.gitshields.php:34
#inc/lib.improve.action.gitshields.php:35
$GLOBALS['__l10n']['Add and maintain shields.io badges to the REDAME.md file'] = 'Ajoute et maintient à jour les badges shields.io du fichier README.md';
#inc/lib.improve.action.gitshields.php:56
#inc/lib.improve.action.gitshields.php:60
$GLOBALS['__l10n']['Your Github user name :'] = 'Votre "username" Github :';
#inc/lib.improve.action.gitshields.php:58
#inc/lib.improve.action.gitshields.php:62
$GLOBALS['__l10n']['Used in your Github URL: http://github.com/username/module_id.'] = 'Utilisé dans l\'URL Github tel que : http://github.com/username/module_id.';
#inc/lib.improve.action.gitshields.php:59
#inc/lib.improve.action.gitshields.php:63
$GLOBALS['__l10n']['If you have badges not created by this tool in the README.md file you should remove them manually.'] = 'Si vous avez déjà des badges non créés par cet outil, vous devrez les retirer manuellement.';
#inc/lib.improve.action.gitshields.php:89
#inc/lib.improve.action.phpheader.php:153
$GLOBALS['__l10n']['bloc is empty'] = 'le bloc est vide';
#inc/lib.improve.action.gitshields.php:67
$GLOBALS['__l10n']['Include Dotaddict badge'] = 'Inclure le badge Dotaddict';
#inc/lib.improve.action.gitshields.php:68
$GLOBALS['__l10n']['If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.'] = 'Si votre plugin ou theme est sur Dotaddict, vous pouvez ajouter un badge lier à ses détails sur DA.';
#inc/lib.improve.action.licensefile.php:29
$GLOBALS['__l10n']['Fix license file'] = 'Fixer le fichier de licence';
@ -195,6 +197,9 @@ $GLOBALS['__l10n']['You can use wildcards %s'] = 'Vous pouvez utiliser les joker
#inc/lib.improve.action.phpheader.php:93
$GLOBALS['__l10n']['Do not put structural elements to the begining of lines.'] = 'Ne pas mettre d\'élément de structure en début de ligne';
#inc/lib.improve.action.phpheader.php:153
$GLOBALS['__l10n']['bloc is empty'] = 'le bloc est vide';
#inc/lib.improve.action.phpheader.php:182
$GLOBALS['__l10n']['failed to parse bloc'] = 'impossible de traiter le bloc';

View File

@ -1,14 +1,14 @@
# Language: Français
# Module: improve - 0.0.1
# Date: 2021-09-11 20:19:34
# Module: improve - 0.1
# Date: 2021-09-11 20:59:33
# Translated with translater 2021.09.02.1
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: improve 0.0.1\n"
"Project-Id-Version: improve 0.1\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-09-11T20:19:34+00:00\n"
"PO-Revision-Date: 2021-09-11T20:59:33+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -95,30 +95,33 @@ msgstr "Lien de détail non défini"
msgid "no support URL"
msgstr "Lien de support non défini"
#: inc/lib.improve.action.gitshields.php:33
#: inc/lib.improve.action.gitshields.php:34
msgid "Fix shields badges"
msgstr "Fixer les badges shields.io"
#: inc/lib.improve.action.gitshields.php:34
#: inc/lib.improve.action.gitshields.php:35
msgid "Add and maintain shields.io badges to the REDAME.md file"
msgstr "Ajoute et maintient à jour les badges shields.io du fichier README.md"
#: inc/lib.improve.action.gitshields.php:56
#: inc/lib.improve.action.gitshields.php:60
msgid "Your Github user name :"
msgstr "Votre \"username\" Github :"
#: inc/lib.improve.action.gitshields.php:58
#: inc/lib.improve.action.gitshields.php:62
msgid "Used in your Github URL: http://github.com/username/module_id."
msgstr "Utilisé dans l'URL Github tel que : http://github.com/username/module_id."
#: inc/lib.improve.action.gitshields.php:59
#: inc/lib.improve.action.gitshields.php:63
msgid "If you have badges not created by this tool in the README.md file you should remove them manually."
msgstr "Si vous avez déjà des badges non créés par cet outil, vous devrez les retirer manuellement."
#: inc/lib.improve.action.gitshields.php:89
#: inc/lib.improve.action.phpheader.php:153
msgid "bloc is empty"
msgstr "le bloc est vide"
#: inc/lib.improve.action.gitshields.php:67
msgid "Include Dotaddict badge"
msgstr "Inclure le badge Dotaddict"
#: inc/lib.improve.action.gitshields.php:68
msgid "If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict."
msgstr "Si votre plugin ou theme est sur Dotaddict, vous pouvez ajouter un badge lier à ses détails sur DA."
#: inc/lib.improve.action.licensefile.php:29
msgid "Fix license file"
@ -269,6 +272,10 @@ msgstr "Vous pouvez utiliser les jokers suivants :"
msgid "Do not put structural elements to the begining of lines."
msgstr "Ne pas mettre d'élément de structure en début de ligne"
#: inc/lib.improve.action.phpheader.php:153
msgid "bloc is empty"
msgstr "le bloc est vide"
#: inc/lib.improve.action.phpheader.php:182
msgid "failed to parse bloc"
msgstr "impossible de traiter le bloc"