stub of build specs related to config.xml interpolation. added a bunch of fixtures for tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/c3017bc5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/c3017bc5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/c3017bc5 Branch: refs/heads/cordova-client Commit: c3017bc50ab05606c828d9d593864687a821ea39 Parents: 94f9b53 Author: Fil Maj <maj....@gmail.com> Authored: Thu Sep 20 14:52:38 2012 -0700 Committer: Fil Maj <maj....@gmail.com> Committed: Thu Sep 20 14:52:38 2012 -0700 ---------------------------------------------------------------------- spec/build.spec.js | 38 +- .../projects/native/android/AndroidManifest.xml | 63 + .../projects/native/android/ant.properties | 17 + .../native/android/assets/www/cordova-2.1.0.js | 6505 +++++++++++++++ .../native/android/assets/www/css/index.css | 115 + .../native/android/assets/www/img/cordova.png | Bin 0 -> 19932 bytes .../native/android/assets/www/img/logo.png | Bin 0 -> 21814 bytes .../projects/native/android/assets/www/index.html | 42 + .../projects/native/android/assets/www/js/index.js | 49 + .../projects/native/android/assets/www/main.js | 165 + .../projects/native/android/assets/www/master.css | 116 + .../assets/www/res/icon/android/icon-36-ldpi.png | Bin 0 -> 3096 bytes .../assets/www/res/icon/android/icon-48-mdpi.png | Bin 0 -> 4090 bytes .../assets/www/res/icon/android/icon-72-hdpi.png | Bin 0 -> 6080 bytes .../assets/www/res/icon/android/icon-96-xhdpi.png | Bin 0 -> 7685 bytes .../res/screen/android/screen-hdpi-landscape.png | Bin 0 -> 218302 bytes .../res/screen/android/screen-hdpi-portrait.png | Bin 0 -> 222148 bytes .../res/screen/android/screen-ldpi-landscape.png | Bin 0 -> 42616 bytes .../res/screen/android/screen-ldpi-portrait.png | Bin 0 -> 42034 bytes .../res/screen/android/screen-mdpi-landscape.png | Bin 0 -> 92347 bytes .../res/screen/android/screen-mdpi-portrait.png | Bin 0 -> 90555 bytes .../res/screen/android/screen-xhdpi-landscape.png | Bin 0 -> 489604 bytes .../res/screen/android/screen-xhdpi-portrait.png | Bin 0 -> 504508 bytes .../projects/native/android/assets/www/spec.html | 68 + .../native/android/assets/www/spec/helper.js | 33 + .../native/android/assets/www/spec/index.js | 67 + spec/fixtures/projects/native/android/build.xml | 92 + spec/fixtures/projects/native/android/cordova/BOOM | 24 + .../projects/native/android/cordova/appinfo.jar | Bin 0 -> 1574 bytes .../fixtures/projects/native/android/cordova/clean | 24 + .../projects/native/android/cordova/cordova | 102 + .../fixtures/projects/native/android/cordova/debug | 24 + .../projects/native/android/cordova/emulate | 24 + spec/fixtures/projects/native/android/cordova/log | 24 + .../projects/native/android/libs/cordova-2.1.0.jar | Bin 0 -> 205209 bytes .../projects/native/android/local.properties | 10 + .../projects/native/android/proguard-project.txt | 20 + .../projects/native/android/project.properties | 14 + .../android/res/drawable-hdpi/ic_launcher.png | Bin 0 -> 9397 bytes .../native/android/res/drawable-hdpi/icon.png | Bin 0 -> 6080 bytes .../android/res/drawable-ldpi/ic_launcher.png | Bin 0 -> 2729 bytes .../native/android/res/drawable-ldpi/icon.png | Bin 0 -> 3096 bytes .../android/res/drawable-mdpi/ic_launcher.png | Bin 0 -> 5237 bytes .../native/android/res/drawable-mdpi/icon.png | Bin 0 -> 4090 bytes .../android/res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 14383 bytes .../native/android/res/drawable-xhdpi/icon.png | Bin 0 -> 7685 bytes .../projects/native/android/res/drawable/icon.png | Bin 0 -> 7685 bytes .../projects/native/android/res/layout/main.xml | 13 + .../projects/native/android/res/values/strings.xml | 4 + .../projects/native/android/res/xml/config.xml | 57 + .../org/apache/cordova/example/cordovaExample.java | 35 + spec/fixtures/projects/test/www/config.xml | 2 + spec/metadata/.android_parser.spec.js.swp | Bin 0 -> 12288 bytes spec/metadata/android_parser.spec.js | 54 + 54 files changed, 7799 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/c3017bc5/spec/build.spec.js ---------------------------------------------------------------------- diff --git a/spec/build.spec.js b/spec/build.spec.js index 70f1869..45a48b9 100644 --- a/spec/build.spec.js +++ b/spec/build.spec.js @@ -4,6 +4,7 @@ var cordova = require('../cordova'), path = require('path'), rmrf = wrench.rmdirSyncRecursive, fs = require('fs'), + config_parser = require('../src/config_parser'), tempDir = path.join(__dirname, '..', 'temp'); var cwd = process.cwd(); @@ -115,12 +116,45 @@ describe('build command', function() { }); }); - describe('should interpolate config.xml app metadata', function() { + describe('before each run it should interpolate config.xml app metadata', function() { + var cfg; + beforeEach(function() { + cordova.create(tempDir); + process.chdir(tempDir); + cfg = config_parser(path.join(tempDir, 'www', 'config.xml')); + }); + + afterEach(function() { + process.chdir(cwd); + }); + describe('into Android builds', function() { - it('should interpolate app name'); + it('should interpolate app name', function () { + /* + var buildcb = jasmine.createSpy(); + var cb = jasmine.createSpy(); + var newName = "devil ether"; + + runs(function() { + cordova.platform('add', 'android', cb); + }); + waitsFor(function() { return cb.wasCalled; }, 'platform add android callback'); + + runs(function() { + cfg.name(newName); // set a new name in the config.xml + cordova.build(buildcb); + }); + waitsFor(function() { return buildcb.wasCalled; }, 'build call', 20000); + runs(function() { + // TODO + }); + */ + }); + it('should interpolate package name'); }); describe('into iOS builds', function() { it('should interpolate app name'); + it('should interpolate package name'); }); }); }); http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/c3017bc5/spec/fixtures/projects/native/android/AndroidManifest.xml ---------------------------------------------------------------------- diff --git a/spec/fixtures/projects/native/android/AndroidManifest.xml b/spec/fixtures/projects/native/android/AndroidManifest.xml new file mode 100644 index 0000000..1e7b31b --- /dev/null +++ b/spec/fixtures/projects/native/android/AndroidManifest.xml @@ -0,0 +1,63 @@ +<?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. +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan" + package="org.apache.cordova.example" android:versionName="1.1" android:versionCode="5" android:hardwareAccelerated="true"> + <supports-screens + android:largeScreens="true" + android:normalScreens="true" + android:smallScreens="true" + android:xlargeScreens="true" + android:resizeable="true" + android:anyDensity="true" + /> + + <uses-permission android:name="android.permission.CAMERA" /> + <uses-permission android:name="android.permission.VIBRATE" /> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.RECEIVE_SMS" /> + <uses-permission android:name="android.permission.RECORD_AUDIO" /> + <uses-permission android:name="android.permission.RECORD_VIDEO"/> + <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> + <uses-permission android:name="android.permission.READ_CONTACTS" /> + <uses-permission android:name="android.permission.WRITE_CONTACTS" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + <uses-permission android:name="android.permission.GET_ACCOUNTS" /> + <uses-permission android:name="android.permission.BROADCAST_STICKY" /> + + + <application android:icon="@drawable/icon" android:label="@string/app_name" + android:hardwareAccelerated="true" + android:debuggable="true"> + <activity android:name="cordovaExample" android:label="@string/app_name" + android:theme="@android:style/Theme.Black.NoTitleBar" + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + + <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/> +</manifest> http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/c3017bc5/spec/fixtures/projects/native/android/ant.properties ---------------------------------------------------------------------- diff --git a/spec/fixtures/projects/native/android/ant.properties b/spec/fixtures/projects/native/android/ant.properties new file mode 100644 index 0000000..b0971e8 --- /dev/null +++ b/spec/fixtures/projects/native/android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. +