Add version information
authorymh <ymh.work@gmail.com>
Tue, 04 May 2010 18:03:35 +0200
changeset 119 a473319ea990
parent 118 aad3c6a520ca
child 120 1d93862d6071
Add version information
build/sbin/sync_mosatags
engine/sonyengine/mosatags.sonyengine.war
web/thdProject/apps/frontend/modules/partials/templates/_footer.php
web/thdProject/config/config_handlers.yml
web/thdProject/config/version.yml.tmpl
web/thdProject/web/backend.php
web/thdProject/web/backend_dev.php
web/thdProject/web/frontend_dev.php
web/thdProject/web/index.php
--- a/build/sbin/sync_mosatags	Tue May 04 13:16:10 2010 +0200
+++ b/build/sbin/sync_mosatags	Tue May 04 18:03:35 2010 +0200
@@ -88,6 +88,21 @@
     echo "checkout done";
 }
 
+set_version() {
+    echo "==============="
+    version_file_tmpl=$export_path_web/config/version.yml.tmpl
+    version_file=$export_path_web/config/version.yml
+    if [ "$version" == "tip" ]; then
+        version_str= `hg sum | head -n 1 | tr -s " "| cut -f 2 -d" "`
+    else
+        pushd "$clone_path"
+        version_str=$version
+        popd
+    fi
+    echo "set version $version_str in $version_file"
+    sed "s/__VERSION__/$version_str/" $version_file_tmpl > $version_file  
+}
+
 cleanup() {
     echo "===============";
     echo "cleanup";
@@ -100,7 +115,6 @@
 
 sync_web() {
     echo "===============";
-    export_path_web="$export_path"/web/thdProject/;
     server_ip_name=$server"_web_server";
     server_ip=${!server_ip_name};
     sync_user_name=${server}_sync_user;
@@ -116,11 +130,12 @@
         fi
         php symfony freeze data/;
         popd;
-        echo rsync -Cvrlz --delete --filter=". -" "$export_path_web" $sync_user@$server_ip:$web_location
+        echo rsync -Ccvrlz --stats --delete --filter=". -" "$export_path_web" $sync_user@$server_ip:$web_location
         cat <<EOT | rsync -Cvrlz --delete --filter=". -" "$export_path_web" $sync_user@$server_ip:$web_location
 + core
 - .hg
 - .hg/***
+- config/version.yml.tmpl
 P .htpasswd
 P .htaccess
 P plugins/iriSonyenginePlugin/config/sonyengine.yml
@@ -189,7 +204,7 @@
     -t)
       sync_type=$2;
       # check sync type value
-      if [[ "$sync_type" == @(web|engine|all) ]]; then
+      if [[ "$sync_type" == @(web|engine|all|none) ]]; then
         shift 2
       else
         echo "sync type given : $sync_type, must be one of web|engine|all"
@@ -310,6 +325,7 @@
 else
     export_path="$clone_path"
 fi
+export_path_web="$export_path"/web/thdProject/
 
 disp_env
 if $debug; then
@@ -317,9 +333,13 @@
 fi
 
 checkout_sources
+set_version
 
 case "$sync_type" in
     
+    "none")
+    ;;
+    
     "web")
     sync_web
     ;;
Binary file engine/sonyengine/mosatags.sonyengine.war has changed
--- a/web/thdProject/apps/frontend/modules/partials/templates/_footer.php	Tue May 04 13:16:10 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/partials/templates/_footer.php	Tue May 04 18:03:35 2010 +0200
@@ -1,1 +1,1 @@
-UniversCiné 2009  <span style="color:#666666;">V1.0</span>
\ No newline at end of file
+UniversCiné 2009  <span style="color:#666666;"><?php echo sfConfig::get('version_version'); ?></span>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/config/config_handlers.yml	Tue May 04 18:03:35 2010 +0200
@@ -0,0 +1,4 @@
+config/version.yml:
+  class:    sfDefineEnvironmentConfigHandler
+  param:
+    prefix: version_
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/config/version.yml.tmpl	Tue May 04 18:03:35 2010 +0200
@@ -0,0 +1,2 @@
+all:
+  version: __VERSION__
\ No newline at end of file
--- a/web/thdProject/web/backend.php	Tue May 04 13:16:10 2010 +0200
+++ b/web/thdProject/web/backend.php	Tue May 04 18:03:35 2010 +0200
@@ -4,4 +4,11 @@
 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
 
 $configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'prod', false);
+$configCache = new sfConfigCache($configuration);
+try {
+  include($configCache->checkConfig('config/version.yml'));
+}
+catch(Exception $e) {
+  //do nothing
+}
 sfContext::createInstance($configuration)->dispatch();
--- a/web/thdProject/web/backend_dev.php	Tue May 04 13:16:10 2010 +0200
+++ b/web/thdProject/web/backend_dev.php	Tue May 04 18:03:35 2010 +0200
@@ -10,4 +10,11 @@
 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
 
 $configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'dev', true);
+$configCache = new sfConfigCache($configuration);
+try {
+  include($configCache->checkConfig('config/version.yml'));
+}
+catch(Exception $e) {
+  //do nothing
+}
 sfContext::createInstance($configuration)->dispatch();
--- a/web/thdProject/web/frontend_dev.php	Tue May 04 13:16:10 2010 +0200
+++ b/web/thdProject/web/frontend_dev.php	Tue May 04 18:03:35 2010 +0200
@@ -10,4 +10,11 @@
 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
 
 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
+$configCache = new sfConfigCache($configuration);
+try {
+  include($configCache->checkConfig('config/version.yml'));
+}
+catch(Exception $e) {
+	//do nothing
+}
 sfContext::createInstance($configuration)->dispatch();
--- a/web/thdProject/web/index.php	Tue May 04 13:16:10 2010 +0200
+++ b/web/thdProject/web/index.php	Tue May 04 18:03:35 2010 +0200
@@ -4,6 +4,11 @@
 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
 
 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
+$configCache = new sfConfigCache($configuration);
+try {
+  include($configCache->checkConfig('config/version.yml'));
+}
+catch(Exception $e) {
+  //do nothing
+}
 sfContext::createInstance($configuration)->dispatch();
-
-?>