Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
wip(buildtools): moved buildtools and some config files into developm…
Browse files Browse the repository at this point in the history
…ent folder
  • Loading branch information
Phhere committed Apr 5, 2015
1 parent 8c9f5e9 commit 3fade5c
Show file tree
Hide file tree
Showing 22 changed files with 528 additions and 149 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ root = true
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
[*]
# Set default charset
charset = utf-8
# tab indentation
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ tools:
enabled: false
php_code_sniffer:
config:
ruleset: Ruleset.xml
ruleset: development/Ruleset.xml
standard: PSR2
extensions:
- php
Expand Down
23 changes: 11 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ module.exports = function( grunt ) {
"!.jshintrc",
"!circle.yml",
"!Gruntfile.js",
"!scope.txt",
"!type.txt",
"!grunt-log.txt",
"!*.zip",
"!Ruleset.xml",
"!vendor",
"!components",
"!node_modules",
"!tests"
"!tests",
"!development"
],
csss = [ "**/*.css" ],
excludes = [
Expand All @@ -62,7 +60,8 @@ module.exports = function( grunt ) {
"!components/**",
"!vendor/**",
"!tmp/**",
"!tests/**"
"!tests/**",
'!development/**'
];

require( "load-grunt-tasks" )( grunt, {
Expand All @@ -81,10 +80,10 @@ module.exports = function( grunt ) {
pkg: grunt.file.readJSON( "package.json" ),

scopeRegex: "\\b" +
grunt.file.read( "scope.txt" ).trim().split( "\n" ).join( "\\b|\\b" ) +
grunt.file.read( "development/scope.txt" ).trim().split( "\n" ).join( "\\b|\\b" ) +
"\\b",

typeRegex: grunt.file.read( "type.txt" ).trim().split( "\n" ).join( "|" ),
typeRegex: grunt.file.read( "development/type.txt" ).trim().split( "\n" ).join( "|" ),

versioncheck: {
options: {
Expand Down Expand Up @@ -134,7 +133,7 @@ module.exports = function( grunt ) {
},
options: {
bin: "vendor/bin/phpcs",
standard: "Ruleset.xml",
standard: "development/Ruleset.xml",
tabWidth: "4",
showSniffCodes: true
}
Expand Down Expand Up @@ -290,12 +289,12 @@ module.exports = function( grunt ) {

exec: {
quickcheck: {
command: "sh ./qphpcs.sh",
command: "sh ./development/qphpcs.sh",
stdout: true,
stderr: true
},
sortLanguageKeys: {
command: "cd tools && php -f sort_translations.php"
command: "cd development/tools && php -f sort_translations.php"
}
},

Expand Down Expand Up @@ -473,12 +472,12 @@ module.exports = function( grunt ) {
"check type": {
regex: new RegExp( "^(" + grunt.config.get( "typeRegex" ) + ")\\(", "i" ),
explanation: "The commit should start with a type like fix, feat, or chore. " +
"See type.txt for a full list."
"See development/type.txt for a full list."
},
"check scope": {
regex: new RegExp( "\\((" + grunt.config.get( "scopeRegex" ) + ")\\)", "i" ),
explanation: "The commit should include a scope like (forum), (news) or " +
"(buildtools). See scope.txt for a full list."
"(buildtools). See development/scope.txt for a full list."
},
// commented out for later use
//"check close github issue": {
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions development/qphpcs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

for check in `git status | egrep "modified:|new file:" | grep "\.php" | awk ' { print $2 } '`; do echo "*** PHPCS Quickcheck - $check ***"; ./vendor/bin/phpcs -s --standard=development/Ruleset.xml $check; echo "*** PHPLint Quickcheck - $check ***"; php -l $check; done
1 change: 1 addition & 0 deletions scope.txt → development/scope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ addons
admincenter
articles
awards
bbcode
bannerrotation
buddies
buildtools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,18 @@

header("Content-Type: text/plain; charset=utf-8");

define('BOM', "\xEF\xBB\xBF");
include("translation_config.php");

$baseLanguage = "../languages/uk";
$baseLanguageCode = basename($baseLanguage);
$checkUntranslated = true;

$all_langs = glob("../languages/*", GLOB_ONLYDIR);
if (in_array($baseLanguage, $all_langs)) {
unset($all_langs[ array_search($baseLanguage, $all_langs) ]);
$all_langs = glob($languageBaseFolder."*", GLOB_ONLYDIR);
if (in_array($baseLanguageFolder, $all_langs)) {
unset($all_langs[ array_search($baseLanguageFolder, $all_langs) ]);
}

$ref_keys = array();
$erros = array();
$all_langs = array_merge(array($baseLanguage), $all_langs);

function checkBom($file)
{
return (false !== strpos($file, BOM));
}

define("PAGETITLE", "'.PAGETITLE.'");
$all_langs = array_merge(array($baseLanguageFolder), $all_langs);

echo "Base Language: ".$baseLanguageCode."\n";

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
117 changes: 117 additions & 0 deletions development/tools/find_lang_dup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php
/**
* Created by PhpStorm.
* User: derchris
* Date: 15/03/15
* Time: 10:51
*/

include("translation_config.php");

$allLangFiles = glob($baseLanguageFolder."/*");
$all_keys = array();

foreach($allLangFiles as $file){
ob_start();
include($file);
$content = ob_get_contents();
$outputted_content = ob_get_length();
ob_clean();

foreach($language_array as $key => $value){
if(isset($all_keys[$key])){
$found = false;
foreach($all_keys[$key] as $i => $c_v){
$i_counter = $c_v[0];
$i_value = $c_v[1];
if($value == $i_value){
$i_counter++;
$all_keys[$key][$i] = array($i_counter, $i_value);
$found = true;
break;
}
}
if($found == false){
$all_keys[$key][] = array(1, $value);
}
}
else{
$all_keys[$key] = array();
$all_keys[$key][] = array(1, $value);
}
}
}

$errors = array();

foreach($all_keys as $key => $usages){
if(count($usages) > 1){
$errors['multiple_different_usages'][] = $key . "- count ".count($usages)." - ". implode(", ",array_map(function($e){return $e[1];}, $usages));
}
else{
if($usages[0][0] > 1){
$errors['multiple_definitionss'][] = $key . " - ". $usages[0][0];
}
}
}
sort($errors['multiple_different_usages']);
sort($errors['multiple_definitionss']);
print_r($errors);

/*
$lang_site = array('al', 'ba', 'bg', 'cz', 'de', 'dk', 'ee', 'es', 'fi', 'fr', 'ge', 'gr', 'hr', 'hu', 'ir', 'it', 'lt',
'lu', 'lv', 'mk', 'nl', 'no', 'pl', 'pt', 'ro', 'rs', 'ru', 'sa', 'se', 'si', 'sk', 'tr', 'ua', 'uk', 'za');
$lang_admin = array('de', 'hu', 'it', 'uk');
$ref_keys_site = array();
$ref_keys_admin = array();
$duplicate_keys_site = array();
$duplicate_keys_admin = array();
define('PAGETITLE', "PAGETITLE");
foreach ($lang_site as $lang) {
echo "Checking Site Language: " . $lang . " ... ", PHP_EOL;
$files = glob('../../languages/' . $lang . '/*');
foreach ($files as $file) {
$file_name = basename($file);
$ext = substr($file_name, strrpos($file_name, "."));
if ($ext == ".php") {
include_once$file;
foreach ($language_array as $key => $value) {
$dup = array_search($key, $ref_keys_site[$file_name]);
if ($key != $dup) {
$duplicate_keys_site[$key] = $dup;
}
}
}
}
}
foreach ($lang_admin as $lang) {
echo "Checking Admin Language: " . $lang . " ... ", PHP_EOL;
$files = glob('../../admin/languages/' . $lang . '/*');
foreach ($files as $file) {
$file_name = basename($file);
$ext = substr($file_name, strrpos($file_name, "."));
if ($ext == ".php") {
include_once$file;
$ref_keys_admin[$file_name] = $language_array;
}
}
foreach ($ref_keys_admin[$file_name] as $key => $value) {
$dup = array_search($key, $ref_keys_admin[$file_name]);
if ($key != $dup) {
$duplicate_keys_admin[$key] = $dup;
}
}
#while($element = current($duplicate_keys_admin)) {
# $all_keys_admin .= key($duplicate_keys_admin);
# next($duplicate_keys_admin);
#}
#print_r($duplicate_keys_admin);
}
echo "", PHP_EOL;
echo "Duplicate Language Keys in Site: " . implode(", ",array_keys($duplicate_keys_site)), PHP_EOL;
echo "Duplicate Language Keys in Admincenter: " . implode(", ",array_keys($duplicate_keys_admin)), PHP_EOL;
*/
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'/(?<intend>[ \t]*)eval\s*\("' . preg_quote('\$', "/") . '(?<variable>[\w_]+?)\s*=\s*' . preg_quote('\"', "/") .
'"\s*.\s*gettemplate\(["\'](?<parameters>[\w_,\'" ]+?)["\']\)\s*.\s*"' . preg_quote('\"', "/") . ';"\);/si';

$folders = array('../', '../admin/', '../src/', '../src/func/');
$folders = array('../../', '../../admin/', '../../src/', '../../src/func/');
$count = 0;

function extractVariablesFromTemplate($file)
Expand All @@ -27,7 +27,7 @@ function generateNewTemplateClass($variable, $options, $intend)
$calledfrom = "root";
}

$variables_used = extractVariablesFromTemplate('../templates/' . $template_file . "." . $extension);
$variables_used = extractVariablesFromTemplate('../../templates/' . $template_file . "." . $extension);
$replace_code = '';
$unique_list = array();
if (count($variables_used)) {
Expand Down
File renamed without changes.
Loading

0 comments on commit 3fade5c

Please sign in to comment.