You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2015/05/31 23:59:46 UTC

ambari git commit: AMBARI-11564: Ambari Admin View version is hardcoded in view.xml (jluniya)

Repository: ambari
Updated Branches:
  refs/heads/trunk 23604e3a1 -> 3ac16966d


AMBARI-11564: Ambari Admin View version is hardcoded in view.xml (jluniya)


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

Branch: refs/heads/trunk
Commit: 3ac16966d577f8d956ef3b1189fb4d97a55e3f79
Parents: 23604e3
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Sun May 31 14:59:39 2015 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Sun May 31 14:59:39 2015 -0700

----------------------------------------------------------------------
 ambari-admin/pom.xml                | 62 +++++++++++++++++++++-----------
 ambari-admin/set-ambari-version.cmd | 17 +++++++++
 ambari-admin/set-ambari-version.ps1 | 26 ++++++++++++++
 ambari-admin/set-ambari-version.sh  | 26 ++++++++++++++
 4 files changed, 110 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3ac16966/ambari-admin/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-admin/pom.xml b/ambari-admin/pom.xml
index 5fa3561..2d3ad25 100644
--- a/ambari-admin/pom.xml
+++ b/ambari-admin/pom.xml
@@ -122,6 +122,19 @@
               </arguments>
             </configuration>
           </execution>
+          <execution>
+            <id>set-ambari-version</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <!-- sets Ambari version to make it accessible from code -->
+              <executable>${executable.shell}</executable>
+              <workingDirectory>${basedir}</workingDirectory>
+              <commandlineArgs>${args.shell} ${basedir}${dirsep}set-ambari-version.${fileextension.shell} ${ambariVersion}</commandlineArgs>
+            </configuration>
+          </execution>
           <!--  @TODO: uncomment below execution for triggering ambar-admin UI unit tests from maven test phase.(AMBARI-7600)
           <execution>
             <id>unit test</id>
@@ -207,7 +220,6 @@
         <filtering>false</filtering>
         <includes>
           <include>META-INF/**/*</include>
-          <include>view.xml</include>
         </includes>
       </resource>
       <resource>
@@ -218,28 +230,36 @@
   </build>
     <profiles>
     <profile>
-        <id>windows</id>
-        <activation>
-            <os>
-                <family>win</family>
-            </os>
-        </activation>
-        <properties>
-            <envClassifier>win</envClassifier>
-            <executable.node>node.exe</executable.node>
-        </properties>
+      <id>windows</id>
+      <activation>
+        <os>
+          <family>win</family>
+        </os>
+      </activation>
+      <properties>
+        <envClassifier>win</envClassifier>
+        <executable.node>node.exe</executable.node>
+        <dirsep>\</dirsep>
+        <executable.shell>cmd</executable.shell>
+        <fileextension.shell>cmd</fileextension.shell>
+        <args.shell>/C</args.shell>
+      </properties>
     </profile>
     <profile>
-        <id>linux</id>
-        <activation>
-            <os>
-                <family>unix</family>
-            </os>
-        </activation>
-        <properties>
-            <envClassifier>linux</envClassifier>
-            <executable.node>node</executable.node>
-        </properties>
+      <id>linux</id>
+      <activation>
+        <os>
+          <family>unix</family>
+        </os>
+      </activation>
+      <properties>
+        <envClassifier>linux</envClassifier>
+        <executable.node>node</executable.node>
+        <dirsep>/</dirsep>
+        <executable.shell>sh</executable.shell>
+        <fileextension.shell>sh</fileextension.shell>
+        <args.shell></args.shell>
+      </properties>
     </profile>
   </profiles>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ac16966/ambari-admin/set-ambari-version.cmd
----------------------------------------------------------------------
diff --git a/ambari-admin/set-ambari-version.cmd b/ambari-admin/set-ambari-version.cmd
new file mode 100644
index 0000000..14fdec6
--- /dev/null
+++ b/ambari-admin/set-ambari-version.cmd
@@ -0,0 +1,17 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  You may obtain a copy of the License at
+rem
+rem     http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+powershell -File set-ambari-version.ps1 %*
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ac16966/ambari-admin/set-ambari-version.ps1
----------------------------------------------------------------------
diff --git a/ambari-admin/set-ambari-version.ps1 b/ambari-admin/set-ambari-version.ps1
new file mode 100644
index 0000000..bb2b9d3
--- /dev/null
+++ b/ambari-admin/set-ambari-version.ps1
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+$newVersion = $($args[0])
+
+if ($newVersion -ne '${ambariVersion}')
+{
+  "Setting Ambari version to $newVersion"
+  Get-Content src/main/resources/view.xml -ReadCount 1000 | %{$_ -replace "<version>.*</version>","<version>$newVersion</version>"} | Set-Content target/classes/view.xml
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ac16966/ambari-admin/set-ambari-version.sh
----------------------------------------------------------------------
diff --git a/ambari-admin/set-ambari-version.sh b/ambari-admin/set-ambari-version.sh
new file mode 100644
index 0000000..68806d1
--- /dev/null
+++ b/ambari-admin/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" != '${ambariVersion}' ]
+then
+  echo "Setting Ambari version to $1"
+  sed "s/<version>.*<\/version>/<version>$1<\/version>/" src/main/resources/view.xml > target/classes/view.xml;
+fi
+