Repository: ambari
Updated Branches:
  refs/heads/trunk 5a61840ba -> 45383d369


AMBARI-5121. Set Ambari version at build time so that it is available as 
App.version from Ambari Web code. (yusaku)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45383d36
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45383d36
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45383d36

Branch: refs/heads/trunk
Commit: 45383d3696a7f03ee4f700be96da983fed8c936d
Parents: 5a61840
Author: Yusaku Sako <[email protected]>
Authored: Mon Mar 17 18:00:19 2014 -0700
Committer: Yusaku Sako <[email protected]>
Committed: Mon Mar 17 18:10:43 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/config.js         |  1 +
 ambari-web/pom.xml               |  5 +++++
 ambari-web/set-ambari-version.sh | 26 ++++++++++++++++++++++++++
 3 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/45383d36/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 6422794..a6445eb 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -19,6 +19,7 @@
 
 var App = require('app');
 
+App.version = ''; // filled out by set-ambari-version.sh script
 App.testMode = (location.port == '3333'); // test mode is automatically 
enabled if running on brunch server
 App.testModeDelayForActions = 10000;
 App.skipBootstrap = false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/45383d36/ambari-web/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-web/pom.xml b/ambari-web/pom.xml
index c01d558..d6d2499 100644
--- a/ambari-web/pom.xml
+++ b/ambari-web/pom.xml
@@ -96,6 +96,11 @@
                 <exec dir="${basedir}" executable="brunch" failonerror="false">
                   <arg value="build"/>
                 </exec>
+                <!-- sets Ambari version to make it accessible from code -->
+                <exec dir="${basedir}" executable="sh" failonerror="false">
+                  <arg value="${basedir}/set-ambari-version.sh"/>
+                  <arg value="${newVersion}"/>
+                </exec>
                 <!-- sets default stack and version to use for install -->
                 <exec dir="${basedir}" executable="sh" failonerror="false">
                   <arg value="${basedir}/set-default-stack-version.sh"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/45383d36/ambari-web/set-ambari-version.sh
----------------------------------------------------------------------
diff --git a/ambari-web/set-ambari-version.sh b/ambari-web/set-ambari-version.sh
new file mode 100644
index 0000000..a661c48
--- /dev/null
+++ b/ambari-web/set-ambari-version.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+if [ "$1" != '${newVersion}' ]
+then
+  echo "Setting Ambari version to $1"
+  sed "s/App.version.*=.*;/App.version = '$1';/" public/javascripts/app.js > 
public/javascripts/tmp.js; mv public/javascripts/tmp.js 
public/javascripts/app.js
+fi
+

Reply via email to