X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=tools%2Ftools.rb;h=ec0950e5be67e995a8744b05fbf3b1b1c35a3802;hp=2a5a1fef298c2cf9b6416cc1c291c15bbcb2cb3b;hb=7d65ab0a09411a21156bb521c85c77e785670463;hpb=c219198926b679ef5bc28182b3d05e8c1f447886 diff --git a/tools/tools.rb b/tools/tools.rb index 2a5a1fe..ec0950e 100644 --- a/tools/tools.rb +++ b/tools/tools.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -# coding: utf8 +# coding: utf-8 =begin Copyright 2008 Grégory Burri @@ -52,6 +52,33 @@ class VerifJS } return true end +end + +# Classe de gestion de la version +class Version + # @param dossier la racine du site (par exemple "/var/www/euphorik" + def initialize(dossier) + @dossier = dossier + File.open(@dossier + '/VERSION') {|file| + @version = file.readline() + } + # les fichiers HTML dans lesquels mettre à jour la version + @fichiers = ['/pages/about.html'] + @balise = /().*?(<\/span>)/ + end + + # met à jour la version dans les fichiers @fichiers + def maj + @fichiers.each{|fichier| + fichier = @dossier + fichier + lines = IO.readlines(fichier) + File.open(fichier, 'w') {|io| + lines.each{|l| + io.write(l.sub(@balise){|m| $1 + @version + $2}) + } + } + } + end end @@ -130,5 +157,8 @@ class MiseEnProd end -v = VerifJS.new("../js") -v.verifier() \ No newline at end of file +#verifJS = VerifJS.new("../js") +#verifJS.verifier() + +#version = Version.new("..") +#version.maj()