You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/05/02 20:33:33 UTC
[14/24] git commit: Split out cordova-lib: move cordova-cli files
Split out cordova-lib: move cordova-cli files
HISTORY:
git log <file> will show no history from before this commit for files that
moved. To see full history use either
git log --follow <file>
or
git log cli_pre_lib <old file name>
'cli_pre_lib' is a tag for the last commit in cordova-cli repo made before
cordova-lib was split out.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/b51e1c12
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/b51e1c12
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/b51e1c12
Branch: refs/heads/cordova-lib
Commit: b51e1c12ae384838ea6c1399dba6c0b49d3c2bca
Parents: 450468a
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Wed Apr 30 18:11:57 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Wed Apr 30 18:11:57 2014 -0400
----------------------------------------------------------------------
cordova-lib/spec-cordova/ConfigParser.spec.js | 84 +
cordova-lib/spec-cordova/build.spec.js | 129 ++
cordova-lib/spec-cordova/compile.spec.js | 113 ++
cordova-lib/spec-cordova/create.spec.js | 138 ++
cordova-lib/spec-cordova/emulate.spec.js | 115 ++
.../fixtures/base/.cordova/config.json | 22 +
.../spec-cordova/fixtures/base/merges/.svn | 0
.../spec-cordova/fixtures/base/plugins/.svn | 0
.../spec-cordova/fixtures/base/www/config.xml | 14 +
.../fixtures/base/www/css/index.css | 115 ++
.../spec-cordova/fixtures/base/www/img/logo.png | Bin 0 -> 21814 bytes
.../spec-cordova/fixtures/base/www/index.html | 43 +
.../spec-cordova/fixtures/base/www/js/index.js | 49 +
.../spec-cordova/fixtures/base/www/spec.html | 68 +
.../fixtures/hooks_bat/fail/fail.bat | 2 +
.../fixtures/hooks_bat/test/.dotted.bat | 2 +
.../spec-cordova/fixtures/hooks_bat/test/07.bat | 3 +
.../spec-cordova/fixtures/hooks_bat/test/1.bat | 5 +
.../spec-cordova/fixtures/hooks_sh/fail/fail.sh | 1 +
.../fixtures/hooks_sh/test/.dotted.sh | 1 +
.../spec-cordova/fixtures/hooks_sh/test/07.sh | 2 +
.../spec-cordova/fixtures/hooks_sh/test/1.sh | 4 +
.../fixtures/platforms/android-lib/VERSION | 1 +
.../android-lib/framework/assets/www/cordova.js | 1 +
.../platforms/android/AndroidManifest.xml | 14 +
.../platforms/android/assets/www/config.xml | 14 +
.../platforms/android/assets/www/cordova.js | 1712 ++++++++++++++++++
.../android/assets/www/cordova_plugins.js | 3 +
.../platforms/android/assets/www/css/index.css | 115 ++
.../platforms/android/assets/www/img/logo.png | Bin 0 -> 21814 bytes
.../platforms/android/assets/www/index.html | 43 +
.../platforms/android/assets/www/js/index.js | 49 +
.../platforms/android/assets/www/spec.html | 68 +
.../fixtures/platforms/android/build.xml | 92 +
.../fixtures/platforms/android/cordova/build | 35 +
.../platforms/android/cordova/check_reqs | 27 +
.../fixtures/platforms/android/cordova/clean | 34 +
.../platforms/android/cordova/defaults.xml | 50 +
.../platforms/android/cordova/lib/appinfo.js | 41 +
.../platforms/android/cordova/lib/build.js | 89 +
.../platforms/android/cordova/lib/check_reqs.js | 78 +
.../platforms/android/cordova/lib/clean.js | 43 +
.../platforms/android/cordova/lib/device.js | 95 +
.../platforms/android/cordova/lib/emulator.js | 337 ++++
.../android/cordova/lib/install-device | 38 +
.../android/cordova/lib/install-emulator | 38 +
.../platforms/android/cordova/lib/list-devices | 28 +
.../android/cordova/lib/list-emulator-images | 29 +
.../android/cordova/lib/list-started-emulators | 29 +
.../platforms/android/cordova/lib/log.js | 43 +
.../platforms/android/cordova/lib/run.js | 124 ++
.../android/cordova/lib/start-emulator | 38 +
.../fixtures/platforms/android/cordova/log | 33 +
.../fixtures/platforms/android/cordova/run | 35 +
.../fixtures/platforms/android/cordova/version | 25 +
.../fixtures/platforms/android/local.properties | 10 +
.../platforms/android/proguard-project.txt | 20 +
.../platforms/android/project.properties | 14 +
.../android/res/drawable-hdpi/icon.png | Bin 0 -> 6080 bytes
.../android/res/drawable-ldpi/icon.png | Bin 0 -> 3096 bytes
.../android/res/drawable-mdpi/icon.png | Bin 0 -> 4090 bytes
.../android/res/drawable-xhdpi/icon.png | Bin 0 -> 7685 bytes
.../platforms/android/res/drawable/icon.png | Bin 0 -> 7685 bytes
.../platforms/android/res/values/strings.xml | 4 +
.../platforms/android/res/xml/config.xml | 18 +
.../android/src/org/testing/TestBase.java | 37 +
.../fixtures/plugins/ChildBrowser/plugin.xml | 142 ++
.../ChildBrowser/src/android/ChildBrowser.java | 19 +
.../plugins/ChildBrowser/www/childbrowser.js | 19 +
.../ChildBrowser/www/childbrowser/image.jpg | 1 +
.../ChildBrowser/www/childbrowser_file.html | 1 +
.../fixtures/plugins/android/plugin.xml | 14 +
.../plugins/android/src/android/Android.java | 0
.../android/src/android/SomethingWithR.java | 6 +
.../fixtures/plugins/android/www/android.js | 0
.../fixtures/plugins/fake1/plugin.xml | 10 +
.../fixtures/plugins/test/plugin.xml | 14 +
.../fixtures/plugins/test/www/test.js | 0
.../projects/android/AndroidManifest.xml | 69 +
.../projects/android/assets/www/.gitkeep | 0
.../projects/android/res/xml/config.xml | 54 +
.../fixtures/projects/android/src/.gitkeep | 0
.../fixtures/projects/windows/bom_test.xml | 24 +
.../fixtures/templates/no_content_config.xml | 19 +
cordova-lib/spec-cordova/helper.js | 19 +
cordova-lib/spec-cordova/helpers.js | 46 +
cordova-lib/spec-cordova/hooker.spec.js | 261 +++
cordova-lib/spec-cordova/lazy_load.spec.js | 200 ++
.../metadata/android_parser.spec.js | 211 +++
.../metadata/blackberry_parser.spec.js | 225 +++
.../metadata/firefoxos_parser.spec.js | 74 +
.../spec-cordova/metadata/ios_parser.spec.js | 199 ++
.../metadata/windows8_parser.spec.js | 189 ++
.../spec-cordova/metadata/wp7_parser.spec.js | 208 +++
.../spec-cordova/metadata/wp8_parser.spec.js | 208 +++
cordova-lib/spec-cordova/platform.spec.js | 108 ++
cordova-lib/spec-cordova/plugin.spec.js | 68 +
cordova-lib/spec-cordova/plugin_parser.spec.js | 48 +
cordova-lib/spec-cordova/prepare.spec.js | 290 +++
cordova-lib/spec-cordova/run.spec.js | 114 ++
cordova-lib/spec-cordova/serve.spec.js | 132 ++
cordova-lib/spec-cordova/test-config.xml | 26 +
cordova-lib/spec-cordova/util.spec.js | 186 ++
cordova-lib/spec-cordova/wrappers.spec.js | 40 +
cordova-lib/spec-cordova/xml-helpers.spec.js | 137 ++
cordova-lib/src/cordova/ConfigParser.js | 163 ++
cordova-lib/src/cordova/CordovaError.js | 31 +
cordova-lib/src/cordova/build.js | 47 +
cordova-lib/src/cordova/compile.js | 45 +
cordova-lib/src/cordova/config.js | 82 +
cordova-lib/src/cordova/cordova.js | 68 +
cordova-lib/src/cordova/create.js | 220 +++
cordova-lib/src/cordova/emulate.js | 50 +
cordova-lib/src/cordova/events.js | 23 +
cordova-lib/src/cordova/hooker.js | 161 ++
cordova-lib/src/cordova/info.js | 111 ++
cordova-lib/src/cordova/lazy_load.js | 151 ++
.../cordova/metadata/amazon_fireos_parser.js | 183 ++
.../src/cordova/metadata/android_parser.js | 303 ++++
.../src/cordova/metadata/blackberry10_parser.js | 145 ++
.../src/cordova/metadata/firefoxos_parser.js | 151 ++
cordova-lib/src/cordova/metadata/ios_parser.js | 202 +++
.../src/cordova/metadata/ubuntu_parser.js | 162 ++
.../src/cordova/metadata/windows8_parser.js | 339 ++++
cordova-lib/src/cordova/metadata/wp7_parser.js | 262 +++
cordova-lib/src/cordova/metadata/wp8_parser.js | 287 +++
cordova-lib/src/cordova/platform.js | 399 ++++
cordova-lib/src/cordova/platforms.js | 88 +
cordova-lib/src/cordova/plugin.js | 210 +++
cordova-lib/src/cordova/plugin_parser.js | 30 +
cordova-lib/src/cordova/prepare.js | 187 ++
cordova-lib/src/cordova/run.js | 48 +
cordova-lib/src/cordova/serve.js | 224 +++
cordova-lib/src/cordova/superspawn.js | 139 ++
cordova-lib/src/cordova/util.js | 214 +++
cordova-lib/src/cordova/xml-helpers.js | 171 ++
cordova-lib/templates/config.xml | 19 +
cordova-lib/templates/hooks-README.md | 83 +
cordova.js | 68 -
platforms.js | 88 -
spec/ConfigParser.spec.js | 84 -
spec/build.spec.js | 129 --
spec/compile.spec.js | 113 --
spec/create.spec.js | 138 --
spec/emulate.spec.js | 115 --
spec/fixtures/base/.cordova/config.json | 22 -
spec/fixtures/base/merges/.svn | 0
spec/fixtures/base/plugins/.svn | 0
spec/fixtures/base/www/config.xml | 14 -
spec/fixtures/base/www/css/index.css | 115 --
spec/fixtures/base/www/img/logo.png | Bin 21814 -> 0 bytes
spec/fixtures/base/www/index.html | 43 -
spec/fixtures/base/www/js/index.js | 49 -
spec/fixtures/base/www/spec.html | 68 -
spec/fixtures/hooks_bat/fail/fail.bat | 2 -
spec/fixtures/hooks_bat/test/.dotted.bat | 2 -
spec/fixtures/hooks_bat/test/07.bat | 3 -
spec/fixtures/hooks_bat/test/1.bat | 5 -
spec/fixtures/hooks_sh/fail/fail.sh | 1 -
spec/fixtures/hooks_sh/test/.dotted.sh | 1 -
spec/fixtures/hooks_sh/test/07.sh | 2 -
spec/fixtures/hooks_sh/test/1.sh | 4 -
spec/fixtures/platforms/android-lib/VERSION | 1 -
.../android-lib/framework/assets/www/cordova.js | 1 -
.../platforms/android/AndroidManifest.xml | 14 -
.../platforms/android/assets/www/config.xml | 14 -
.../platforms/android/assets/www/cordova.js | 1712 ------------------
.../android/assets/www/cordova_plugins.js | 3 -
.../platforms/android/assets/www/css/index.css | 115 --
.../platforms/android/assets/www/img/logo.png | Bin 21814 -> 0 bytes
.../platforms/android/assets/www/index.html | 43 -
.../platforms/android/assets/www/js/index.js | 49 -
.../platforms/android/assets/www/spec.html | 68 -
spec/fixtures/platforms/android/build.xml | 92 -
spec/fixtures/platforms/android/cordova/build | 35 -
.../platforms/android/cordova/check_reqs | 27 -
spec/fixtures/platforms/android/cordova/clean | 34 -
.../platforms/android/cordova/defaults.xml | 50 -
.../platforms/android/cordova/lib/appinfo.js | 41 -
.../platforms/android/cordova/lib/build.js | 89 -
.../platforms/android/cordova/lib/check_reqs.js | 78 -
.../platforms/android/cordova/lib/clean.js | 43 -
.../platforms/android/cordova/lib/device.js | 95 -
.../platforms/android/cordova/lib/emulator.js | 337 ----
.../android/cordova/lib/install-device | 38 -
.../android/cordova/lib/install-emulator | 38 -
.../platforms/android/cordova/lib/list-devices | 28 -
.../android/cordova/lib/list-emulator-images | 29 -
.../android/cordova/lib/list-started-emulators | 29 -
.../platforms/android/cordova/lib/log.js | 43 -
.../platforms/android/cordova/lib/run.js | 124 --
.../android/cordova/lib/start-emulator | 38 -
spec/fixtures/platforms/android/cordova/log | 33 -
spec/fixtures/platforms/android/cordova/run | 35 -
spec/fixtures/platforms/android/cordova/version | 25 -
.../fixtures/platforms/android/local.properties | 10 -
.../platforms/android/proguard-project.txt | 20 -
.../platforms/android/project.properties | 14 -
.../android/res/drawable-hdpi/icon.png | Bin 6080 -> 0 bytes
.../android/res/drawable-ldpi/icon.png | Bin 3096 -> 0 bytes
.../android/res/drawable-mdpi/icon.png | Bin 4090 -> 0 bytes
.../android/res/drawable-xhdpi/icon.png | Bin 7685 -> 0 bytes
.../platforms/android/res/drawable/icon.png | Bin 7685 -> 0 bytes
.../platforms/android/res/values/strings.xml | 4 -
.../platforms/android/res/xml/config.xml | 18 -
.../android/src/org/testing/TestBase.java | 37 -
spec/fixtures/plugins/ChildBrowser/plugin.xml | 142 --
.../ChildBrowser/src/android/ChildBrowser.java | 19 -
.../plugins/ChildBrowser/www/childbrowser.js | 19 -
.../ChildBrowser/www/childbrowser/image.jpg | 1 -
.../ChildBrowser/www/childbrowser_file.html | 1 -
spec/fixtures/plugins/android/plugin.xml | 14 -
.../plugins/android/src/android/Android.java | 0
.../android/src/android/SomethingWithR.java | 6 -
spec/fixtures/plugins/android/www/android.js | 0
spec/fixtures/plugins/fake1/plugin.xml | 10 -
spec/fixtures/plugins/test/plugin.xml | 14 -
spec/fixtures/plugins/test/www/test.js | 0
.../projects/android/AndroidManifest.xml | 69 -
.../projects/android/assets/www/.gitkeep | 0
.../projects/android/res/xml/config.xml | 54 -
spec/fixtures/projects/android/src/.gitkeep | 0
spec/fixtures/projects/windows/bom_test.xml | 24 -
spec/fixtures/templates/no_content_config.xml | 19 -
spec/helper.js | 19 -
spec/helpers.js | 46 -
spec/hooker.spec.js | 261 ---
spec/lazy_load.spec.js | 200 --
spec/metadata/android_parser.spec.js | 211 ---
spec/metadata/blackberry_parser.spec.js | 225 ---
spec/metadata/firefoxos_parser.spec.js | 74 -
spec/metadata/ios_parser.spec.js | 199 --
spec/metadata/windows8_parser.spec.js | 189 --
spec/metadata/wp7_parser.spec.js | 208 ---
spec/metadata/wp8_parser.spec.js | 208 ---
spec/platform.spec.js | 108 --
spec/plugin.spec.js | 68 -
spec/plugin_parser.spec.js | 48 -
spec/prepare.spec.js | 290 ---
spec/run.spec.js | 114 --
spec/serve.spec.js | 132 --
spec/test-config.xml | 26 -
spec/util.spec.js | 186 --
spec/wrappers.spec.js | 40 -
spec/xml-helpers.spec.js | 137 --
src/ConfigParser.js | 163 --
src/CordovaError.js | 31 -
src/build.js | 47 -
src/compile.js | 45 -
src/config.js | 82 -
src/create.js | 220 ---
src/emulate.js | 50 -
src/events.js | 23 -
src/hooker.js | 161 --
src/info.js | 111 --
src/lazy_load.js | 151 --
src/metadata/amazon_fireos_parser.js | 183 --
src/metadata/android_parser.js | 303 ----
src/metadata/blackberry10_parser.js | 145 --
src/metadata/firefoxos_parser.js | 151 --
src/metadata/ios_parser.js | 202 ---
src/metadata/ubuntu_parser.js | 162 --
src/metadata/windows8_parser.js | 339 ----
src/metadata/wp7_parser.js | 262 ---
src/metadata/wp8_parser.js | 287 ---
src/platform.js | 399 ----
src/plugin.js | 210 ---
src/plugin_parser.js | 30 -
src/prepare.js | 187 --
src/run.js | 48 -
src/serve.js | 224 ---
src/superspawn.js | 139 --
src/util.js | 214 ---
src/xml-helpers.js | 171 --
templates/config.xml | 19 -
templates/hooks-README.md | 83 -
276 files changed, 12793 insertions(+), 12793 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/ConfigParser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/ConfigParser.spec.js b/cordova-lib/spec-cordova/ConfigParser.spec.js
new file mode 100644
index 0000000..1faec88
--- /dev/null
+++ b/cordova-lib/spec-cordova/ConfigParser.spec.js
@@ -0,0 +1,84 @@
+/**
+ 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.
+*/
+var path = require('path'),
+ fs = require('fs'),
+ ConfigParser = require('../src/ConfigParser'),
+ xml = path.join(__dirname, 'test-config.xml'),
+ xml_contents = fs.readFileSync(xml, 'utf-8');
+
+describe('config.xml parser', function () {
+ var readFile;
+ beforeEach(function() {
+ readFile = spyOn(fs, 'readFileSync').andReturn(xml_contents);
+ });
+
+ it('should create an instance based on an xml file', function() {
+ var cfg;
+ expect(function () {
+ cfg = new ConfigParser(xml);
+ }).not.toThrow();
+ expect(cfg).toBeDefined();
+ expect(cfg.doc).toBeDefined();
+ });
+
+ describe('methods', function() {
+ var cfg;
+ beforeEach(function() {
+ cfg = new ConfigParser(xml);
+ });
+
+ describe('package name / id', function() {
+ it('should get the (default) packagename', function() {
+ expect(cfg.packageName()).toEqual('io.cordova.hellocordova');
+ });
+ it('should allow setting the packagename', function() {
+ cfg.setPackageName('this.is.bat.country');
+ expect(cfg.packageName()).toEqual('this.is.bat.country');
+ });
+ });
+
+ describe('version', function() {
+ it('should get the version', function() {
+ expect(cfg.version()).toEqual('0.0.1');
+ });
+ it('should allow setting the version', function() {
+ cfg.setVersion('2.0.1');
+ expect(cfg.version()).toEqual('2.0.1');
+ });
+ });
+
+ describe('app name', function() {
+ it('should get the (default) app name', function() {
+ expect(cfg.name()).toEqual('Hello Cordova');
+ });
+ it('should allow setting the app name', function() {
+ cfg.setName('this.is.bat.country');
+ expect(cfg.name()).toEqual('this.is.bat.country');
+ });
+ });
+ describe('preference', function() {
+ it('should get value of existing preference', function() {
+ expect(cfg.getPreference('fullscreen')).toEqual('true');
+ });
+ it('should get undefined as non existing preference', function() {
+ expect(cfg.getPreference('zimzooo!')).toEqual(undefined);
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/build.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/build.spec.js b/cordova-lib/spec-cordova/build.spec.js
new file mode 100644
index 0000000..259c3d4
--- /dev/null
+++ b/cordova-lib/spec-cordova/build.spec.js
@@ -0,0 +1,129 @@
+/**
+ 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.
+*/
+var cordova = require('../cordova'),
+ platforms = require('../platforms'),
+ shell = require('shelljs'),
+ path = require('path'),
+ fs = require('fs'),
+ hooker = require('../src/hooker'),
+ Q = require('q'),
+ util = require('../src/util');
+
+var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+
+describe('build command', function() {
+ var is_cordova, cd_project_root, list_platforms, fire;
+ var project_dir = '/some/path';
+ var prepare_spy, compile_spy;
+ var result;
+
+ function buildPromise(f) {
+ f.then(function() { result = true; }, function(err) { result = err; });
+ }
+
+ function wrapper(f, post) {
+ runs(function() {
+ buildPromise(f);
+ });
+ waitsFor(function() { return result; }, 'promise never resolved', 500);
+ runs(post);
+ }
+
+ beforeEach(function() {
+ is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
+ cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
+ list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
+ fire = spyOn(hooker.prototype, 'fire').andReturn(Q());
+ prepare_spy = spyOn(cordova.raw, 'prepare').andReturn(Q());
+ compile_spy = spyOn(cordova.raw, 'compile').andReturn(Q());
+ });
+ describe('failure', function() {
+ it('should not run inside a project with no platforms', function(done) {
+ list_platforms.andReturn([]);
+ Q().then(cordova.raw.build).then(function() {
+ expect('this call').toBe('fail');
+ }, function(err) {
+ expect(err.message).toEqual(
+ 'No platforms added to this project. Please use `cordova platform add <platform>`.'
+ )
+ }).fin(done);
+ });
+
+ it('should not run outside of a Cordova-based project', function(done) {
+ is_cordova.andReturn(false);
+
+ Q().then(cordova.raw.build).then(function() {
+ expect('this call').toBe('fail');
+ }, function(err) {
+ expect(err.message).toEqual(
+ 'Current working directory is not a Cordova-based project.'
+ )
+ }).fin(done);
+ });
+ });
+
+ describe('success', function() {
+ it('should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function(done) {
+ cordova.raw.build(['android','ios']).then(function() {
+ var opts = {verbose: false, platforms: ['android', 'ios'], options: []};
+ expect(prepare_spy).toHaveBeenCalledWith(opts);
+ expect(compile_spy).toHaveBeenCalledWith(opts);
+ done();
+ });
+ });
+ it('should pass down options', function(done) {
+ cordova.raw.build({platforms: ['android'], options: ['--release']}).then(function() {
+ var opts = {platforms: ['android'], options: ["--release"], verbose: false};
+ expect(prepare_spy).toHaveBeenCalledWith(opts);
+ expect(compile_spy).toHaveBeenCalledWith(opts);
+ done();
+ });
+ });
+ });
+
+ describe('hooks', function() {
+ describe('when platforms are added', function() {
+ it('should fire before hooks through the hooker module', function(done) {
+ cordova.raw.build(['android', 'ios']).then(function() {
+ expect(fire).toHaveBeenCalledWith('before_build', {verbose: false, platforms:['android', 'ios'], options: []});
+ done();
+ });
+ });
+ it('should fire after hooks through the hooker module', function(done) {
+ cordova.raw.build('android').then(function() {
+ expect(fire).toHaveBeenCalledWith('after_build', {verbose: false, platforms:['android'], options: []});
+ done();
+ });
+ });
+ });
+
+ describe('with no platforms added', function() {
+ it('should not fire the hooker', function(done) {
+ list_platforms.andReturn([]);
+ Q().then(cordova.raw.build).then(function() {
+ expect('this call').toBe('fail');
+ }, function(err) {
+ expect(err.message).toEqual(
+ 'No platforms added to this project. Please use `cordova platform add <platform>`.'
+ )
+ }).fin(done);
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/compile.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/compile.spec.js b/cordova-lib/spec-cordova/compile.spec.js
new file mode 100644
index 0000000..c1fc8b9
--- /dev/null
+++ b/cordova-lib/spec-cordova/compile.spec.js
@@ -0,0 +1,113 @@
+/**
+ 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.
+*/
+var cordova = require('../cordova'),
+ platforms = require('../platforms'),
+ path = require('path'),
+ fs = require('fs'),
+ hooker = require('../src/hooker'),
+ superspawn = require('../src/superspawn'),
+ util = require('../src/util'),
+ Q = require('q'),
+ os = require('os');
+
+
+var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+
+
+describe('compile command', function() {
+ var is_cordova, list_platforms, fire, result, cd_project_root;
+ var project_dir = '/some/path';
+
+ function wrapper(f, post) {
+ runs(function() {
+ Q().then(f).then(function() { result = true; }, function(err) { result = err; });
+ });
+ waitsFor(function() { return result; }, 'promise never resolved', 500);
+ runs(post);
+ }
+ beforeEach(function() {
+ is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
+ cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
+ list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
+ fire = spyOn(hooker.prototype, 'fire').andReturn(Q());
+ spyOn(superspawn, 'spawn').andCallFake(function() { return Q() });
+ });
+ describe('failure', function() {
+ it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function() {
+ list_platforms.andReturn([]);
+ wrapper(cordova.raw.compile, function() {
+ expect('' + result).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
+ });
+ });
+ it('should not run outside of a Cordova-based project', function() {
+ is_cordova.andReturn(false);
+ wrapper(cordova.raw.compile, function() {
+ expect(result instanceof Error).toBe(true);
+ });
+ });
+ });
+
+ describe('success', function() {
+ it('should run inside a Cordova-based project with at least one added platform and shell out to build', function(done) {
+ cordova.raw.compile(['android','ios']).then(function() {
+ expect(superspawn.spawn).toHaveBeenCalledWith(path.join(project_dir, 'platforms', 'android', 'cordova', 'build'), [], jasmine.any(Object));
+ expect(superspawn.spawn).toHaveBeenCalledWith(path.join(project_dir, 'platforms', 'ios', 'cordova', 'build'), [], jasmine.any(Object));
+ done();
+ });
+ });
+
+ it('should pass down optional parameters', function (done) {
+ cordova.raw.compile({platforms:["blackberry10"], options:["--release"]}).then(function () {
+ expect(superspawn.spawn).toHaveBeenCalledWith(path.join(project_dir, 'platforms', 'blackberry10', 'cordova', 'build'), ['--release'], jasmine.any(Object));
+ done();
+ });
+ });
+ });
+
+ describe('hooks', function() {
+ describe('when platforms are added', function() {
+ it('should fire before hooks through the hooker module', function(done) {
+ cordova.raw.compile(['android', 'ios']).then(function() {
+ expect(fire).toHaveBeenCalledWith('before_compile', {verbose: false, platforms:['android', 'ios'], options: []});
+ done();
+ });
+ });
+ it('should fire after hooks through the hooker module', function(done) {
+ cordova.raw.compile('android').then(function() {
+ expect(fire).toHaveBeenCalledWith('after_compile', {verbose: false, platforms:['android'], options: []});
+ done();
+ });
+ });
+ });
+
+ describe('with no platforms added', function() {
+ it('should not fire the hooker', function(done) {
+ list_platforms.andReturn([]);
+ Q().then(cordova.raw.compile).then(function() {
+ expect('this call').toBe('fail');
+ }, function(err) {
+ expect(fire).not.toHaveBeenCalled();
+ expect(err.message).toContain(
+ 'No platforms added to this project. Please use `cordova platform add <platform>`.'
+ )
+ }).fin(done);
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/create.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/create.spec.js b/cordova-lib/spec-cordova/create.spec.js
new file mode 100644
index 0000000..ebdfab5
--- /dev/null
+++ b/cordova-lib/spec-cordova/create.spec.js
@@ -0,0 +1,138 @@
+/**
+ 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.
+*/
+
+var helpers = require('./helpers'),
+ path = require('path'),
+ fs = require('fs'),
+ shell = require('shelljs'),
+ Q = require('q'),
+ config = require('../src/config'),
+ events = require('../src/events'),
+ util = require('../src/util'),
+ ConfigParser = require('../src/ConfigParser'),
+ cordova = require('../cordova');
+
+// A utility function to generate all combinations of elements from 2 arrays.
+// crossConcat(['x', 'y'], ['1', '2', '3'])
+// -> [ 'x1', 'x2', 'x3', 'y1', 'y2', 'y3']
+var crossConcat = function(a, b, delimiter){
+ var result = [];
+ delimiter = delimiter || '';
+ for (var i = 0; i < a.length; i++) {
+ for (var j = 0; j < b.length; j++) {
+ result.push(a[i] + delimiter + b[j]);
+ }
+ }
+ return result;
+};
+
+var tmpDir = helpers.tmpDir('create_test');
+var appName = 'TestBase';
+var appId = 'org.testing';
+var project = path.join(tmpDir, appName);
+var cordovaDir = path.join(project, '.cordova');
+var configNormal = {
+ lib: {
+ www: {
+ uri: path.join(__dirname, 'fixtures', 'base', 'www'),
+ version: "testCordovaCreate",
+ id: appName
+ }
+ }
+ };
+var configSymlink = {
+ lib: {
+ www: {
+ uri: path.join(__dirname, 'fixtures', 'base'), // "create" should copy or link the www child of this dir and not the dir itself.
+ link: true
+ }
+ }
+ };
+
+
+describe('create end-to-end', function() {
+
+ beforeEach(function() {
+ shell.rm('-rf', project);
+ });
+ afterEach(function() {
+ process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+ shell.rm('-rf', tmpDir);
+ });
+
+ function checkProject() {
+ // Check if top level dirs exist.
+ var dirs = ['hooks', 'platforms', 'merges', 'plugins', 'www'];
+ dirs.forEach(function(d) {
+ expect(path.join(project, d)).toExist();
+ });
+
+ expect(path.join(project, 'hooks', 'README.md')).toExist();
+
+ // Check if config files exist.
+ expect(path.join(project, 'www', 'index.html')).toExist();
+
+ // Check that www/config.xml was updated.
+ var configXml = new ConfigParser(path.join(project, 'www', 'config.xml'));
+ expect(configXml.packageName()).toEqual(appId);
+
+ // TODO (kamrik): check somehow that we got the right config.xml from the fixture and not some place else.
+ // expect(configXml.name()).toEqual('TestBase');
+ }
+
+ var results;
+ events.on('results', function(res) { results = res; });
+
+ it('should successfully run with regular config', function(done) {
+ // Call cordova create with no args, should return help.
+ cordova.raw.create()
+ .then(function() {
+ expect(results).toMatch(/synopsis/gi);
+ })
+ .then(function() {
+ // Create a real project
+ return cordova.raw.create(project, appId, appName, configNormal);
+ })
+ .then(checkProject)
+ .fail(function(err) {
+ console.log(err);
+ expect(err).toBeUndefined();
+ })
+ .fin(done);
+ });
+
+ it('should successfully run with symlinked www', function(done) {
+ // Call cordova create with no args, should return help.
+ cordova.raw.create(project, appId, appName, configSymlink)
+ .then(checkProject)
+ .then(function() {
+ // Check that www is really a symlink
+ expect(fs.lstatSync(path.join(project, 'www')).isSymbolicLink()).toBe(true);
+ })
+ .fail(function(err) {
+ if(process.platform.slice(0, 3) == 'win') {
+ // Allow symlink error if not in admin mode
+ expect(err.message).toBe("Symlinks on Windows require Administrator privileges");
+ } else {
+ expect(err).toBeUndefined();
+ }
+ })
+ .fin(done);
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/emulate.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/emulate.spec.js b/cordova-lib/spec-cordova/emulate.spec.js
new file mode 100644
index 0000000..8435535
--- /dev/null
+++ b/cordova-lib/spec-cordova/emulate.spec.js
@@ -0,0 +1,115 @@
+/**
+ 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.
+*/
+var cordova = require('../cordova'),
+ platforms = require('../platforms'),
+ superspawn = require('../src/superspawn'),
+ path = require('path'),
+ fs = require('fs'),
+ hooker = require('../src/hooker'),
+ Q = require('q'),
+ util = require('../src/util'),
+ os = require('os');
+
+var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+
+describe('emulate command', function() {
+ var is_cordova, cd_project_root, list_platforms, fire, result;
+ var project_dir = '/some/path';
+ var prepare_spy;
+
+ function wrapper(f, post) {
+ runs(function() {
+ Q().then(f).then(function() { result = true; }, function(err) { result = err; });
+ });
+ waitsFor(function() { return result; }, 'promise never resolved', 500);
+ runs(post);
+ }
+
+ beforeEach(function() {
+ is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
+ cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
+ list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
+ fire = spyOn(hooker.prototype, 'fire').andReturn(Q());
+ prepare_spy = spyOn(cordova.raw, 'prepare').andReturn(Q());
+ spyOn(superspawn, 'spawn').andCallFake(Q);
+ });
+ describe('failure', function() {
+ it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function() {
+ list_platforms.andReturn([]);
+ wrapper(cordova.raw.emulate, function() {
+ expect(''+ result).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
+ });
+ });
+ it('should not run outside of a Cordova-based project', function() {
+ is_cordova.andReturn(false);
+ wrapper(cordova.raw.emulate, function() {
+ expect(result instanceof Error).toBe(true);
+ });
+ });
+ });
+
+ describe('success', function() {
+ it('should run inside a Cordova-based project with at least one added platform and call prepare and shell out to the emulate script', function(done) {
+ cordova.raw.emulate(['android','ios']).then(function(err) {
+ expect(prepare_spy).toHaveBeenCalledWith(['android', 'ios']);
+ expect(superspawn.spawn).toHaveBeenCalledWith(path.join(project_dir, 'platforms', 'android', 'cordova', 'run'), ['--emulator'], jasmine.any(Object));
+ expect(superspawn.spawn).toHaveBeenCalledWith(path.join(project_dir, 'platforms', 'ios', 'cordova', 'run'), ['--emulator'], jasmine.any(Object));
+
+ done();
+ });
+ });
+ it('should pass down options', function(done) {
+ cordova.raw.emulate({platforms: ['ios'], options:["--optionTastic"]}).then(function(err) {
+ expect(prepare_spy).toHaveBeenCalledWith(['ios']);
+ expect(superspawn.spawn).toHaveBeenCalledWith(path.join(project_dir, 'platforms', 'ios', 'cordova', 'run'), ['--emulator', '--optionTastic'], jasmine.any(Object));
+
+ done();
+ });
+ });
+ });
+
+ describe('hooks', function() {
+ describe('when platforms are added', function() {
+ it('should fire before hooks through the hooker module', function(done) {
+ cordova.raw.emulate(['android', 'ios']).then(function() {
+ expect(fire).toHaveBeenCalledWith('before_emulate', {verbose: false, platforms:['android', 'ios'], options: []});
+ done();
+ });
+ });
+ it('should fire after hooks through the hooker module', function(done) {
+ cordova.raw.emulate('android').then(function() {
+ expect(fire).toHaveBeenCalledWith('after_emulate', {verbose: false, platforms:['android'], options: []});
+ done();
+ });
+ });
+ });
+
+ describe('with no platforms added', function() {
+ it('should not fire the hooker', function(done) {
+ list_platforms.andReturn([]);
+ Q().then(cordova.raw.emulate).then(function() {
+ expect('this call').toBe('fail');
+ }, function(err) {
+ expect(fire).not.toHaveBeenCalled();
+ expect(''+err).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.')
+ }).fin(done);
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/.cordova/config.json
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/.cordova/config.json b/cordova-lib/spec-cordova/fixtures/base/.cordova/config.json
new file mode 100644
index 0000000..662fc9d
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/base/.cordova/config.json
@@ -0,0 +1,22 @@
+{
+ "id": "org.testing",
+ "name":"TestBase",
+ "lib": {
+ "android": {
+ "uri": "/some/junk/path",
+ "version": "dev",
+ "id": "cordova-android-dev"
+ },
+ "ios": {
+ "uri": "/some/junk/path",
+ "version": "dev",
+ "id": "cordova-ios-dev"
+ },
+ "wp8": {
+ "uri": "/some/junk/path",
+ "version": "dev",
+ "id": "cordova-wp8-dev"
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/merges/.svn
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/merges/.svn b/cordova-lib/spec-cordova/fixtures/base/merges/.svn
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/plugins/.svn
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/plugins/.svn b/cordova-lib/spec-cordova/fixtures/base/plugins/.svn
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/www/config.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/www/config.xml b/cordova-lib/spec-cordova/fixtures/base/www/config.xml
new file mode 100644
index 0000000..9e7b9e0
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/base/www/config.xml
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='utf-8'?>
+<widget id="org.testing" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>TestBase</name>
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+ <author email="dev@cordova.apache.org" href="http://cordova.io">
+ Apache Cordova Team
+ </author>
+ <content src="index.html" />
+ <access origin="*" />
+ <preference name="fullscreen" value="true" />
+ <preference name="webviewbounce" value="true" />
+</widget>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/www/css/index.css
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/www/css/index.css b/cordova-lib/spec-cordova/fixtures/base/www/css/index.css
new file mode 100644
index 0000000..51daa79
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/base/www/css/index.css
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+* {
+ -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
+}
+
+body {
+ -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
+ -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
+ -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
+ background-color:#E4E4E4;
+ background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+ background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+ background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+ background-image:-webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0, #A7A7A7),
+ color-stop(0.51, #E4E4E4)
+ );
+ background-attachment:fixed;
+ font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
+ font-size:12px;
+ height:100%;
+ margin:0px;
+ padding:0px;
+ text-transform:uppercase;
+ width:100%;
+}
+
+/* Portrait layout (default) */
+.app {
+ background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
+ position:absolute; /* position in the center of the screen */
+ left:50%;
+ top:50%;
+ height:50px; /* text area height */
+ width:225px; /* text area width */
+ text-align:center;
+ padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */
+ margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */
+ /* offset horizontal: half of text area width */
+}
+
+/* Landscape layout (with min-width) */
+@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
+ .app {
+ background-position:left center;
+ padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */
+ margin:-90px 0px 0px -198px; /* offset vertical: half of image height */
+ /* offset horizontal: half of image width and text area width */
+ }
+}
+
+h1 {
+ font-size:24px;
+ font-weight:normal;
+ margin:0px;
+ overflow:visible;
+ padding:0px;
+ text-align:center;
+}
+
+.event {
+ border-radius:4px;
+ -webkit-border-radius:4px;
+ color:#FFFFFF;
+ font-size:12px;
+ margin:0px 30px;
+ padding:2px 0px;
+}
+
+.event.listening {
+ background-color:#333333;
+ display:block;
+}
+
+.event.received {
+ background-color:#4B946A;
+ display:none;
+}
+
+@keyframes fade {
+ from { opacity: 1.0; }
+ 50% { opacity: 0.4; }
+ to { opacity: 1.0; }
+}
+
+@-webkit-keyframes fade {
+ from { opacity: 1.0; }
+ 50% { opacity: 0.4; }
+ to { opacity: 1.0; }
+}
+
+.blink {
+ animation:fade 3000ms infinite;
+ -webkit-animation:fade 3000ms infinite;
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/www/img/logo.png
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/www/img/logo.png b/cordova-lib/spec-cordova/fixtures/base/www/img/logo.png
new file mode 100644
index 0000000..9519e7d
Binary files /dev/null and b/cordova-lib/spec-cordova/fixtures/base/www/img/logo.png differ
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/www/index.html
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/www/index.html b/cordova-lib/spec-cordova/fixtures/base/www/index.html
new file mode 100644
index 0000000..bde5741
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/base/www/index.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <meta name="format-detection" content="telephone=no" />
+ <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
+ <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
+ <link rel="stylesheet" type="text/css" href="css/index.css" />
+ <title>Hello World</title>
+ </head>
+ <body>
+ <div class="app">
+ <h1>Apache Cordova</h1>
+ <div id="deviceready" class="blink">
+ <p class="event listening">Connecting to Device</p>
+ <p class="event received">Device is Ready</p>
+ </div>
+ </div>
+ <script type="text/javascript" src="cordova.js"></script>
+ <script type="text/javascript" src="js/index.js"></script>
+ <script type="text/javascript">
+ app.initialize();
+ </script>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/www/js/index.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/www/js/index.js b/cordova-lib/spec-cordova/fixtures/base/www/js/index.js
new file mode 100644
index 0000000..31d9064
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/base/www/js/index.js
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+var app = {
+ // Application Constructor
+ initialize: function() {
+ this.bindEvents();
+ },
+ // Bind Event Listeners
+ //
+ // Bind any events that are required on startup. Common events are:
+ // 'load', 'deviceready', 'offline', and 'online'.
+ bindEvents: function() {
+ document.addEventListener('deviceready', this.onDeviceReady, false);
+ },
+ // deviceready Event Handler
+ //
+ // The scope of 'this' is the event. In order to call the 'receivedEvent'
+ // function, we must explicity call 'app.receivedEvent(...);'
+ onDeviceReady: function() {
+ app.receivedEvent('deviceready');
+ },
+ // Update DOM on a Received Event
+ receivedEvent: function(id) {
+ var parentElement = document.getElementById(id);
+ var listeningElement = parentElement.querySelector('.listening');
+ var receivedElement = parentElement.querySelector('.received');
+
+ listeningElement.setAttribute('style', 'display:none;');
+ receivedElement.setAttribute('style', 'display:block;');
+
+ console.log('Received Event: ' + id);
+ }
+};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/base/www/spec.html
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/base/www/spec.html b/cordova-lib/spec-cordova/fixtures/base/www/spec.html
new file mode 100644
index 0000000..71f00de
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/base/www/spec.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+ <head>
+ <title>Jasmine Spec Runner</title>
+
+ <!-- jasmine source -->
+ <link rel="shortcut icon" type="image/png" href="spec/lib/jasmine-1.2.0/jasmine_favicon.png">
+ <link rel="stylesheet" type="text/css" href="spec/lib/jasmine-1.2.0/jasmine.css">
+ <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine.js"></script>
+ <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine-html.js"></script>
+
+ <!-- include source files here... -->
+ <script type="text/javascript" src="js/index.js"></script>
+
+ <!-- include spec files here... -->
+ <script type="text/javascript" src="spec/helper.js"></script>
+ <script type="text/javascript" src="spec/index.js"></script>
+
+ <script type="text/javascript">
+ (function() {
+ var jasmineEnv = jasmine.getEnv();
+ jasmineEnv.updateInterval = 1000;
+
+ var htmlReporter = new jasmine.HtmlReporter();
+
+ jasmineEnv.addReporter(htmlReporter);
+
+ jasmineEnv.specFilter = function(spec) {
+ return htmlReporter.specFilter(spec);
+ };
+
+ var currentWindowOnload = window.onload;
+
+ window.onload = function() {
+ if (currentWindowOnload) {
+ currentWindowOnload();
+ }
+ execJasmine();
+ };
+
+ function execJasmine() {
+ jasmineEnv.execute();
+ }
+ })();
+ </script>
+ </head>
+ <body>
+ <div id="stage" style="display:none;"></div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_bat/fail/fail.bat
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_bat/fail/fail.bat b/cordova-lib/spec-cordova/fixtures/hooks_bat/fail/fail.bat
new file mode 100644
index 0000000..a89b4c8
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_bat/fail/fail.bat
@@ -0,0 +1,2 @@
+@ECHO OFF
+EXIT /B 1
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_bat/test/.dotted.bat
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_bat/test/.dotted.bat b/cordova-lib/spec-cordova/fixtures/hooks_bat/test/.dotted.bat
new file mode 100644
index 0000000..ada7136
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_bat/test/.dotted.bat
@@ -0,0 +1,2 @@
+@ECHO OFF
+ECHO "Dotted files in hook dirs should not be called" > dotted_hook_should_not_fire.txt
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_bat/test/07.bat
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_bat/test/07.bat b/cordova-lib/spec-cordova/fixtures/hooks_bat/test/07.bat
new file mode 100644
index 0000000..a88c8c5
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_bat/test/07.bat
@@ -0,0 +1,3 @@
+@ECHO OFF
+rem ECHO this is script 0 in %~dp0
+ECHO b >> hooks_order.txt
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_bat/test/1.bat
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_bat/test/1.bat b/cordova-lib/spec-cordova/fixtures/hooks_bat/test/1.bat
new file mode 100644
index 0000000..be004c5
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_bat/test/1.bat
@@ -0,0 +1,5 @@
+@ECHO OFF
+rem ECHO this is script 1 in %~dp0
+ECHO a >> hooks_order.txt
+ECHO %1 > hooks_params.txt
+node -e "console.log(JSON.stringify(process.env, null, 2))" > hooks_env.json
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_sh/fail/fail.sh
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_sh/fail/fail.sh b/cordova-lib/spec-cordova/fixtures/hooks_sh/fail/fail.sh
new file mode 100755
index 0000000..379a4c9
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_sh/fail/fail.sh
@@ -0,0 +1 @@
+exit 1
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_sh/test/.dotted.sh
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_sh/test/.dotted.sh b/cordova-lib/spec-cordova/fixtures/hooks_sh/test/.dotted.sh
new file mode 100755
index 0000000..e5fa07f
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_sh/test/.dotted.sh
@@ -0,0 +1 @@
+echo "Dotted files in hook dirs should not be called" > dotted_hook_should_not_fire.txt
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_sh/test/07.sh
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_sh/test/07.sh b/cordova-lib/spec-cordova/fixtures/hooks_sh/test/07.sh
new file mode 100755
index 0000000..f410ee2
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_sh/test/07.sh
@@ -0,0 +1,2 @@
+#echo "this is script 0 in `pwd`";
+echo b >> hooks_order.txt
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/hooks_sh/test/1.sh
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/hooks_sh/test/1.sh b/cordova-lib/spec-cordova/fixtures/hooks_sh/test/1.sh
new file mode 100755
index 0000000..892869d
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/hooks_sh/test/1.sh
@@ -0,0 +1,4 @@
+#echo "this is script 1 in `pwd`";
+echo a >> hooks_order.txt
+echo $1 > hooks_params.txt
+node -e "console.log(JSON.stringify(process.env, null, 2))" > hooks_env.json
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/platforms/android-lib/VERSION
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/android-lib/VERSION b/cordova-lib/spec-cordova/fixtures/platforms/android-lib/VERSION
new file mode 100644
index 0000000..15a2799
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/android-lib/VERSION
@@ -0,0 +1 @@
+3.3.0
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/platforms/android-lib/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/android-lib/framework/assets/www/cordova.js b/cordova-lib/spec-cordova/fixtures/platforms/android-lib/framework/assets/www/cordova.js
new file mode 100644
index 0000000..91c51fc
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/android-lib/framework/assets/www/cordova.js
@@ -0,0 +1 @@
+This is a placeholder file.
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/platforms/android/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/android/AndroidManifest.xml b/cordova-lib/spec-cordova/fixtures/platforms/android/AndroidManifest.xml
new file mode 100644
index 0000000..be3f245
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/android/AndroidManifest.xml
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='utf-8'?>
+<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="org.testing" xmlns:android="http://schemas.android.com/apk/res/android">
+ <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="TestBase" android:theme="@android:style/Theme.Black.NoTitleBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+ <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
+</manifest>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b51e1c12/cordova-lib/spec-cordova/fixtures/platforms/android/assets/www/config.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/android/assets/www/config.xml b/cordova-lib/spec-cordova/fixtures/platforms/android/assets/www/config.xml
new file mode 100644
index 0000000..9e7b9e0
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/android/assets/www/config.xml
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='utf-8'?>
+<widget id="org.testing" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>TestBase</name>
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+ <author email="dev@cordova.apache.org" href="http://cordova.io">
+ Apache Cordova Team
+ </author>
+ <content src="index.html" />
+ <access origin="*" />
+ <preference name="fullscreen" value="true" />
+ <preference name="webviewbounce" value="true" />
+</widget>