Skip to content

Commit

Permalink
Add tools scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Walid authored and trasher committed Feb 8, 2017
1 parent cbcb402 commit e87eb64
Show file tree
Hide file tree
Showing 7 changed files with 907 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
dist/
vendor/
.gh_token
*.min.*

64 changes: 64 additions & 0 deletions .travis.yml
@@ -0,0 +1,64 @@
language: php

env:
- DB=mysql

before_script:
- composer self-update
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.4" ]]; then sed -e "s|.*"consolidation/robo".*$||" -i composer.json && composer update; fi
- composer install -o
# - mysql -u root -e 'create database glpitest;'
# - php tools/cliinstall.php --lang=en_US --db=glpitest --user=root --tests

script:
# - mysql -u root -e 'select version();'
# - phpunit --verbose
- vendor/bin/phpcs -p --ignore=vendor --ignore=js --standard=vendor/glpi-project/coding-standard/GlpiStandard/ .

matrix:
include:
- php: 5.4
addons:
mariadb: 5.5
- php: 5.5
addons:
mariadb: 5.5
# - php: 5.6
# addons:
# mariadb: 5.5
# - php: 5.6
# addons:
# mariadb: 10.0
- php: 5.6
addons:
mariadb: 10.1
# - php: 7.0
# addons:
# mariadb: 10.0
- php: 7.0
addons:
mariadb: 10.1
# - php: 7.1
# addons:
# mariadb: 10.0
- php: 7.1
addons:
mariadb: 10.1
- php: nightly
addons:
mariadb: 10.1
allow_failures:
- php: nightly

cache:
directories:
- $HOME/.composer/cache

#notifications:
# irc:
# channels:
# - "irc.freenode.org#channel"
# on_success: change
# on_failure: always
# use_notice: true
# skip_join: true
8 changes: 8 additions & 0 deletions composer.json
@@ -0,0 +1,8 @@
{
"require-dev": {
"consolidation/robo": "dev-master@dev",
"patchwork/jsqueeze": "~1.0",
"natxet/CssMin": "~3.0",
"glpi-project/coding-standard": "0.5"
}
}
26 changes: 26 additions & 0 deletions tools/HEADER
@@ -0,0 +1,26 @@
* @version $Id: HEADER 14684 2011-06-11 06:32:40Z remi $
LICENSE

This file is part of the datainjection plugin.

Datainjection plugin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Datainjection plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with datainjection. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
@package datainjection
@author the datainjection plugin team
@copyright Copyright (c) 2009-2017 Datainjection plugin team
@license GPLv2+
http://www.gnu.org/licenses/gpl.txt
@link https://github.com/pluginsGLPI/datainjection
@link http://www.glpi-project.org/
@since 2009
102 changes: 102 additions & 0 deletions tools/modify_headers.pl
@@ -0,0 +1,102 @@
#!/usr/bin/perl
#!/usr/bin/perl -w

# ----------------------------------------------------------------------
# GLPI - Gestionnaire Libre de Parc Informatique
# Copyright (C) 2003-2006 by the INDEPNET Development Team.
#
# http://indepnet.net/ http://glpi-project.org
# ----------------------------------------------------------------------
#
# LICENSE
#
# This file is part of GLPI.
#
# GLPI is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GLPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GLPI; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# ------------------------------------------------------------------------


do_dir("..");


sub do_dir{
local ($dir)=@_;
print "Entering $dir\n";

opendir(DIRHANDLE,$dir)||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if (-d "$dir/$_"){
if ($_ !~ m/.svn/i && $_ !~ m/CVS/i && $_ !~ m/lib/i){

do_dir("$dir/$_");
}
} else {
if(!(-l "$dir/$_")){
if ((index($_,".php",0)!=-1)||(index($_,".txt",0)!=-1)||(index($_,".css",0)!=-1)){
do_file("$dir/$_");
}
}
}
}
}
closedir DIRHANDLE;

}

sub do_file{
local ($file)=@_;
print $file."\n";
### DELETE HEADERS
open(INIT_FILE,$file);
@lines=<INIT_FILE>;
close(INIT_FILE);

open(TMP_FILE,">/tmp/tmp_glpi.txt");

$status='';
foreach (@lines){
if ($_ =~ m/\*\//){
$status="END";
}

if ($status =~ m/END/||$status !~ m/BEGIN/){
print TMP_FILE $_;
}

if ($status !~ m/END/){
if ($_ =~ m/\/\*/){
$status="BEGIN";
##### ADD NEW HEADERS
open(HEADER_FILE,"HEADER");
@headers=<HEADER_FILE>;
foreach (@headers){
print TMP_FILE $_;
}
close(HEADER_FILE) ;

}
}
}
close(TMP_FILE);

system("cp -f /tmp/tmp_glpi.txt $file");



}



22 changes: 22 additions & 0 deletions tools/phpcs-rules.xml
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruleset name="glpi">
<!-- white spaces at end of line or empty line have spaces -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />

<!-- else if instead of elseif -->
<rule ref="Squiz.ControlStructures.ElseIfDeclaration" />

<!-- No tab in indent -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />

<!-- Indent 3 -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="3"/>
</properties>
</rule>

<!-- Remove closingTag -->
<rule ref="Zend.Files.ClosingTag" />

</ruleset>

0 comments on commit e87eb64

Please sign in to comment.