Skip to content
Snippets Groups Projects
Commit edf19b92 authored by Olivier Maury's avatar Olivier Maury
Browse files

Mise à jour de tokei. refs #15

parent 362714d0
No related branches found
Tags 2.4.4
1 merge request!30Resolve "Configurer l'intégration continue"
Pipeline #159654 failed
#!/bin/bash
ROOT_DIR=$(dirname $(dirname $0))
TOKEI2CLOC=$(dirname $0)/tokei2cloc.py
TOKEITGZ=tokei-v7.0.3-x86_64-unknown-linux-gnu.tar.gz
if [ ! -f bin/tokei ]; then
mkdir -p ~/tmp bin
if [ ! -f ~/tmp/$TOKEITGZ ]; then
wget "https://github.com/Aaronepower/tokei/releases/download/v7.0.3/$TOKEITGZ" -O ~/tmp/$TOKEITGZ
TOKEI=$(command -v tokei)
if [ ! -x "$TOKEI" ]; then
TOKEITGZ=tokei-x86_64-unknown-linux-gnu.tar.gz
if [ ! -f bin/tokei ]; then
mkdir -p ~/tmp
if [ ! -f ~/tmp/$TOKEITGZ ]; then
wget "https://github.com/Aaronepower/tokei/releases/download/v12.1.2/$TOKEITGZ" -O ~/tmp/$TOKEITGZ
fi
tar zxf ~/tmp/$TOKEITGZ -C bin
fi
tar zxf ~/tmp/$TOKEITGZ -C bin
TOKEI=bin/tokei
fi
if [ -f bin/tokei ]; then
mkdir -p target
bin/tokei -f -o json src | $TOKEI2CLOC > target/cloc.xml
exit
if [ ! -f $TOKEI ]; then
echo "Strange, $TOKEI does not exist!"
exit 1
fi
SLOCCOUNT=$(which sloccount);
if [ "$SLOCCOUNT" != "" ]; then
DATADIR=$(dirname $0)/.slocdata;
if [ ! -f $DATADIR ]; then
mkdir -p $DATADIR;
fi
mkdir -p target ;
/usr/bin/sloccount --datadir $DATADIR --duplicates --wide --details src > target/sloccount.sc;
else
echo "sloccount not found!";
fi
echo "tokei is installed at $TOKEI"
$TOKEI --version
mkdir -p $ROOT_DIR/target
$TOKEI -f -o json $ROOT_DIR/sava-core/src $ROOT_DIR/sava-core-jakarta/src $ROOT_DIR/sava-example/src | $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# data.pheno.fr - Phenological data portal of TEMPO
# Copyright © 2019 TEMPO (contact-tempo@inrae.fr)
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
# $Id: tokei2cloc.py 77 2019-01-11 17:24:18Z omaury $
# $Id$
#
# Author : Olivier Maury
# Creation Date : 2019-01-15 10:30:29 +0200
# Last Revision : $Date: 2019-01-11 18:24:18 +0100 (ven., 11 janv. 2019) $
# Revision : $Rev: 77 $
# Last Revision : $Date$
# Revision : $Rev$
u"""
NOM
%prog - Tokei2Cloc
......@@ -38,10 +21,10 @@ u"""
Olivier Maury
VERSION
$Date: 2019-01-11 18:24:18 +0100 (ven., 11 janv. 2019) $
$Date$
"""
__revision__ = "$Rev: 77 $"
__revision__ = "$Rev$"
__author__ = "Olivier Maury"
import json
import sys
......@@ -52,8 +35,10 @@ results = json.loads(sys.stdin.read())
nb_files = 0
nb_lines = 0
for lang in results:
nb_files += len(results[lang]['stats'])
nb_lines += int(results[lang]['lines'])
nb_files += len(results[lang]['reports'])
nb_lines += int(results[lang]['blanks'])
nb_lines += int(results[lang]['code'])
nb_lines += int(results[lang]['comments'])
print("""<?xml version="1.0"?><results>
<header>
......@@ -73,11 +58,11 @@ total_blank = 0
total_comment = 0
total_code = 0
for lang in results:
for result in results[lang]['stats']:
blank = int(result['blanks'])
comment = int(result['comments'])
code = int(result['code'])
print(""" <file name="%s" blank="%d" comment="%d" code="%d" language="%s" />""" %
for result in results[lang]['reports']:
blank = int(result['stats']['blanks'])
comment = int(result['stats']['comments'])
code = int(result['stats']['code'])
print(""" <file name="%s" blank="%d" comment="%d" code="%d" language="%s" />""" %
(result['name'], blank, comment, code, lang))
total_blank += blank
total_comment += comment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment