incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject webworks commit: Added helper script to auto add webworks.js reference to html pages
Date Sat, 06 Oct 2012 00:45:50 GMT
Updated Branches:
  refs/heads/master 446207993 -> 4a8f60dc4


Added helper script to auto add webworks.js reference to html pages


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/4a8f60dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/4a8f60dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/4a8f60dc

Branch: refs/heads/master
Commit: 4a8f60dc46e4c234e4cf403fbea4cf1793413d92
Parents: 4462079
Author: Tim Kim <tim.kim@nitobi.com>
Authored: Fri Oct 5 17:45:43 2012 -0700
Committer: Tim Kim <tim.kim@nitobi.com>
Committed: Fri Oct 5 17:45:43 2012 -0700

----------------------------------------------------------------------
 bin/templates/project/cordova/addWebworks |   47 ++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/4a8f60dc/bin/templates/project/cordova/addWebworks
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/addWebworks b/bin/templates/project/cordova/addWebworks
new file mode 100755
index 0000000..f81b897
--- /dev/null
+++ b/bin/templates/project/cordova/addWebworks
@@ -0,0 +1,47 @@
+#! /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.
+
+ANT=$(which ant)
+
+if [ "$1" == "-h" -o "$1" == "-help" ]
+then
+  echo 'usage: addWebworks'
+  echo 'Automatically adds the webworks.js reference to all of your html files in the www/
folder'
+  echo 'Only relevant to qnx'
+  exit 0
+fi
+
+if [ ! -e "www/js/webworks.js" ]
+then
+    echo 'www/js/webworks.js file not found - need to build project'
+    $ANT qnx build
+fi
+
+find www -name \*.html\* | while read fullpath
+do
+    # i hate regex
+    jspath=$( dirname "$fullpath" ) ; jspath=${jspath#./www} ; jspath=${jspath//\/[a-zA-Z0-9]/../}
; jspath=${jspath//[a-zA-Z0-9]/}
+    sed -i "" '/<head>/ a\
+    <script type="text/javascript" src="'$jspath'js/webworks.js"></script>' $fullpath
   
+done
+
+#find . -name \*.html\* -print0 | xargs -0 -I file sed -i "" '/<head>/ a\
+#<script type="text/javascript" src="/www/js/webworks.js">' file
+
+echo 'added webworks reference to these files: '
+find www -name \*.html\* | xargs -0 echo


Mime
View raw message