You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/03/07 15:51:14 UTC
[2/5] git commit: Move config.xml out of www/ and enhance
createproject.sh
Move config.xml out of www/ and enhance createproject.sh
Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/a1603440
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/a1603440
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/a1603440
Branch: refs/heads/master
Commit: a1603440ac2add47248d2ebcd27540e3d9d1aa3c
Parents: 0d4275a
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Mar 6 10:38:54 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 6 10:42:36 2014 -0500
----------------------------------------------------------------------
config.xml | 24 +++++++++++++++++
createproject.sh | 75 ++++++++++++++++++++++++++++++++-------------------
www/config.xml | 24 -----------------
3 files changed, 72 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a1603440/config.xml
----------------------------------------------------------------------
diff --git a/config.xml b/config.xml
new file mode 100644
index 0000000..bb20925
--- /dev/null
+++ b/config.xml
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ 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.
+-->
+<widget id="org.apache.appharness" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>CordovaAppHarness</name>
+ <content src="cdvah/index.html" />
+ <access origin="*" />
+</widget>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a1603440/createproject.sh
----------------------------------------------------------------------
diff --git a/createproject.sh b/createproject.sh
index 17bb5c1..c14dd69 100755
--- a/createproject.sh
+++ b/createproject.sh
@@ -1,11 +1,48 @@
#!/bin/bash
-CORDOVA=${CORDOVA-cordova}
-PLATFORMS=${PLATFORMS-ios}
+if [[ $# -eq 0 || "$1" = "--help" ]]; then
+ echo "Usage: $0 NewDirName"
+ echo 'Options via variables:'
+ echo ' PLATFORMS="android ios"'
+ echo ' CORDOVA="path/to/cordova"'
+ echo ' PLUGIN_SEARCH_PATH="path1:path2:path3"'
+ exit 1
+fi
+
+CORDOVA="${CORDOVA-cordova}"
+PLATFORMS="${PLATFORMS-android}"
+DIR_NAME="${1}"
+AH_PATH="$(cd $(dirname $0) && pwd)"
+PLUGIN_SEARCH_PATH="${PLUGIN_SEARCH_PATH-$(dirname "$AH_PATH"):$(dirname "$AH_PATH")/cordova-plugins}"
+
+"$CORDOVA" create "$DIR_NAME" org.apache.appharness CordovaAppHarness --link-to "$AH_PATH/www" || exit 1
+cd "$DIR_NAME"
+cp "$AH_PATH/config.xml" . || exit 1
set -x
-$CORDOVA create CordovaAppHarness org.apache.appharness CordovaAppHarness || exit 1
-cd CordovaAppHarness
+$CORDOVA platform add $PLATFORMS || exit 1
+set +x
+
+# if [[ $PLATFORMS = *ios* ]]; then
+ # ../../cordova-ios/bin/update_cordova_subproject platforms/ios/CordovaAppHarness.xcodeproj
+# fi
+
+echo Installing plugins.
+"$CORDOVA" plugin add\
+ "$AH_PATH/UrlRemap" \
+ org.apache.cordova.file \
+ org.apache.cordova.file-transfer \
+ org.apache.cordova.device \
+ org.chromium.zip \
+ org.apache.cordova.file-system-roots \
+ --searchpath="$PLUGIN_SEARCH_PATH"
+
+# org.apache.cordova.device isn't used directly, but is convenient to test mobilespec.
+
+if [[ $? != 0 ]]; then
+ echo "Plugin installation failed. Probably you need to set PLUGIN_SEARCH_PATH env variable so that it contains the plugin that failed to install."
+ exit 1
+fi
echo '
var cordova = require("../../cordova-cli/cordova");
@@ -31,31 +68,15 @@ module.exports = function(grunt) {
grunt.registerTask("default", ["watch"]);
};
' > Gruntfile.js
-mkdir node_modules
-npm install grunt grunt-contrib-watch
-
-rm -r www
-ln -s ../www www
-
-$CORDOVA platform add $PLATFORMS || exit 1
-if [[ $PLATFORMS = *ios* ]]; then
- ../../cordova-ios/bin/update_cordova_subproject platforms/ios/CordovaAppHarness.xcodeproj
-fi
-
-$CORDOVA plugin add ../UrlRemap
-$CORDOVA plugin add ../../cordova-plugin-file
-$CORDOVA plugin add ../../cordova-plugin-file-transfer
-$CORDOVA plugin add ../../cordova-labs/file-extras
-$CORDOVA plugin add https://github.com/wildabeast/BarcodeScanner.git # Optional
-$CORDOVA plugin add ../../cordova-plugin-device # Not used by harness, but used by mobile-spec.
-# Currently unused. Will want it for .cdvh .crx support.
-# $CORDOVA plugin add ../../../mobile_chrome_apps/zip
+mkdir node_modules
+# TODO: Add an option for installing grunt
exit 0
+npm install grunt grunt-contrib-watch || exit 1
+
+# $CORDOVA plugin add org.apache.cordova.device # Not used by harness, but used by mobile-spec.
+# $CORDOVA plugin add https://github.com/wildabeast/BarcodeScanner.git # Optional
-# optional plugins
-for l in ../cordova-plugin-* ; do
- $CORDOVA plugin add "$l"
-done
+# cordova plugin add "https://git-wip-us.apache.org/repos/asf/cordova-plugins.git#:file-system-roots"
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a1603440/www/config.xml
----------------------------------------------------------------------
diff --git a/www/config.xml b/www/config.xml
deleted file mode 100644
index bb20925..0000000
--- a/www/config.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
- 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.
--->
-<widget id="org.apache.appharness" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>CordovaAppHarness</name>
- <content src="cdvah/index.html" />
- <access origin="*" />
-</widget>