From: Greg Burri Date: Thu, 31 Jul 2008 09:48:22 +0000 (+0000) Subject: Oops X-Git-Tag: 1.1.0~24 X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=commitdiff_plain;h=0f7afc675941bab91a2e74fd40caffea876591df Oops --- diff --git a/index.yaws b/index.yaws index 35180ba..9d31ae4 100755 --- a/index.yaws +++ b/index.yaws @@ -24,10 +24,10 @@ - - - - + + + + diff --git a/tools/tools.rb b/tools/tools.rb index 75d3602..46636b8 100644 --- a/tools/tools.rb +++ b/tools/tools.rb @@ -1,27 +1,59 @@ -#!/usr/bin/ruby -=begin -Copyright 2008 Grégory Burri - -This file is part of Euphorik. - -Euphorik 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. - -Euphorik 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 Euphorik. If not, see . -=end +#!/usr/bin/ruby +# coding: utf8 +=begin +Copyright 2008 Grégory Burri + +This file is part of Euphorik. + +Euphorik 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. + +Euphorik 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 Euphorik. If not, see . +=end #TODO : -# - mettre à jour les numéros de versions (créer une classe) -# - création de unit tests (voir eunit) et validation avant la mise en prod -# - faire une classe qui vérifie tous les js avec jslint +# - mettre à jour les numéros de versions (créer une classe) +# - création de unit tests (voir eunit) et validation avant la mise en prod +# - faire une classe qui vérifie tous les js avec jslint + +# Classe permettant la vérification du code JS pas jslint. +class VerifJS + + def initialize(dossier) + @dossier = dossier + end + + def verifier + verifierRecu(@dossier) + end + + def verifierRecu(dossier) + Dir.foreach(dossier){|fichier| + if fichier != '.' and fichier != '..' and File.directory?(fichier) and fichier != 'dirs' + if not verifierRecu(dossier + '/' + fichier) + return false + end + elsif fichier[-3, 3] == '.js' + puts "== Vérification de #{dossier}/#{fichier} ==" + system("java org.mozilla.javascript.tools.shell.Main jslint.js #{dossier}/#{fichier}") + if $?.exitstatus > 0 + return false + end + end + } + return true + end +end + + class MiseEnProd @@rep_remote = '/var/www/euphorik' @@ -49,7 +81,7 @@ class MiseEnProd end def creer_repertoire_bd - # création du repertoire BD + # création du repertoire BD creer_remote_rep('BD') creer_remote_rep('BD/backup') `ssh #{@@host} "chmod g+w #{@@rep_remote}/BD"` @@ -64,12 +96,6 @@ class MiseEnProd print `rsync #{$opt_rsync} -r --exclude 'autres' img #{$host}:#{$rep_remote}` end - # contrôle des fichiers js à l'aide de jslint - # @return false si une erreur est survenue durant la vérification - def check_js - - end - # minification et package des fichiers js dans euphorik.js def pack_js # copie des js avec minification @@ -96,8 +122,12 @@ class MiseEnProd end def maj - # execution du script de mise à jour + # execution du script de mise à jour print `cat tools/mise_en_prod.erl | ssh #{$host} "cat > /tmp/mise_en_prod.erl"` print `ssh #{$host} "chmod u+x /tmp/mise_en_prod.erl; /tmp/mise_en_prod.erl; rm /tmp/mise_en_prod.erl"` end -end +end + + +v = VerifJS.new("../js") +v.verifier() \ No newline at end of file