2a5a1fef298c2cf9b6416cc1c291c15bbcb2cb3b
4 Copyright 2008 Grégory Burri
6 This file is part of Euphorik.
8 Euphorik is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 Euphorik is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
23 # - mettre à jour les numéros de versions (créer une classe)
24 # - création de unit tests (voir eunit) et validation avant la mise en prod
25 # - faire une classe qui vérifie tous les js avec jslint
27 # Classe permettant la vérification du code JS pas jslint.
28 # Passe en revu chaque fichier js de manière récursive à partir d'un dossier de départ.s
31 def initialize(dossier
)
36 verifierRecu(@dossier)
39 def verifierRecu(dossier
)
40 Dir
.foreach(dossier
){|fichier
|
41 if fichier !
= '.' and fichier !
= '..' and File
.directory
?(fichier
) and fichier !
= 'dirs'
42 if not verifierRecu(dossier +
'/' + fichier
)
45 elsif fichier
[-3, 3] == '.js'
46 puts
"== Vérification de #{dossier}/#{fichier} =="
47 system("java org.mozilla.javascript.tools.shell.Main jslint.js #{dossier}/#{fichier}")
60 @
@rep_remote = '/var/www/euphorik'
61 @
@host = 'euphorik.ch'
67 def creer_remote_rep(rep
)
69 `ssh #{@@host} "mkdir #{@@rep_remote}/#{rep}"`
74 def compiler_partie_serveuse
75 Dir
.chdir(@
@rep_remote +
'/modules')
78 puts
"Echec de compilation de la partie serveuse"
84 def creer_repertoire_bd
85 # création du repertoire BD
86 creer_remote_rep('BD')
87 creer_remote_rep('BD/backup')
88 `ssh #{@@host} "chmod g+w
#{@@rep_remote}/BD
"`
91 # css, images, html, etc..
92 def copier_partie_statique
93 print `rsync #{$opt_rsync} index.yaws #{$host}:#{$rep_remote}`
94 print `rsync #{$opt_rsync} favicon.ico #{$host}:#{$rep_remote}`
95 print `rsync #{$opt_rsync} -r css #{$host}:#{$rep_remote}`
96 print `rsync #{$opt_rsync} -r pages #{$host}:#{$rep_remote}`
97 print `rsync #{$opt_rsync} -r --exclude 'autres' img #{$host}:#{$rep_remote}`
100 # minification et package des fichiers js dans euphorik.js
102 # copie des js avec minification
104 creer_remote_rep(rep_js)
105 Dir.entries(rep_js).each{|fichier|
106 if fichier[0..0] != '.' and fichier !
= 'debug.js'
107 puts
"Minimisation et copie de #{fichier}"
108 print
`tools/jsmin.rb < #{rep_js}/#{fichier} | ssh #{@@host} "cat > #{@@rep_remote}/#{rep_js}/#{fichier}"`
113 def copie_modules_serveurs
114 # copie des modules erlang
115 creer_remote_rep('modules')
116 `rsync #{@@opt_rsync} -r --exclude 'euphorik_test.beam' modules/ebin #{@@host}:#{@@rep_remote}/modules`
117 `rsync #{@@opt_rsync} -r modules/include #{@@host}:#{@@rep_remote}/modules`
120 def set_droits_fichiers
121 # attribution des droits
122 `ssh #{$host} "chmod -R g+rx
#{$rep_remote}"`
126 # execution du script de mise à jour
127 print `cat tools/mise_en_prod.erl | ssh #{$host} "cat
> /tmp
/mise_en_prod
.erl
"`
128 print `ssh #{$host} "chmod u+x
/tmp/mise_en_prod
.erl
; /tmp/mise_en_prod
.erl
; rm
/tmp/mise_en_prod
.erl
"`
133 v = VerifJS.new("../js
")