X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fmise_en_prod.rb;h=09cd568fd55c0137bcabda8e51ab1009a3459ed9;hb=64ef87442b933d47f4dbc9dfec9a5a16e522c375;hp=fa2923f0ae4737787c49e2d041a0ebc311f03c33;hpb=d7816465f9cd53b0f0f011febe063e78bffe3f9e;p=euphorik.git
diff --git a/tools/mise_en_prod.rb b/tools/mise_en_prod.rb
index fa2923f..09cd568 100755
--- a/tools/mise_en_prod.rb
+++ b/tools/mise_en_prod.rb
@@ -1,45 +1,61 @@
-#!/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
-
-
-def copy_files(dest, opt)
- `rsync #{opt} index.html #{dest}`
- `rsync #{opt} -r css #{dest}`
- `rsync #{opt} -r img #{dest}`
- #`rsync #{opt} -r js #{dest}`
- `rsync #{opt} -r lightbox #{dest}`
- `rsync #{opt} -r modules/include #{dest}/modules`
- `rsync #{opt} -r modules/ebin #{dest}/modules`
- `rsync #{opt} -r pages #{dest}`
-
- # copie des js avec minification
-
-end
+#!/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
+
+
-if __FILE__ == $0
- # la destination
- $dest = 'gburri@euphorik.ch:/var/www/euphorik'
- $dest = $*[0] if $*.length > 1
+### MAKE
+Dir.chdir('../modules')
+puts `make`
- # les options communes
- $opt = ''
-
- copy_files($dest, $opt)
+### COPIE
+$rep_remote = '/var/www/euphorik'
+$host = 'euphorik.ch'
+$opt_rsync = ''
+
+def creer_remote_rep(rep)
+ begin
+ `ssh #{$host} "mkdir #{$rep_remote}/#{rep}"`
+ rescue
+ end
end
+
+creer_remote_rep('BD')
+
+Dir.chdir('..')
+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 --exclude 'autres' img #{$host}:#{$rep_remote}`
+
+# copie des js avec minification
+rep_js = 'js'
+creer_remote_rep(rep_js)
+Dir.entries(rep_js).each{|fichier|
+ if fichier[0..0] != "." and fichier != "debug.js"
+ puts "Minimisation et copie de #{fichier}"
+ print `tools/jsmin.rb < #{rep_js}/#{fichier} | ssh #{$host} "cat > #{$rep_remote}/#{rep_js}/#{fichier}"`
+ end
+}
+
+creer_remote_rep('modules')
+`rsync #{$opt_rsync} -r modules/ebin #{$host}:#{$rep_remote}/modules`
+`rsync #{$opt_rsync} -r pages #{$host}:#{$rep_remote}`
+
+