X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=tools%2Fmise_en_prod.rb;h=d95156cfdd786699ae0201239da025b8a2d0e7a1;hp=356e2f6a70a81cdd299612e79ff3d5de9960a6e0;hb=18e8fadf5aad8d7b2e7b750210dc949951b4a124;hpb=9b380274dcc75e06c0cdc110f91cc8f0c4738aeb diff --git a/tools/mise_en_prod.rb b/tools/mise_en_prod.rb index 356e2f6..d95156c 100755 --- a/tools/mise_en_prod.rb +++ b/tools/mise_en_prod.rb @@ -18,16 +18,14 @@ You should have received a copy of the GNU General Public License along with Euphorik. If not, see . =end - - -### MAKE -Dir.chdir('../modules') -puts `make` - -### COPIE -$rep_remote = '/tmp/euphorik' #'/var/www/euphorik' -$host = 'localhost' #"gburri@euphorik.ch:#{rep_remote}" -$opt_rsync = '' +$rep_remote = '/var/www/euphorik' +$host = 'euphorik.ch' +$opt_rsync = '' + + +#TODO +# - mettre à jour les numéros de versions en appelant le script "cope_num_version.rb" +# - création de unit tests (voir eunit) et validation avant la mise en prod def creer_remote_rep(rep) begin @@ -36,12 +34,25 @@ def creer_remote_rep(rep) end end -creer_remote_rep('BD') +# Compilation de la partie serveur +Dir.chdir('../modules') +puts `make` +if $?.exitstatus != 0 + puts "Echec de compilation de la partie serveuse" + exit 1 +end Dir.chdir('..') -print `rsync #{$opt_rsync} index.html #{$host}:#{$rep_remote}` + +# création du repertoire BD +creer_remote_rep('BD') +`ssh #{$host} "chmod g+w #{$rep_remote}/BD"` + +# copie de la partie statique : css, images, html, etc.. +print `rsync #{$opt_rsync} index.yaws #{$host}:#{$rep_remote}` print `rsync #{$opt_rsync} favicon.ico #{$host}:#{$rep_remote}` print `rsync #{$opt_rsync} -r css #{$host}:#{$rep_remote}` +print `rsync #{$opt_rsync} -r pages #{$host}:#{$rep_remote}` print `rsync #{$opt_rsync} -r --exclude 'autres' img #{$host}:#{$rep_remote}` # copie des js avec minification @@ -54,6 +65,14 @@ Dir.entries(rep_js).each{|fichier| end } +# copie des modules erlang creer_remote_rep('modules') -`rsync #{$opt_rsync} -r modules/ebin #{$host}:#{$rep_remote}/modules` -`rsync #{$opt_rsync} -r pages #{$host}:#{$rep_remote}` +`rsync #{$opt_rsync} -r --exclude 'euphorik_test.beam' modules/ebin #{$host}:#{$rep_remote}/modules` +`rsync #{$opt_rsync} -r modules/include #{$host}:#{$rep_remote}/modules` + +# attribution des droits +`ssh #{$host} "chmod -R g+rx #{$rep_remote}"` + +# 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"`