├── .gitignore ├── .reviewboardrc ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── RELEASENOTES.md ├── VERSION ├── bin ├── android_sdk_version ├── android_sdk_version.bat ├── check_reqs ├── check_reqs.bat ├── create ├── create.bat ├── lib │ ├── android_sdk_version.js │ ├── check_reqs.js │ ├── create.js │ └── simpleargs.js ├── node_modules │ ├── .bin │ │ └── shjs │ ├── q │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── benchmark │ │ │ ├── compare-with-callbacks.js │ │ │ └── scenarios.js │ │ ├── package.json │ │ ├── q.js │ │ └── queue.js │ ├── shelljs │ │ ├── .documentup.json │ │ ├── .jshintrc │ │ ├── .npmignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin │ │ │ └── shjs │ │ ├── global.js │ │ ├── make.js │ │ ├── package.json │ │ ├── scripts │ │ │ ├── generate-docs.js │ │ │ └── run-tests.js │ │ ├── shell.js │ │ └── src │ │ │ ├── cat.js │ │ │ ├── cd.js │ │ │ ├── chmod.js │ │ │ ├── common.js │ │ │ ├── cp.js │ │ │ ├── dirs.js │ │ │ ├── echo.js │ │ │ ├── error.js │ │ │ ├── exec.js │ │ │ ├── find.js │ │ │ ├── grep.js │ │ │ ├── ls.js │ │ │ ├── mkdir.js │ │ │ ├── mv.js │ │ │ ├── popd.js │ │ │ ├── pushd.js │ │ │ ├── pwd.js │ │ │ ├── rm.js │ │ │ ├── sed.js │ │ │ ├── tempdir.js │ │ │ ├── test.js │ │ │ ├── to.js │ │ │ ├── toEnd.js │ │ │ └── which.js │ └── which │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin │ │ └── which │ │ ├── package.json │ │ └── which.js ├── templates │ ├── cordova │ │ ├── build │ │ ├── build.bat │ │ ├── clean │ │ ├── clean.bat │ │ ├── defaults.xml │ │ ├── lib │ │ │ ├── appinfo.js │ │ │ ├── build.js │ │ │ ├── device.js │ │ │ ├── emulator.js │ │ │ ├── exec.js │ │ │ ├── install-device │ │ │ ├── install-device.bat │ │ │ ├── install-emulator │ │ │ ├── install-emulator.bat │ │ │ ├── list-devices │ │ │ ├── list-devices.bat │ │ │ ├── list-emulator-images │ │ │ ├── list-emulator-images.bat │ │ │ ├── list-started-emulators │ │ │ ├── list-started-emulators.bat │ │ │ ├── log.js │ │ │ ├── run.js │ │ │ ├── spawn.js │ │ │ ├── start-emulator │ │ │ └── start-emulator.bat │ │ ├── log │ │ ├── log.bat │ │ ├── run │ │ ├── run.bat │ │ ├── version │ │ └── version.bat │ └── project │ │ ├── Activity.java │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── www │ │ │ ├── css │ │ │ └── index.css │ │ │ ├── img │ │ │ ├── cordova.png │ │ │ └── logo.png │ │ │ ├── index.html │ │ │ ├── js │ │ │ └── index.js │ │ │ ├── main.js │ │ │ └── master.css │ │ ├── build.gradle │ │ ├── custom_rules.xml │ │ ├── eclipse-project │ │ ├── eclipse-project-CLI │ │ ├── gitignore │ │ ├── project.properties │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── icon.png │ │ ├── drawable-land-hdpi │ │ │ └── screen.png │ │ ├── drawable-land-ldpi │ │ │ └── screen.png │ │ ├── drawable-land-mdpi │ │ │ └── screen.png │ │ ├── drawable-land-xhdpi │ │ │ └── screen.png │ │ ├── drawable-ldpi │ │ │ └── icon.png │ │ ├── drawable-mdpi │ │ │ └── icon.png │ │ ├── drawable-port-hdpi │ │ │ └── screen.png │ │ ├── drawable-port-ldpi │ │ │ └── screen.png │ │ ├── drawable-port-mdpi │ │ │ └── screen.png │ │ ├── drawable-port-xhdpi │ │ │ └── screen.png │ │ ├── drawable-xhdpi │ │ │ └── icon.png │ │ ├── drawable │ │ │ └── icon.png │ │ └── values │ │ │ └── strings.xml │ │ └── settings.gradle ├── update └── update.bat ├── framework ├── AndroidManifest.xml ├── ant.properties ├── assets │ └── www │ │ ├── cordova.js │ │ └── index.html ├── build.gradle ├── build.xml ├── default.properties ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ ├── drawable-mdpi │ │ └── icon.png │ ├── drawable │ │ └── splash.png │ ├── layout │ │ └── main.xml │ ├── values │ │ └── strings.xml │ └── xml │ │ └── config.xml ├── src │ ├── com │ │ └── squareup │ │ │ └── okhttp │ │ │ ├── Address.java │ │ │ ├── Connection.java │ │ │ ├── ConnectionPool.java │ │ │ ├── Dispatcher.java │ │ │ ├── Failure.java │ │ │ ├── HttpResponseCache.java │ │ │ ├── Job.java │ │ │ ├── MediaType.java │ │ │ ├── OkAuthenticator.java │ │ │ ├── OkHttpClient.java │ │ │ ├── OkResponseCache.java │ │ │ ├── Request.java │ │ │ ├── Response.java │ │ │ ├── ResponseSource.java │ │ │ ├── Route.java │ │ │ ├── RouteDatabase.java │ │ │ ├── TunnelRequest.java │ │ │ └── internal │ │ │ ├── AbstractOutputStream.java │ │ │ ├── Base64.java │ │ │ ├── DiskLruCache.java │ │ │ ├── Dns.java │ │ │ ├── FaultRecoveringOutputStream.java │ │ │ ├── NamedRunnable.java │ │ │ ├── Platform.java │ │ │ ├── StrictLineReader.java │ │ │ ├── Util.java │ │ │ ├── http │ │ │ ├── AbstractHttpInputStream.java │ │ │ ├── HeaderParser.java │ │ │ ├── HttpAuthenticator.java │ │ │ ├── HttpDate.java │ │ │ ├── HttpEngine.java │ │ │ ├── HttpTransport.java │ │ │ ├── HttpURLConnectionImpl.java │ │ │ ├── HttpsEngine.java │ │ │ ├── HttpsURLConnectionImpl.java │ │ │ ├── OkResponseCacheAdapter.java │ │ │ ├── Policy.java │ │ │ ├── RawHeaders.java │ │ │ ├── RequestHeaders.java │ │ │ ├── ResponseHeaders.java │ │ │ ├── RetryableOutputStream.java │ │ │ ├── RouteSelector.java │ │ │ ├── SpdyTransport.java │ │ │ ├── Transport.java │ │ │ └── UnknownLengthHttpInputStream.java │ │ │ ├── spdy │ │ │ ├── ErrorCode.java │ │ │ ├── FrameReader.java │ │ │ ├── FrameWriter.java │ │ │ ├── HeadersMode.java │ │ │ ├── Hpack.java │ │ │ ├── Http20Draft06.java │ │ │ ├── IncomingStreamHandler.java │ │ │ ├── NameValueBlockReader.java │ │ │ ├── Ping.java │ │ │ ├── Settings.java │ │ │ ├── Spdy3.java │ │ │ ├── SpdyConnection.java │ │ │ ├── SpdyStream.java │ │ │ └── Variant.java │ │ │ └── tls │ │ │ ├── DistinguishedNameParser.java │ │ │ └── OkHostnameVerifier.java │ └── org │ │ └── apache │ │ └── cordova │ │ ├── App.java │ │ ├── AuthenticationToken.java │ │ ├── CallbackContext.java │ │ ├── Config.java │ │ ├── ConfigXmlParser.java │ │ ├── CordovaActivity.java │ │ ├── CordovaApplication.java │ │ ├── CordovaArgs.java │ │ ├── CordovaBridge.java │ │ ├── CordovaChromeClient.java │ │ ├── CordovaInterface.java │ │ ├── CordovaPlugin.java │ │ ├── CordovaPreferences.java │ │ ├── CordovaResourceApi.java │ │ ├── CordovaUriHelper.java │ │ ├── CordovaWebView.java │ │ ├── CordovaWebViewClient.java │ │ ├── DirectoryManager.java │ │ ├── DroidGap.java │ │ ├── ExifHelper.java │ │ ├── ExposedJsApi.java │ │ ├── FileHelper.java │ │ ├── IceCreamCordovaWebViewClient.java │ │ ├── JSONUtils.java │ │ ├── LOG.java │ │ ├── LinearLayoutSoftKeyboardDetect.java │ │ ├── NativeToJsMessageQueue.java │ │ ├── PluginEntry.java │ │ ├── PluginManager.java │ │ ├── PluginResult.java │ │ ├── ScrollEvent.java │ │ └── Whitelist.java └── test │ └── org │ └── apache │ └── cordova │ ├── PreferenceNodeTest.java │ └── PreferenceSetTest.java ├── package.json ├── spec └── create.spec.js └── test ├── AndroidManifest.xml ├── README.md ├── ant.properties ├── assets └── www │ ├── backbuttonmultipage │ ├── index.html │ ├── sample2.html │ └── sample3.html │ ├── background │ ├── index.html │ └── index2.html │ ├── backgroundcolor │ └── index.html │ ├── basicauth │ └── index.html │ ├── cordova_plugins.js │ ├── fullscreen │ └── index.html │ ├── htmlnotfound │ └── error.html │ ├── iframe │ ├── index.html │ └── index2.html │ ├── index.html │ ├── jqmtabbackbutton │ ├── index.html │ ├── tab1.html │ ├── tab2.html │ └── tab3.html │ ├── lifecycle │ ├── index.html │ └── index2.html │ ├── main.js │ ├── master.css │ ├── menus │ └── index.html │ ├── splashscreen │ └── index.html │ ├── userwebview │ └── index.html │ ├── whitelist │ ├── index.html │ └── index2.html │ └── xhr │ └── index.html ├── build.xml ├── cordova ├── android_sdk_version ├── build ├── build.bat ├── check_reqs ├── clean ├── clean.bat ├── lib │ ├── android_sdk_version.js │ ├── appinfo.js │ ├── build.js │ ├── check_reqs.js │ ├── clean.js │ ├── device.js │ ├── emulator.js │ ├── exec.js │ ├── install-device │ ├── install-device.bat │ ├── install-emulator │ ├── install-emulator.bat │ ├── list-devices │ ├── list-devices.bat │ ├── list-emulator-images │ ├── list-emulator-images.bat │ ├── list-started-emulators │ ├── list-started-emulators.bat │ ├── log.js │ ├── run.js │ ├── start-emulator │ └── start-emulator.bat ├── log ├── log.bat ├── node_modules │ ├── .bin │ │ └── shjs │ ├── q │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── benchmark │ │ │ ├── compare-with-callbacks.js │ │ │ └── scenarios.js │ │ ├── package.json │ │ ├── q.js │ │ └── queue.js │ └── shelljs │ │ ├── .documentup.json │ │ ├── .jshintrc │ │ ├── .npmignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin │ │ └── shjs │ │ ├── global.js │ │ ├── make.js │ │ ├── package.json │ │ ├── scripts │ │ ├── generate-docs.js │ │ └── run-tests.js │ │ ├── shell.js │ │ └── src │ │ ├── cat.js │ │ ├── cd.js │ │ ├── chmod.js │ │ ├── common.js │ │ ├── cp.js │ │ ├── dirs.js │ │ ├── echo.js │ │ ├── error.js │ │ ├── exec.js │ │ ├── find.js │ │ ├── grep.js │ │ ├── ls.js │ │ ├── mkdir.js │ │ ├── mv.js │ │ ├── popd.js │ │ ├── pushd.js │ │ ├── pwd.js │ │ ├── rm.js │ │ ├── sed.js │ │ ├── tempdir.js │ │ ├── test.js │ │ ├── to.js │ │ ├── toEnd.js │ │ └── which.js ├── run ├── run.bat ├── version └── version.bat ├── proguard.cfg ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-ldpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable │ ├── icon.png │ └── sandy.jpg ├── layout │ └── main.xml ├── values │ └── strings.xml └── xml │ └── config.xml └── src └── org └── apache └── cordova ├── pluginApi └── pluginStub.java └── test ├── ActivityPlugin.java ├── CordovaDriverAction.java ├── CordovaWebViewTestActivity.java ├── MainTestActivity.java ├── SabotagedActivity.java ├── backbuttonmultipage.java ├── background.java ├── backgroundcolor.java ├── basicauth.java ├── errorurl.java ├── fullscreen.java ├── htmlnotfound.java ├── iframe.java ├── junit ├── BackButtonMultiPageTest.java ├── CordovaActivityTest.java ├── CordovaResourceApiTest.java ├── CordovaTest.java ├── ErrorUrlTest.java ├── FixWebView.java ├── HtmlNotFoundTest.java ├── IFrameTest.java ├── IntentUriOverrideTest.java ├── LifecycleTest.java ├── MenuTest.java ├── PluginManagerTest.java ├── SplashscreenTest.java └── XhrTest.java ├── lifecycle.java ├── loading.java ├── menus.java ├── splashscreen.java ├── tests.java ├── timeout.java ├── userwebview.java ├── util └── Purity.java ├── whitelist.java └── xhr.java /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | default.properties 3 | gen 4 | assets/www/cordova.js 5 | framework/assets/www/.tmp* 6 | local.properties 7 | framework/lib 8 | proguard.cfg 9 | proguard.cfg 10 | proguard-project.txt 11 | framework/bin 12 | framework/test/org/apache/cordova/*.class 13 | framework/assets/www/.DS_Store 14 | framework/assets/www/cordova-*.js 15 | framework/assets/www/phonegap-*.js 16 | framework/libs 17 | framework/javadoc-public 18 | framework/javadoc-private 19 | framework/xwalk_core_library 20 | framework/xwalk_shared_library 21 | test/libs 22 | example 23 | ./test 24 | test/bin 25 | test/assets/www/.tmp* 26 | test/assets/www/cordova.js 27 | test/cordova/plugins/org.apache.cordova.device/www/device.js 28 | test/cordova/plugins/org.apache.cordova.device/src/android/Device.java 29 | tmp/** 30 | .metadata 31 | tmp/**/* 32 | Thumbs.db 33 | Desktop.ini 34 | *.tmp 35 | *.bak 36 | *.swp 37 | *.class 38 | *.jar 39 | # IntelliJ IDEA files 40 | *.iml 41 | .idea 42 | # Eclipse files 43 | .classpath 44 | .project 45 | .settings 46 | -------------------------------------------------------------------------------- /.reviewboardrc: -------------------------------------------------------------------------------- 1 | # 2 | # Settings for post-review (used for uploading diffs to reviews.apache.org). 3 | # 4 | GUESS_FIELDS = True 5 | OPEN_BROWSER = True 6 | TARGET_GROUPS = 'cordova' 7 | REVIEWBOARD_URL = 'http://reviews.apache.org' 8 | 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Contributing to Apache Cordova 23 | 24 | Anyone can contribute to Cordova. And we need your contributions. 25 | 26 | There are multiple ways to contribute: report bugs, improve the docs, and 27 | contribute code. 28 | 29 | For instructions on this, start with the 30 | [contribution overview](http://cordova.apache.org/#contribute). 31 | 32 | The details are explained there, but the important items are: 33 | - Sign and submit an Apache ICLA (Contributor License Agreement). 34 | - Have a Jira issue open that corresponds to your contribution. 35 | - Run the tests so your patch doesn't break existing functionality. 36 | 37 | We look forward to your contributions! 38 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2014 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org) 6 | 7 | ========================================================================= 8 | == NOTICE file corresponding to the section 4 d of == 9 | == the Apache License, Version 2.0, == 10 | == in this case for the Android-specific code. == 11 | ========================================================================= 12 | 13 | This product includes software developed as part of 14 | The Android Open Source Project (http://source.android.com). 15 | 16 | This software includes software developed at Square, Inc. 17 | Copyright (C) 2013 Square, Inc. 18 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 3.6.3 2 | -------------------------------------------------------------------------------- /bin/android_sdk_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var android_sdk_version = require('./lib/android_sdk_version'); 23 | 24 | android_sdk_version.run().done(null, function(err) { 25 | console.log(err); 26 | process.exit(2); 27 | }); 28 | 29 | 30 | -------------------------------------------------------------------------------- /bin/android_sdk_version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0android_sdk_version" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'android_sdk_version' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/check_reqs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var check_reqs = require('./lib/check_reqs'); 23 | 24 | check_reqs.run().done( 25 | function success() { 26 | console.log('Looks like your environment fully supports cordova-android development!'); 27 | }, function fail(err) { 28 | console.log(err); 29 | process.exit(2); 30 | } 31 | ); 32 | -------------------------------------------------------------------------------- /bin/check_reqs.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0check_reqs" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/create.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0create" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'create' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/lib/simpleargs.js: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | exports.getArgs = function(argv) { 21 | var ret = {}; 22 | var posArgs = []; 23 | for (var i = 2, arg; arg = argv[i] || i < argv.length; ++i) { 24 | if (/^--/.exec(arg)) { 25 | if (arg.indexOf("=") != -1) { 26 | var arr = arg.split("="); 27 | ret[arr[0]] = arr[1]; 28 | } else { 29 | ret[arg] = true; 30 | } 31 | } else { 32 | posArgs.push(arg); 33 | } 34 | } 35 | ret._ = posArgs; 36 | return ret; 37 | }; 38 | -------------------------------------------------------------------------------- /bin/node_modules/.bin/shjs: -------------------------------------------------------------------------------- 1 | ../shelljs/bin/shjs -------------------------------------------------------------------------------- /bin/node_modules/q/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright 2009–2012 Kristopher Michael Kowal. All rights reserved. 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /bin/node_modules/q/benchmark/scenarios.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var Q = require("../q"); 4 | 5 | suite("Chaining", function () { 6 | var numberToChain = 1000; 7 | 8 | bench("Chaining many already-fulfilled promises together", function (done) { 9 | var currentPromise = Q(); 10 | for (var i = 0; i < numberToChain; ++i) { 11 | currentPromise = currentPromise.then(function () { 12 | return Q(); 13 | }); 14 | } 15 | 16 | currentPromise.then(done); 17 | }); 18 | 19 | bench("Chaining and then fulfilling the end of the chain", function (done) { 20 | var deferred = Q.defer(); 21 | 22 | var currentPromise = deferred.promise; 23 | for (var i = 0; i < numberToChain; ++i) { 24 | (function () { 25 | var promiseToReturn = currentPromise; 26 | currentPromise = Q().then(function () { 27 | return promiseToReturn; 28 | }); 29 | }()); 30 | } 31 | 32 | currentPromise.then(done); 33 | 34 | deferred.resolve(); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /bin/node_modules/q/queue.js: -------------------------------------------------------------------------------- 1 | 2 | var Q = require("./q"); 3 | 4 | module.exports = Queue; 5 | function Queue() { 6 | var ends = Q.defer(); 7 | var closed = Q.defer(); 8 | return { 9 | put: function (value) { 10 | var next = Q.defer(); 11 | ends.resolve({ 12 | head: value, 13 | tail: next.promise 14 | }); 15 | ends.resolve = next.resolve; 16 | }, 17 | get: function () { 18 | var result = ends.promise.get("head"); 19 | ends.promise = ends.promise.get("tail"); 20 | return result.fail(function (error) { 21 | closed.resolve(error); 22 | throw error; 23 | }); 24 | }, 25 | closed: closed.promise, 26 | close: function (error) { 27 | error = error || new Error("Can't get value from closed queue"); 28 | var end = {head: Q.reject(error)}; 29 | end.tail = end; 30 | ends.resolve(end); 31 | return closed.promise; 32 | } 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/.documentup.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ShellJS", 3 | "twitter": [ 4 | "r2r" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "loopfunc": true, 3 | "sub": true, 4 | "undef": true, 5 | "unused": true, 6 | "node": true 7 | } -------------------------------------------------------------------------------- /bin/node_modules/shelljs/.npmignore: -------------------------------------------------------------------------------- 1 | test/ 2 | tmp/ -------------------------------------------------------------------------------- /bin/node_modules/shelljs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | - "0.11" 6 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Artur Adib 2 | All rights reserved. 3 | 4 | You may use this project under the terms of the New BSD license as follows: 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Artur Adib nor the 14 | names of the contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/bin/shjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | if (process.argv.length < 3) { 5 | console.log('ShellJS: missing argument (script name)'); 6 | console.log(); 7 | process.exit(1); 8 | } 9 | 10 | var args, 11 | scriptName = process.argv[2]; 12 | env['NODE_PATH'] = __dirname + '/../..'; 13 | 14 | if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) { 15 | if (test('-f', scriptName + '.js')) 16 | scriptName += '.js'; 17 | if (test('-f', scriptName + '.coffee')) 18 | scriptName += '.coffee'; 19 | } 20 | 21 | if (!test('-f', scriptName)) { 22 | console.log('ShellJS: script not found ('+scriptName+')'); 23 | console.log(); 24 | process.exit(1); 25 | } 26 | 27 | args = process.argv.slice(3); 28 | 29 | for (var i = 0, l = args.length; i < l; i++) { 30 | if (args[i][0] !== "-"){ 31 | args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words 32 | } 33 | } 34 | 35 | if (scriptName.match(/\.coffee$/)) { 36 | // 37 | // CoffeeScript 38 | // 39 | if (which('coffee')) { 40 | exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true }); 41 | } else { 42 | console.log('ShellJS: CoffeeScript interpreter not found'); 43 | console.log(); 44 | process.exit(1); 45 | } 46 | } else { 47 | // 48 | // JavaScript 49 | // 50 | exec('node ' + scriptName + ' ' + args.join(' '), { async: true }); 51 | } 52 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/global.js: -------------------------------------------------------------------------------- 1 | var shell = require('./shell.js'); 2 | for (var cmd in shell) 3 | global[cmd] = shell[cmd]; 4 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/make.js: -------------------------------------------------------------------------------- 1 | require('./global'); 2 | 3 | global.config.fatal = true; 4 | global.target = {}; 5 | 6 | // This ensures we only execute the script targets after the entire script has 7 | // been evaluated 8 | var args = process.argv.slice(2); 9 | setTimeout(function() { 10 | var t; 11 | 12 | if (args.length === 1 && args[0] === '--help') { 13 | console.log('Available targets:'); 14 | for (t in global.target) 15 | console.log(' ' + t); 16 | return; 17 | } 18 | 19 | // Wrap targets to prevent duplicate execution 20 | for (t in global.target) { 21 | (function(t, oldTarget){ 22 | 23 | // Wrap it 24 | global.target[t] = function(force) { 25 | if (oldTarget.done && !force) 26 | return; 27 | oldTarget.done = true; 28 | return oldTarget.apply(oldTarget, arguments); 29 | }; 30 | 31 | })(t, global.target[t]); 32 | } 33 | 34 | // Execute desired targets 35 | if (args.length > 0) { 36 | args.forEach(function(arg) { 37 | if (arg in global.target) 38 | global.target[arg](); 39 | else { 40 | console.log('no such target: ' + arg); 41 | } 42 | }); 43 | } else if ('all' in global.target) { 44 | global.target.all(); 45 | } 46 | 47 | }, 0); 48 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/scripts/generate-docs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | echo('Appending docs to README.md'); 5 | 6 | cd(__dirname + '/..'); 7 | 8 | // Extract docs from shell.js 9 | var docs = grep('//@', 'shell.js'); 10 | 11 | docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) { 12 | var file = path.match('.js$') ? path : path+'.js'; 13 | return grep('//@', file); 14 | }); 15 | 16 | // Remove '//@' 17 | docs = docs.replace(/\/\/\@ ?/g, ''); 18 | // Append docs to README 19 | sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md'); 20 | 21 | echo('All done.'); 22 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/scripts/run-tests.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | var path = require('path'); 5 | 6 | var failed = false; 7 | 8 | // 9 | // Lint 10 | // 11 | JSHINT_BIN = './node_modules/jshint/bin/jshint'; 12 | cd(__dirname + '/..'); 13 | 14 | if (!test('-f', JSHINT_BIN)) { 15 | echo('JSHint not found. Run `npm install` in the root dir first.'); 16 | exit(1); 17 | } 18 | 19 | if (exec(JSHINT_BIN + ' *.js test/*.js').code !== 0) { 20 | failed = true; 21 | echo('*** JSHINT FAILED! (return code != 0)'); 22 | echo(); 23 | } else { 24 | echo('All JSHint tests passed'); 25 | echo(); 26 | } 27 | 28 | // 29 | // Unit tests 30 | // 31 | cd(__dirname + '/../test'); 32 | ls('*.js').forEach(function(file) { 33 | echo('Running test:', file); 34 | if (exec('node ' + file).code !== 123) { // 123 avoids false positives (e.g. premature exit) 35 | failed = true; 36 | echo('*** TEST FAILED! (missing exit code "123")'); 37 | echo(); 38 | } 39 | }); 40 | 41 | if (failed) { 42 | echo(); 43 | echo('*******************************************************'); 44 | echo('WARNING: Some tests did not pass!'); 45 | echo('*******************************************************'); 46 | exit(1); 47 | } else { 48 | echo(); 49 | echo('All tests passed.'); 50 | } 51 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/cat.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### cat(file [, file ...]) 6 | //@ ### cat(file_array) 7 | //@ 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ var str = cat('file*.txt'); 12 | //@ var str = cat('file1', 'file2'); 13 | //@ var str = cat(['file1', 'file2']); // same as above 14 | //@ ``` 15 | //@ 16 | //@ Returns a string containing the given file, or a concatenated string 17 | //@ containing the files if more than one file is given (a new line character is 18 | //@ introduced between each file). Wildcard `*` accepted. 19 | function _cat(options, files) { 20 | var cat = ''; 21 | 22 | if (!files) 23 | common.error('no paths given'); 24 | 25 | if (typeof files === 'string') 26 | files = [].slice.call(arguments, 1); 27 | // if it's array leave it as it is 28 | 29 | files = common.expand(files); 30 | 31 | files.forEach(function(file) { 32 | if (!fs.existsSync(file)) 33 | common.error('no such file or directory: ' + file); 34 | 35 | cat += fs.readFileSync(file, 'utf8') + '\n'; 36 | }); 37 | 38 | if (cat[cat.length-1] === '\n') 39 | cat = cat.substring(0, cat.length-1); 40 | 41 | return common.ShellString(cat); 42 | } 43 | module.exports = _cat; 44 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/cd.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var common = require('./common'); 3 | 4 | //@ 5 | //@ ### cd('dir') 6 | //@ Changes to directory `dir` for the duration of the script 7 | function _cd(options, dir) { 8 | if (!dir) 9 | common.error('directory not specified'); 10 | 11 | if (!fs.existsSync(dir)) 12 | common.error('no such file or directory: ' + dir); 13 | 14 | if (!fs.statSync(dir).isDirectory()) 15 | common.error('not a directory: ' + dir); 16 | 17 | process.chdir(dir); 18 | } 19 | module.exports = _cd; 20 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/echo.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | 3 | //@ 4 | //@ ### echo(string [,string ...]) 5 | //@ 6 | //@ Examples: 7 | //@ 8 | //@ ```javascript 9 | //@ echo('hello world'); 10 | //@ var str = echo('hello world'); 11 | //@ ``` 12 | //@ 13 | //@ Prints string to stdout, and returns string with additional utility methods 14 | //@ like `.to()`. 15 | function _echo() { 16 | var messages = [].slice.call(arguments, 0); 17 | console.log.apply(this, messages); 18 | return common.ShellString(messages.join(' ')); 19 | } 20 | module.exports = _echo; 21 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/error.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | 3 | //@ 4 | //@ ### error() 5 | //@ Tests if error occurred in the last command. Returns `null` if no error occurred, 6 | //@ otherwise returns string explaining the error 7 | function error() { 8 | return common.state.error; 9 | }; 10 | module.exports = error; 11 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/find.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var common = require('./common'); 3 | var _ls = require('./ls'); 4 | 5 | //@ 6 | //@ ### find(path [,path ...]) 7 | //@ ### find(path_array) 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ find('src', 'lib'); 12 | //@ find(['src', 'lib']); // same as above 13 | //@ find('.').filter(function(file) { return file.match(/\.js$/); }); 14 | //@ ``` 15 | //@ 16 | //@ Returns array of all files (however deep) in the given paths. 17 | //@ 18 | //@ The main difference from `ls('-R', path)` is that the resulting file names 19 | //@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`. 20 | function _find(options, paths) { 21 | if (!paths) 22 | common.error('no path specified'); 23 | else if (typeof paths === 'object') 24 | paths = paths; // assume array 25 | else if (typeof paths === 'string') 26 | paths = [].slice.call(arguments, 1); 27 | 28 | var list = []; 29 | 30 | function pushFile(file) { 31 | if (common.platform === 'win') 32 | file = file.replace(/\\/g, '/'); 33 | list.push(file); 34 | } 35 | 36 | // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs 37 | // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory 38 | 39 | paths.forEach(function(file) { 40 | pushFile(file); 41 | 42 | if (fs.statSync(file).isDirectory()) { 43 | _ls('-RA', file+'/*').forEach(function(subfile) { 44 | pushFile(subfile); 45 | }); 46 | } 47 | }); 48 | 49 | return list; 50 | } 51 | module.exports = _find; 52 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/grep.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### grep([options ,] regex_filter, file [, file ...]) 6 | //@ ### grep([options ,] regex_filter, file_array) 7 | //@ Available options: 8 | //@ 9 | //@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. 10 | //@ 11 | //@ Examples: 12 | //@ 13 | //@ ```javascript 14 | //@ grep('-v', 'GLOBAL_VARIABLE', '*.js'); 15 | //@ grep('GLOBAL_VARIABLE', '*.js'); 16 | //@ ``` 17 | //@ 18 | //@ Reads input string from given files and returns a string containing all lines of the 19 | //@ file that match the given `regex_filter`. Wildcard `*` accepted. 20 | function _grep(options, regex, files) { 21 | options = common.parseOptions(options, { 22 | 'v': 'inverse' 23 | }); 24 | 25 | if (!files) 26 | common.error('no paths given'); 27 | 28 | if (typeof files === 'string') 29 | files = [].slice.call(arguments, 2); 30 | // if it's array leave it as it is 31 | 32 | files = common.expand(files); 33 | 34 | var grep = ''; 35 | files.forEach(function(file) { 36 | if (!fs.existsSync(file)) { 37 | common.error('no such file or directory: ' + file, true); 38 | return; 39 | } 40 | 41 | var contents = fs.readFileSync(file, 'utf8'), 42 | lines = contents.split(/\r*\n/); 43 | lines.forEach(function(line) { 44 | var matched = line.match(regex); 45 | if ((options.inverse && !matched) || (!options.inverse && matched)) 46 | grep += line + '\n'; 47 | }); 48 | }); 49 | 50 | return common.ShellString(grep); 51 | } 52 | module.exports = _grep; 53 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/popd.js: -------------------------------------------------------------------------------- 1 | // see dirs.js -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/pushd.js: -------------------------------------------------------------------------------- 1 | // see dirs.js -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/pwd.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var common = require('./common'); 3 | 4 | //@ 5 | //@ ### pwd() 6 | //@ Returns the current directory. 7 | function _pwd(options) { 8 | var pwd = path.resolve(process.cwd()); 9 | return common.ShellString(pwd); 10 | } 11 | module.exports = _pwd; 12 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/sed.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### sed([options ,] search_regex, replace_str, file) 6 | //@ Available options: 7 | //@ 8 | //@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ 9 | //@ 10 | //@ Examples: 11 | //@ 12 | //@ ```javascript 13 | //@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js'); 14 | //@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); 15 | //@ ``` 16 | //@ 17 | //@ Reads an input string from `file` and performs a JavaScript `replace()` on the input 18 | //@ using the given search regex and replacement string. Returns the new string after replacement. 19 | function _sed(options, regex, replacement, file) { 20 | options = common.parseOptions(options, { 21 | 'i': 'inplace' 22 | }); 23 | 24 | if (typeof replacement === 'string') 25 | replacement = replacement; // no-op 26 | else if (typeof replacement === 'number') 27 | replacement = replacement.toString(); // fallback 28 | else 29 | common.error('invalid replacement string'); 30 | 31 | if (!file) 32 | common.error('no file given'); 33 | 34 | if (!fs.existsSync(file)) 35 | common.error('no such file or directory: ' + file); 36 | 37 | var result = fs.readFileSync(file, 'utf8').replace(regex, replacement); 38 | if (options.inplace) 39 | fs.writeFileSync(file, result, 'utf8'); 40 | 41 | return common.ShellString(result); 42 | } 43 | module.exports = _sed; 44 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/to.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | 5 | //@ 6 | //@ ### 'string'.to(file) 7 | //@ 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ cat('input.txt').to('output.txt'); 12 | //@ ``` 13 | //@ 14 | //@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as 15 | //@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ 16 | function _to(options, file) { 17 | if (!file) 18 | common.error('wrong arguments'); 19 | 20 | if (!fs.existsSync( path.dirname(file) )) 21 | common.error('no such file or directory: ' + path.dirname(file)); 22 | 23 | try { 24 | fs.writeFileSync(file, this.toString(), 'utf8'); 25 | } catch(e) { 26 | common.error('could not write to file (code '+e.code+'): '+file, true); 27 | } 28 | } 29 | module.exports = _to; 30 | -------------------------------------------------------------------------------- /bin/node_modules/shelljs/src/toEnd.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | 5 | //@ 6 | //@ ### 'string'.toEnd(file) 7 | //@ 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ cat('input.txt').toEnd('output.txt'); 12 | //@ ``` 13 | //@ 14 | //@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as 15 | //@ those returned by `cat`, `grep`, etc). 16 | function _toEnd(options, file) { 17 | if (!file) 18 | common.error('wrong arguments'); 19 | 20 | if (!fs.existsSync( path.dirname(file) )) 21 | common.error('no such file or directory: ' + path.dirname(file)); 22 | 23 | try { 24 | fs.appendFileSync(file, this.toString(), 'utf8'); 25 | } catch(e) { 26 | common.error('could not append to file (code '+e.code+'): '+file, true); 27 | } 28 | } 29 | module.exports = _toEnd; 30 | -------------------------------------------------------------------------------- /bin/node_modules/which/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter. 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /bin/node_modules/which/README.md: -------------------------------------------------------------------------------- 1 | The "which" util from npm's guts. 2 | 3 | Finds the first instance of a specified executable in the PATH 4 | environment variable. Does not cache the results, so `hash -r` is not 5 | needed when the PATH changes. 6 | -------------------------------------------------------------------------------- /bin/node_modules/which/bin/which: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var which = require("../") 3 | if (process.argv.length < 3) { 4 | console.error("Usage: which ") 5 | process.exit(1) 6 | } 7 | 8 | which(process.argv[2], function (er, thing) { 9 | if (er) { 10 | console.error(er.message) 11 | process.exit(er.errno || 127) 12 | } 13 | console.log(thing) 14 | }) 15 | -------------------------------------------------------------------------------- /bin/node_modules/which/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Isaac Z. Schlueter", 4 | "email": "i@izs.me", 5 | "url": "http://blog.izs.me" 6 | }, 7 | "name": "which", 8 | "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", 9 | "version": "1.0.5", 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/isaacs/node-which.git" 13 | }, 14 | "main": "which.js", 15 | "bin": { 16 | "which": "./bin/which" 17 | }, 18 | "engines": { 19 | "node": "*" 20 | }, 21 | "dependencies": {}, 22 | "devDependencies": {}, 23 | "readme": "The \"which\" util from npm's guts.\n\nFinds the first instance of a specified executable in the PATH\nenvironment variable. Does not cache the results, so `hash -r` is not\nneeded when the PATH changes.\n", 24 | "readmeFilename": "README.md", 25 | "bugs": { 26 | "url": "https://github.com/isaacs/node-which/issues" 27 | }, 28 | "homepage": "https://github.com/isaacs/node-which", 29 | "_id": "which@1.0.5", 30 | "_from": "which@" 31 | } 32 | -------------------------------------------------------------------------------- /bin/templates/cordova/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var build = require('./lib/build'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Support basic help commands 27 | if(args[2] == '--help' || 28 | args[2] == '/?' || 29 | args[2] == '-h' || 30 | args[2] == 'help' || 31 | args[2] == '-help' || 32 | args[2] == '/help') { 33 | build.help(); 34 | } else { 35 | reqs.run().done(function() { 36 | return build.run(args.slice(2)); 37 | }, function(err) { 38 | console.error(err); 39 | process.exit(2); 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /bin/templates/cordova/build.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0build" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var build = require('./lib/build'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | var path = require('path'); 26 | 27 | // Support basic help commands 28 | if(args[2] == '--help' || 29 | args[2] == '/?' || 30 | args[2] == '-h' || 31 | args[2] == 'help' || 32 | args[2] == '-help' || 33 | args[2] == '/help') { 34 | console.log('Usage: ' + path.relative(process.cwd(), process.argv[1])); 35 | console.log('Cleans the project directory.'); 36 | process.exit(0); 37 | } else { 38 | reqs.run().done(function() { 39 | return build.runClean(args.slice(2)); 40 | }, function(err) { 41 | console.error(err); 42 | process.exit(2); 43 | }); 44 | } 45 | -------------------------------------------------------------------------------- /bin/templates/cordova/clean.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0clean" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/exec.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var child_process = require('child_process'), 23 | Q = require('q'); 24 | 25 | // Takes a command and optional current working directory. 26 | // Returns a promise that either resolves with the stdout, or 27 | // rejects with an error message and the stderr. 28 | module.exports = function(cmd, opt_cwd) { 29 | var d = Q.defer(); 30 | try { 31 | child_process.exec(cmd, {cwd: opt_cwd, maxBuffer: 1024000}, function(err, stdout, stderr) { 32 | if (err) d.reject('Error executing "' + cmd + '": ' + stderr); 33 | else d.resolve(stdout); 34 | }); 35 | } catch(e) { 36 | console.error('error caught: ' + e); 37 | d.reject(e); 38 | } 39 | return d.promise; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/install-device: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var device = require('./device'), 23 | args = process.argv; 24 | 25 | if(args.length > 2) { 26 | var install_target; 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | device.install(install_target).done(null, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | } else { 34 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 35 | process.exit(2); 36 | } 37 | } else { 38 | device.install().done(null, function(err) { 39 | console.error('ERROR: ' + err); 40 | process.exit(2); 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/install-device.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-device" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/lib/install-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | var install_target; 26 | if(args.length > 2) { 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | } else { 30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 31 | process.exit(2); 32 | } 33 | } 34 | 35 | emulator.install(install_target).done(null, function(err) { 36 | console.error('ERROR: ' + err); 37 | process.exit(2); 38 | }); 39 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/install-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/lib/list-devices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var devices = require('./device'); 23 | 24 | // Usage support for when args are given 25 | devices.list().done(function(device_list) { 26 | device_list && device_list.forEach(function(dev) { 27 | console.log(dev); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | 34 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/list-devices.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-devices" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | emulators.list_images().done(function(emulator_list) { 26 | emulator_list && emulator_list.forEach(function(emu) { 27 | console.log(emu.name); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/list-emulator-images.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-emulator-images" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | emulators.list_started().done(function(emulator_list) { 26 | emulator_list && emulator_list.forEach(function(emu) { 27 | console.log(emu); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/list-started-emulators.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-started-emulators" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/lib/start-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | var install_target; 26 | if(args.length > 2) { 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | } else { 30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 31 | process.exit(2); 32 | } 33 | } 34 | 35 | emulator.start(install_target).done(null, function(err) { 36 | console.error('ERROR: ' + err); 37 | process.exit(2); 38 | }); 39 | 40 | -------------------------------------------------------------------------------- /bin/templates/cordova/lib/start-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0start-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var log = require('./lib/log'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Usage support for when args are given 27 | if(args.length > 2) { 28 | log.help(); 29 | } else { 30 | reqs.run().done(function() { 31 | return log.run(); 32 | }, function(err) { 33 | console.error('ERROR: ' + err); 34 | process.exit(2); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /bin/templates/cordova/log.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0log" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var run = require('./lib/run'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Support basic help commands 27 | if (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || 28 | args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { 29 | run.help(args); 30 | } else { 31 | reqs.run().done(function() { 32 | return run.run(args); 33 | }, function(err) { 34 | console.error('ERROR: ' + err); 35 | process.exit(2); 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /bin/templates/cordova/run.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0run" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /bin/templates/cordova/version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | // Coho updates this line: 23 | var VERSION = "3.6.3"; 24 | 25 | console.log(VERSION); 26 | -------------------------------------------------------------------------------- /bin/templates/cordova/version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0version" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/templates/project/Activity.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package __ID__; 21 | 22 | import android.os.Bundle; 23 | import org.apache.cordova.*; 24 | 25 | public class __ACTIVITY__ extends CordovaActivity 26 | { 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) 29 | { 30 | super.onCreate(savedInstanceState); 31 | } 32 | 33 | @Override 34 | protected void onXWalkReady() { 35 | super.init(); 36 | // Set by in config.xml 37 | loadUrl(launchUrl); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bin/templates/project/assets/www/img/cordova.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/assets/www/img/cordova.png -------------------------------------------------------------------------------- /bin/templates/project/assets/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/assets/www/img/logo.png -------------------------------------------------------------------------------- /bin/templates/project/custom_rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /bin/templates/project/eclipse-project: -------------------------------------------------------------------------------- 1 | 2 | 3 | __NAME__ 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | 35 | 1388696068187 36 | 37 | 10 38 | 39 | org.eclipse.ui.ide.multiFilter 40 | 1.0-name-matches-false-true-CordovaLib|platform_www|cordova 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /bin/templates/project/gitignore: -------------------------------------------------------------------------------- 1 | # Non-project-specific build files: 2 | build.xml 3 | local.properties 4 | /gradlew 5 | /gradlew.bat 6 | /gradle 7 | # Ant builds 8 | ant-built 9 | ant-gen 10 | # Eclipse builds 11 | gen 12 | out 13 | # Gradle builds 14 | /build 15 | -------------------------------------------------------------------------------- /bin/templates/project/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | android.library.reference.1=CordovaLib 14 | # Project target. 15 | target=This_gets_replaced 16 | -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-land-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-land-hdpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-land-ldpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-land-ldpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-land-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-land-mdpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-land-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-land-xhdpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-port-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-port-hdpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-port-ldpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-port-ldpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-port-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-port-mdpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-port-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-port-xhdpi/screen.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /bin/templates/project/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/bin/templates/project/res/drawable/icon.png -------------------------------------------------------------------------------- /bin/templates/project/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | __NAME__ 5 | 6 | @string/app_name 7 | 8 | @string/launcher_name 9 | 10 | -------------------------------------------------------------------------------- /bin/templates/project/settings.gradle: -------------------------------------------------------------------------------- 1 | import java.util.regex.Pattern 2 | 3 | def getProjectList() { 4 | def manifestFile = file("project.properties") 5 | def pattern = Pattern.compile("android.library.reference.(\\d+)\\s*=\\s*(.*)") 6 | def matcher = pattern.matcher(manifestFile.getText()) 7 | def projects = [] 8 | while (matcher.find()) { 9 | projects.add(":" + matcher.group(2).replace("/",":")) 10 | } 11 | return projects 12 | } 13 | 14 | for (subproject in getProjectList()) { 15 | include subproject 16 | } 17 | 18 | include ':' 19 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | var path = require('path'); 22 | var create = require('./lib/create'); 23 | var args = require('./lib/simpleargs').getArgs(process.argv); 24 | 25 | if (args['--help'] || args._.length === 0) { 26 | console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' [--shared]'); 27 | console.log(' --shared will use the CordovaLib project directly instead of making a copy.'); 28 | console.log(' --xwalk-shared-library will use Crosswalk shared mode to package the project that without xwalk so library.'); 29 | process.exit(1); 30 | } 31 | if (args['--shared'] && args['--xwalk-shared-library']) { 32 | console.log(' --xwalk-shared-library do not support --shared.'); 33 | process.exit(1); 34 | } 35 | 36 | create.updateProject(args._[0], args['--shared'], args['--xwalk-shared-library']).done(); 37 | 38 | -------------------------------------------------------------------------------- /bin/update.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0update" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'update' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /framework/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /framework/ant.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | # 18 | # This file is used to override default values used by the Ant build system. 19 | # 20 | # This file must be checked in Version Control Systems, as it is 21 | # integral to the build system of your project. 22 | 23 | # This file is only used by the Ant script. 24 | 25 | # You can use this to override default values such as 26 | # 'source.dir' for the location of your java source folder and 27 | # 'out.dir' for the location of your output folder. 28 | 29 | # You can also use it define how the release builds are signed by declaring 30 | # the following properties: 31 | # 'key.store' for the location of your keystore and 32 | # 'key.alias' for the name of the key to use. 33 | # The password will be asked during the build when you use the 'release' target. 34 | 35 | -------------------------------------------------------------------------------- /framework/assets/www/index.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /framework/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | 21 | 22 | buildscript { 23 | repositories { 24 | mavenCentral() 25 | } 26 | 27 | dependencies { 28 | classpath 'com.android.tools.build:gradle:0.10.+' 29 | } 30 | } 31 | 32 | apply plugin: 'android-library' 33 | 34 | android { 35 | compileSdkVersion 19 36 | buildToolsVersion "19.0.0" 37 | 38 | compileOptions { 39 | sourceCompatibility JavaVersion.VERSION_1_7 40 | targetCompatibility JavaVersion.VERSION_1_7 41 | } 42 | 43 | sourceSets { 44 | main { 45 | manifest.srcFile 'AndroidManifest.xml' 46 | java.srcDirs = ['src'] 47 | resources.srcDirs = ['src'] 48 | aidl.srcDirs = ['src'] 49 | renderscript.srcDirs = ['src'] 50 | res.srcDirs = ['res'] 51 | assets.srcDirs = ['assets'] 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /framework/default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Indicates whether an apk should be generated for each density. 11 | split.density=false 12 | # Project target. 13 | target=android-14 14 | apk-configurations= 15 | -------------------------------------------------------------------------------- /framework/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Indicates whether an apk should be generated for each density. 11 | split.density=false 12 | # Project target. 13 | target=android-21 14 | apk-configurations= 15 | renderscript.opt.level=O0 16 | android.library=true 17 | android.library.reference.1=xwalk_core_library 18 | -------------------------------------------------------------------------------- /framework/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/framework/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /framework/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/framework/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /framework/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/framework/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /framework/res/drawable/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/framework/res/drawable/splash.png -------------------------------------------------------------------------------- /framework/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /framework/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | Cordova 22 | Snap 23 | 24 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/Failure.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.okhttp; 17 | 18 | /** 19 | * A failure attempting to retrieve an HTTP response. 20 | * 21 | *

Warning: Experimental OkHttp 2.0 API

22 | * This class is in beta. APIs are subject to change! 23 | */ 24 | /* OkHttp 2.0: public */ class Failure { 25 | private final Request request; 26 | private final Throwable exception; 27 | 28 | private Failure(Builder builder) { 29 | this.request = builder.request; 30 | this.exception = builder.exception; 31 | } 32 | 33 | public Request request() { 34 | return request; 35 | } 36 | 37 | public Throwable exception() { 38 | return exception; 39 | } 40 | 41 | public static class Builder { 42 | private Request request; 43 | private Throwable exception; 44 | 45 | public Builder request(Request request) { 46 | this.request = request; 47 | return this; 48 | } 49 | 50 | public Builder exception(Throwable exception) { 51 | this.exception = exception; 52 | return this; 53 | } 54 | 55 | public Failure build() { 56 | return new Failure(this); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/ResponseSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.okhttp; 17 | 18 | /** The source of an HTTP response. */ 19 | public enum ResponseSource { 20 | 21 | /** The response was returned from the local cache. */ 22 | CACHE, 23 | 24 | /** 25 | * The response is available in the cache but must be validated with the 26 | * network. The cache result will be used if it is still valid; otherwise 27 | * the network's response will be used. 28 | */ 29 | CONDITIONAL_CACHE, 30 | 31 | /** The response was returned from the network. */ 32 | NETWORK; 33 | 34 | public boolean requiresConnection() { 35 | return this == CONDITIONAL_CACHE || this == NETWORK; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/AbstractOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.squareup.okhttp.internal; 18 | 19 | import java.io.IOException; 20 | import java.io.OutputStream; 21 | 22 | /** 23 | * An output stream for an HTTP request body. 24 | * 25 | *

Since a single socket's output stream may be used to write multiple HTTP 26 | * requests to the same server, subclasses should not close the socket stream. 27 | */ 28 | public abstract class AbstractOutputStream extends OutputStream { 29 | protected boolean closed; 30 | 31 | @Override public final void write(int data) throws IOException { 32 | write(new byte[] { (byte) data }); 33 | } 34 | 35 | protected final void checkNotClosed() throws IOException { 36 | if (closed) { 37 | throw new IOException("stream closed"); 38 | } 39 | } 40 | 41 | /** Returns true if this stream was closed locally. */ 42 | public boolean isClosed() { 43 | return closed; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/Dns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.okhttp.internal; 17 | 18 | import java.net.InetAddress; 19 | import java.net.UnknownHostException; 20 | 21 | /** 22 | * Domain name service. Prefer this over {@link InetAddress#getAllByName} to 23 | * make code more testable. 24 | */ 25 | public interface Dns { 26 | Dns DEFAULT = new Dns() { 27 | @Override public InetAddress[] getAllByName(String host) throws UnknownHostException { 28 | return InetAddress.getAllByName(host); 29 | } 30 | }; 31 | 32 | InetAddress[] getAllByName(String host) throws UnknownHostException; 33 | } 34 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/NamedRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.squareup.okhttp.internal; 18 | 19 | /** 20 | * Runnable implementation which always sets its thread name. 21 | */ 22 | public abstract class NamedRunnable implements Runnable { 23 | private final String name; 24 | 25 | public NamedRunnable(String format, Object... args) { 26 | this.name = String.format(format, args); 27 | } 28 | 29 | @Override public final void run() { 30 | String oldName = Thread.currentThread().getName(); 31 | Thread.currentThread().setName(name); 32 | try { 33 | execute(); 34 | } finally { 35 | Thread.currentThread().setName(oldName); 36 | } 37 | } 38 | 39 | protected abstract void execute(); 40 | } 41 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/http/Policy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.okhttp.internal.http; 17 | 18 | import java.net.HttpURLConnection; 19 | import java.net.Proxy; 20 | import java.net.URL; 21 | 22 | public interface Policy { 23 | /** Returns true if HTTP response caches should be used. */ 24 | boolean getUseCaches(); 25 | 26 | /** Returns the HttpURLConnection instance to store in the cache. */ 27 | HttpURLConnection getHttpConnectionToCache(); 28 | 29 | /** Returns the current destination URL, possibly a redirect. */ 30 | URL getURL(); 31 | 32 | /** Returns the If-Modified-Since timestamp, or 0 if none is set. */ 33 | long getIfModifiedSince(); 34 | 35 | /** Returns true if a non-direct proxy is specified. */ 36 | boolean usingProxy(); 37 | 38 | /** @see java.net.HttpURLConnection#setChunkedStreamingMode(int) */ 39 | int getChunkLength(); 40 | 41 | /** @see java.net.HttpURLConnection#setFixedLengthStreamingMode(int) */ 42 | long getFixedContentLength(); 43 | 44 | /** 45 | * Sets the current proxy that this connection is using. 46 | * @see java.net.HttpURLConnection#usingProxy 47 | */ 48 | void setSelectedProxy(Proxy proxy); 49 | } 50 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/spdy/HeadersMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.okhttp.internal.spdy; 17 | 18 | enum HeadersMode { 19 | SPDY_SYN_STREAM, 20 | SPDY_REPLY, 21 | SPDY_HEADERS, 22 | HTTP_20_HEADERS; 23 | 24 | /** Returns true if it is an error these headers to create a new stream. */ 25 | public boolean failIfStreamAbsent() { 26 | return this == SPDY_REPLY || this == SPDY_HEADERS; 27 | } 28 | 29 | /** Returns true if it is an error these headers to update an existing stream. */ 30 | public boolean failIfStreamPresent() { 31 | return this == SPDY_SYN_STREAM; 32 | } 33 | 34 | /** 35 | * Returns true if it is an error these headers to be the initial headers of a 36 | * response. 37 | */ 38 | public boolean failIfHeadersAbsent() { 39 | return this == SPDY_HEADERS; 40 | } 41 | 42 | /** 43 | * Returns true if it is an error these headers to be update existing headers 44 | * of a response. 45 | */ 46 | public boolean failIfHeadersPresent() { 47 | return this == SPDY_REPLY; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/spdy/IncomingStreamHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.squareup.okhttp.internal.spdy; 18 | 19 | import java.io.IOException; 20 | 21 | /** Listener to be notified when a connected peer creates a new stream. */ 22 | public interface IncomingStreamHandler { 23 | IncomingStreamHandler REFUSE_INCOMING_STREAMS = new IncomingStreamHandler() { 24 | @Override public void receive(SpdyStream stream) throws IOException { 25 | stream.close(ErrorCode.REFUSED_STREAM); 26 | } 27 | }; 28 | 29 | /** 30 | * Handle a new stream from this connection's peer. Implementations should 31 | * respond by either {@link SpdyStream#reply replying to the stream} or 32 | * {@link SpdyStream#close closing it}. This response does not need to be 33 | * synchronous. 34 | */ 35 | void receive(SpdyStream stream) throws IOException; 36 | } 37 | -------------------------------------------------------------------------------- /framework/src/com/squareup/okhttp/internal/spdy/Variant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.okhttp.internal.spdy; 17 | 18 | import java.io.InputStream; 19 | import java.io.OutputStream; 20 | 21 | /** A version and dialect of the framed socket protocol. */ 22 | interface Variant { 23 | Variant SPDY3 = new Spdy3(); 24 | Variant HTTP_20_DRAFT_06 = new Http20Draft06(); 25 | 26 | /** 27 | * @param client true if this is the HTTP client's reader, reading frames from 28 | * a peer SPDY or HTTP/2 server. 29 | */ 30 | FrameReader newReader(InputStream in, boolean client); 31 | 32 | /** 33 | * @param client true if this is the HTTP client's writer, writing frames to a 34 | * peer SPDY or HTTP/2 server. 35 | */ 36 | FrameWriter newWriter(OutputStream out, boolean client); 37 | } 38 | -------------------------------------------------------------------------------- /framework/src/org/apache/cordova/CordovaApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import org.xwalk.core.XWalkApplication; 22 | 23 | public class CordovaApplication extends XWalkApplication { 24 | } 25 | -------------------------------------------------------------------------------- /framework/src/org/apache/cordova/DroidGap.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova; 21 | 22 | /** 23 | * This used to be the class that should be extended by application 24 | * developers, but everything has been moved to CordovaActivity. So 25 | * you should extend CordovaActivity instead of DroidGap. This class 26 | * will be removed at a future time. 27 | * 28 | * @see CordovaActivity 29 | * @deprecated 30 | */ 31 | @Deprecated 32 | public class DroidGap extends CordovaActivity { 33 | @Override 34 | protected void onXWalkReady() { 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /framework/src/org/apache/cordova/JSONUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import org.json.JSONArray; 25 | import org.json.JSONException; 26 | 27 | @Deprecated // Deprecated in 3.1. To be removed in 4.0. 28 | public class JSONUtils { 29 | public static List toStringList(JSONArray array) throws JSONException { 30 | if(array == null) { 31 | return null; 32 | } 33 | else { 34 | List list = new ArrayList(); 35 | 36 | for (int i = 0; i < array.length(); i++) { 37 | list.add(array.get(i).toString()); 38 | } 39 | 40 | return list; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-android", 3 | "version": "3.6.3", 4 | "description": "cordova-android release", 5 | "main": "bin/create", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git" 9 | }, 10 | "keywords": [ 11 | "android", 12 | "cordova", 13 | "apache" 14 | ], 15 | "scripts": { 16 | "test": "jasmine-node --color spec" 17 | }, 18 | "author": "Apache Software Foundation", 19 | "license": "Apache version 2.0", 20 | "dependencies": { 21 | "q": "^0.9.0", 22 | "shelljs": "^0.2.6" 23 | }, 24 | "devDependencies": { 25 | "jasmine-node": "~1", 26 | "promise-matchers": "~0" 27 | } 28 | } -------------------------------------------------------------------------------- /test/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked in Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /test/assets/www/cordova_plugins.js: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | cordova.define('cordova/plugin_list', function(require, exports, module) { 21 | module.exports = []; 22 | }); 23 | -------------------------------------------------------------------------------- /test/assets/www/htmlnotfound/error.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | Expected Error 25 | 26 | 27 | 28 | 29 | 30 |

Expected Error

31 |
32 |

Cordova:  

33 |

Deviceready:  

34 |
35 |
36 | This is an expected error page because the initial href doesn't exist. 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/assets/www/jqmtabbackbutton/tab1.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | Tab 1 23 | 24 | 25 | 26 |
27 |
28 |

Tab 1

29 |
30 |
31 | Tab 1 content. 32 |
33 |
34 |
35 | 43 |
44 | 45 |
46 | 47 |
48 | -------------------------------------------------------------------------------- /test/assets/www/jqmtabbackbutton/tab2.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | Tab 2 23 | 24 | 25 | 26 | 27 |
28 |
29 |

Tab 2

30 |
31 |
32 | Tab 2 content. 33 |
34 |
35 |
36 | 44 |
45 | 46 |
47 | 48 |
49 | -------------------------------------------------------------------------------- /test/assets/www/jqmtabbackbutton/tab3.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | Tab 3 23 | 24 | 25 | 26 | 27 |
28 |
29 |

Tab 3

30 |
31 |
32 | Tab 3 content. 33 |
34 |
35 |
36 | 44 |
45 | 46 |
47 | 48 |
49 | -------------------------------------------------------------------------------- /test/assets/www/splashscreen/index.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | Cordova Tests 25 | 26 | 27 | 28 | 29 | 30 |

Splash Screen Test

31 |
32 |

Cordova:  

33 |

Deviceready:  

34 |
35 |
36 | You should have seen the splash screen for 2 seconds.
37 | 38 | 39 | -------------------------------------------------------------------------------- /test/assets/www/whitelist/index2.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | Cordova Tests 25 | 26 | 27 | 28 | 29 | 30 |

Whitelist Page 2

31 |
32 |

Cordova:  

33 |

Deviceready:  

34 |
35 |
36 | Press "backbutton" 37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /test/cordova/android_sdk_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var android_sdk_version = require('./lib/android_sdk_version'); 23 | 24 | android_sdk_version.run().done(null, function(err) { 25 | console.log(err); 26 | process.exit(2); 27 | }); 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/cordova/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var build = require('./lib/build'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Support basic help commands 27 | if(args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || 28 | args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { 29 | build.help(); 30 | } else { 31 | reqs.run().then(function() { 32 | return build.run(args[2]); 33 | }).done(null, function(err) { 34 | console.error(err); 35 | process.exit(2); 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /test/cordova/build.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0build" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/check_reqs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var check_reqs = require('./lib/check_reqs'); 23 | 24 | check_reqs.run().done(null, function(err) { 25 | console.log(err); 26 | process.exit(2); 27 | }); 28 | 29 | -------------------------------------------------------------------------------- /test/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var clean = require('./lib/clean'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Usage support for when args are given 27 | if(args.length > 2) { 28 | clean.help(); 29 | } else { 30 | reqs.run().done(function() { 31 | return clean.run(); 32 | }, function(err) { 33 | console.error('ERROR: ' + err); 34 | process.exit(2); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /test/cordova/clean.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0clean" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/lib/clean.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var exec = require('./exec'), 23 | path = require('path'), 24 | ROOT = path.join(__dirname, '..', '..'); 25 | 26 | /* 27 | * Cleans the project using ant 28 | * Returns a promise. 29 | */ 30 | module.exports.run = function() { 31 | return exec('ant clean -f ' + path.join(ROOT, 'build.xml')); 32 | } 33 | 34 | module.exports.help = function() { 35 | console.log('Usage: ' + path.relative(process.cwd(), process.argv[1])); 36 | console.log('Cleans the project directory.'); 37 | process.exit(0); 38 | } 39 | -------------------------------------------------------------------------------- /test/cordova/lib/exec.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var child_process = require('child_process'), 23 | Q = require('q'); 24 | 25 | // Takes a command and optional current working directory. 26 | // Returns a promise that either resolves with the stdout, or 27 | // rejects with an error message and the stderr. 28 | module.exports = function(cmd, opt_cwd) { 29 | var d = Q.defer(); 30 | console.log('exec: ' + cmd); 31 | try { 32 | child_process.exec(cmd, {cwd: opt_cwd, maxBuffer: 1024000}, function(err, stdout, stderr) { 33 | console.log([cmd, err, stdout, stderr]); 34 | if (err) d.reject('Error executing "' + cmd + '": ' + stderr); 35 | else d.resolve(stdout); 36 | }); 37 | } catch(e) { 38 | console.error('error caught: ' + e); 39 | d.reject(e); 40 | } 41 | return d.promise; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /test/cordova/lib/install-device: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var device = require('./device'), 23 | args = process.argv; 24 | 25 | if(args.length > 2) { 26 | var install_target; 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | device.install(install_target).done(null, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | } else { 34 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 35 | process.exit(2); 36 | } 37 | } else { 38 | device.install().done(null, function(err) { 39 | console.error('ERROR: ' + err); 40 | process.exit(2); 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /test/cordova/lib/install-device.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-device" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/lib/install-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | var install_target; 26 | if(args.length > 2) { 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | } else { 30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 31 | process.exit(2); 32 | } 33 | } 34 | 35 | emulator.install(install_target).done(null, function(err) { 36 | console.error('ERROR: ' + err); 37 | process.exit(2); 38 | }); 39 | -------------------------------------------------------------------------------- /test/cordova/lib/install-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/lib/list-devices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var devices = require('./device'); 23 | 24 | // Usage support for when args are given 25 | devices.list().done(function(device_list) { 26 | device_list && device_list.forEach(function(dev) { 27 | console.log(dev); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | 34 | -------------------------------------------------------------------------------- /test/cordova/lib/list-devices.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-devices" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | emulators.list_images().done(function(emulator_list) { 26 | emulator_list && emulator_list.forEach(function(emu) { 27 | console.log(emu.name); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | -------------------------------------------------------------------------------- /test/cordova/lib/list-emulator-images.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-emulator-images" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /test/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | emulators.list_started().done(function(emulator_list) { 26 | emulator_list && emulator_list.forEach(function(emu) { 27 | console.log(emu); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | -------------------------------------------------------------------------------- /test/cordova/lib/list-started-emulators.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-started-emulators" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/lib/start-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | var install_target; 26 | if(args.length > 2) { 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | } else { 30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 31 | process.exit(2); 32 | } 33 | } 34 | 35 | emulator.start(install_target).done(null, function(err) { 36 | console.error('ERROR: ' + err); 37 | process.exit(2); 38 | }); 39 | 40 | -------------------------------------------------------------------------------- /test/cordova/lib/start-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0start-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var log = require('./lib/log'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Usage support for when args are given 27 | if(args.length > 2) { 28 | log.help(); 29 | } else { 30 | reqs.run().done(function() { 31 | return log.run(); 32 | }, function(err) { 33 | console.error('ERROR: ' + err); 34 | process.exit(2); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /test/cordova/log.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0log" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/node_modules/.bin/shjs: -------------------------------------------------------------------------------- 1 | ../shelljs/bin/shjs -------------------------------------------------------------------------------- /test/cordova/node_modules/q/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright 2009–2012 Kristopher Michael Kowal. All rights reserved. 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /test/cordova/node_modules/q/benchmark/scenarios.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var Q = require("../q"); 4 | 5 | suite("Chaining", function () { 6 | var numberToChain = 1000; 7 | 8 | bench("Chaining many already-fulfilled promises together", function (done) { 9 | var currentPromise = Q(); 10 | for (var i = 0; i < numberToChain; ++i) { 11 | currentPromise = currentPromise.then(function () { 12 | return Q(); 13 | }); 14 | } 15 | 16 | currentPromise.then(done); 17 | }); 18 | 19 | bench("Chaining and then fulfilling the end of the chain", function (done) { 20 | var deferred = Q.defer(); 21 | 22 | var currentPromise = deferred.promise; 23 | for (var i = 0; i < numberToChain; ++i) { 24 | (function () { 25 | var promiseToReturn = currentPromise; 26 | currentPromise = Q().then(function () { 27 | return promiseToReturn; 28 | }); 29 | }()); 30 | } 31 | 32 | currentPromise.then(done); 33 | 34 | deferred.resolve(); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /test/cordova/node_modules/q/queue.js: -------------------------------------------------------------------------------- 1 | 2 | var Q = require("./q"); 3 | 4 | module.exports = Queue; 5 | function Queue() { 6 | var ends = Q.defer(); 7 | var closed = Q.defer(); 8 | return { 9 | put: function (value) { 10 | var next = Q.defer(); 11 | ends.resolve({ 12 | head: value, 13 | tail: next.promise 14 | }); 15 | ends.resolve = next.resolve; 16 | }, 17 | get: function () { 18 | var result = ends.promise.get("head"); 19 | ends.promise = ends.promise.get("tail"); 20 | return result.fail(function (error) { 21 | closed.resolve(error); 22 | throw error; 23 | }); 24 | }, 25 | closed: closed.promise, 26 | close: function (error) { 27 | error = error || new Error("Can't get value from closed queue"); 28 | var end = {head: Q.reject(error)}; 29 | end.tail = end; 30 | ends.resolve(end); 31 | return closed.promise; 32 | } 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/.documentup.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ShellJS", 3 | "twitter": [ 4 | "r2r" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "loopfunc": true, 3 | "sub": true, 4 | "undef": true, 5 | "unused": true, 6 | "node": true 7 | } -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/.npmignore: -------------------------------------------------------------------------------- 1 | test/ 2 | tmp/ -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | - "0.11" 6 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Artur Adib 2 | All rights reserved. 3 | 4 | You may use this project under the terms of the New BSD license as follows: 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Artur Adib nor the 14 | names of the contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/bin/shjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | if (process.argv.length < 3) { 5 | console.log('ShellJS: missing argument (script name)'); 6 | console.log(); 7 | process.exit(1); 8 | } 9 | 10 | var args, 11 | scriptName = process.argv[2]; 12 | env['NODE_PATH'] = __dirname + '/../..'; 13 | 14 | if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) { 15 | if (test('-f', scriptName + '.js')) 16 | scriptName += '.js'; 17 | if (test('-f', scriptName + '.coffee')) 18 | scriptName += '.coffee'; 19 | } 20 | 21 | if (!test('-f', scriptName)) { 22 | console.log('ShellJS: script not found ('+scriptName+')'); 23 | console.log(); 24 | process.exit(1); 25 | } 26 | 27 | args = process.argv.slice(3); 28 | 29 | for (var i = 0, l = args.length; i < l; i++) { 30 | if (args[i][0] !== "-"){ 31 | args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words 32 | } 33 | } 34 | 35 | if (scriptName.match(/\.coffee$/)) { 36 | // 37 | // CoffeeScript 38 | // 39 | if (which('coffee')) { 40 | exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true }); 41 | } else { 42 | console.log('ShellJS: CoffeeScript interpreter not found'); 43 | console.log(); 44 | process.exit(1); 45 | } 46 | } else { 47 | // 48 | // JavaScript 49 | // 50 | exec('node ' + scriptName + ' ' + args.join(' '), { async: true }); 51 | } 52 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/global.js: -------------------------------------------------------------------------------- 1 | var shell = require('./shell.js'); 2 | for (var cmd in shell) 3 | global[cmd] = shell[cmd]; 4 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/make.js: -------------------------------------------------------------------------------- 1 | require('./global'); 2 | 3 | global.config.fatal = true; 4 | global.target = {}; 5 | 6 | // This ensures we only execute the script targets after the entire script has 7 | // been evaluated 8 | var args = process.argv.slice(2); 9 | setTimeout(function() { 10 | var t; 11 | 12 | if (args.length === 1 && args[0] === '--help') { 13 | console.log('Available targets:'); 14 | for (t in global.target) 15 | console.log(' ' + t); 16 | return; 17 | } 18 | 19 | // Wrap targets to prevent duplicate execution 20 | for (t in global.target) { 21 | (function(t, oldTarget){ 22 | 23 | // Wrap it 24 | global.target[t] = function(force) { 25 | if (oldTarget.done && !force) 26 | return; 27 | oldTarget.done = true; 28 | return oldTarget.apply(oldTarget, arguments); 29 | }; 30 | 31 | })(t, global.target[t]); 32 | } 33 | 34 | // Execute desired targets 35 | if (args.length > 0) { 36 | args.forEach(function(arg) { 37 | if (arg in global.target) 38 | global.target[arg](); 39 | else { 40 | console.log('no such target: ' + arg); 41 | } 42 | }); 43 | } else if ('all' in global.target) { 44 | global.target.all(); 45 | } 46 | 47 | }, 0); 48 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/scripts/generate-docs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | echo('Appending docs to README.md'); 5 | 6 | cd(__dirname + '/..'); 7 | 8 | // Extract docs from shell.js 9 | var docs = grep('//@', 'shell.js'); 10 | 11 | docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) { 12 | var file = path.match('.js$') ? path : path+'.js'; 13 | return grep('//@', file); 14 | }); 15 | 16 | // Remove '//@' 17 | docs = docs.replace(/\/\/\@ ?/g, ''); 18 | // Append docs to README 19 | sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md'); 20 | 21 | echo('All done.'); 22 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/scripts/run-tests.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | var path = require('path'); 5 | 6 | var failed = false; 7 | 8 | // 9 | // Lint 10 | // 11 | JSHINT_BIN = './node_modules/jshint/bin/jshint'; 12 | cd(__dirname + '/..'); 13 | 14 | if (!test('-f', JSHINT_BIN)) { 15 | echo('JSHint not found. Run `npm install` in the root dir first.'); 16 | exit(1); 17 | } 18 | 19 | if (exec(JSHINT_BIN + ' *.js test/*.js').code !== 0) { 20 | failed = true; 21 | echo('*** JSHINT FAILED! (return code != 0)'); 22 | echo(); 23 | } else { 24 | echo('All JSHint tests passed'); 25 | echo(); 26 | } 27 | 28 | // 29 | // Unit tests 30 | // 31 | cd(__dirname + '/../test'); 32 | ls('*.js').forEach(function(file) { 33 | echo('Running test:', file); 34 | if (exec('node ' + file).code !== 123) { // 123 avoids false positives (e.g. premature exit) 35 | failed = true; 36 | echo('*** TEST FAILED! (missing exit code "123")'); 37 | echo(); 38 | } 39 | }); 40 | 41 | if (failed) { 42 | echo(); 43 | echo('*******************************************************'); 44 | echo('WARNING: Some tests did not pass!'); 45 | echo('*******************************************************'); 46 | exit(1); 47 | } else { 48 | echo(); 49 | echo('All tests passed.'); 50 | } 51 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/cat.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### cat(file [, file ...]) 6 | //@ ### cat(file_array) 7 | //@ 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ var str = cat('file*.txt'); 12 | //@ var str = cat('file1', 'file2'); 13 | //@ var str = cat(['file1', 'file2']); // same as above 14 | //@ ``` 15 | //@ 16 | //@ Returns a string containing the given file, or a concatenated string 17 | //@ containing the files if more than one file is given (a new line character is 18 | //@ introduced between each file). Wildcard `*` accepted. 19 | function _cat(options, files) { 20 | var cat = ''; 21 | 22 | if (!files) 23 | common.error('no paths given'); 24 | 25 | if (typeof files === 'string') 26 | files = [].slice.call(arguments, 1); 27 | // if it's array leave it as it is 28 | 29 | files = common.expand(files); 30 | 31 | files.forEach(function(file) { 32 | if (!fs.existsSync(file)) 33 | common.error('no such file or directory: ' + file); 34 | 35 | cat += fs.readFileSync(file, 'utf8') + '\n'; 36 | }); 37 | 38 | if (cat[cat.length-1] === '\n') 39 | cat = cat.substring(0, cat.length-1); 40 | 41 | return common.ShellString(cat); 42 | } 43 | module.exports = _cat; 44 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/cd.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var common = require('./common'); 3 | 4 | //@ 5 | //@ ### cd('dir') 6 | //@ Changes to directory `dir` for the duration of the script 7 | function _cd(options, dir) { 8 | if (!dir) 9 | common.error('directory not specified'); 10 | 11 | if (!fs.existsSync(dir)) 12 | common.error('no such file or directory: ' + dir); 13 | 14 | if (!fs.statSync(dir).isDirectory()) 15 | common.error('not a directory: ' + dir); 16 | 17 | process.chdir(dir); 18 | } 19 | module.exports = _cd; 20 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/echo.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | 3 | //@ 4 | //@ ### echo(string [,string ...]) 5 | //@ 6 | //@ Examples: 7 | //@ 8 | //@ ```javascript 9 | //@ echo('hello world'); 10 | //@ var str = echo('hello world'); 11 | //@ ``` 12 | //@ 13 | //@ Prints string to stdout, and returns string with additional utility methods 14 | //@ like `.to()`. 15 | function _echo() { 16 | var messages = [].slice.call(arguments, 0); 17 | console.log.apply(this, messages); 18 | return common.ShellString(messages.join(' ')); 19 | } 20 | module.exports = _echo; 21 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/error.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | 3 | //@ 4 | //@ ### error() 5 | //@ Tests if error occurred in the last command. Returns `null` if no error occurred, 6 | //@ otherwise returns string explaining the error 7 | function error() { 8 | return common.state.error; 9 | }; 10 | module.exports = error; 11 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/find.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var common = require('./common'); 3 | var _ls = require('./ls'); 4 | 5 | //@ 6 | //@ ### find(path [,path ...]) 7 | //@ ### find(path_array) 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ find('src', 'lib'); 12 | //@ find(['src', 'lib']); // same as above 13 | //@ find('.').filter(function(file) { return file.match(/\.js$/); }); 14 | //@ ``` 15 | //@ 16 | //@ Returns array of all files (however deep) in the given paths. 17 | //@ 18 | //@ The main difference from `ls('-R', path)` is that the resulting file names 19 | //@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`. 20 | function _find(options, paths) { 21 | if (!paths) 22 | common.error('no path specified'); 23 | else if (typeof paths === 'object') 24 | paths = paths; // assume array 25 | else if (typeof paths === 'string') 26 | paths = [].slice.call(arguments, 1); 27 | 28 | var list = []; 29 | 30 | function pushFile(file) { 31 | if (common.platform === 'win') 32 | file = file.replace(/\\/g, '/'); 33 | list.push(file); 34 | } 35 | 36 | // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs 37 | // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory 38 | 39 | paths.forEach(function(file) { 40 | pushFile(file); 41 | 42 | if (fs.statSync(file).isDirectory()) { 43 | _ls('-RA', file+'/*').forEach(function(subfile) { 44 | pushFile(subfile); 45 | }); 46 | } 47 | }); 48 | 49 | return list; 50 | } 51 | module.exports = _find; 52 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/grep.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### grep([options ,] regex_filter, file [, file ...]) 6 | //@ ### grep([options ,] regex_filter, file_array) 7 | //@ Available options: 8 | //@ 9 | //@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. 10 | //@ 11 | //@ Examples: 12 | //@ 13 | //@ ```javascript 14 | //@ grep('-v', 'GLOBAL_VARIABLE', '*.js'); 15 | //@ grep('GLOBAL_VARIABLE', '*.js'); 16 | //@ ``` 17 | //@ 18 | //@ Reads input string from given files and returns a string containing all lines of the 19 | //@ file that match the given `regex_filter`. Wildcard `*` accepted. 20 | function _grep(options, regex, files) { 21 | options = common.parseOptions(options, { 22 | 'v': 'inverse' 23 | }); 24 | 25 | if (!files) 26 | common.error('no paths given'); 27 | 28 | if (typeof files === 'string') 29 | files = [].slice.call(arguments, 2); 30 | // if it's array leave it as it is 31 | 32 | files = common.expand(files); 33 | 34 | var grep = ''; 35 | files.forEach(function(file) { 36 | if (!fs.existsSync(file)) { 37 | common.error('no such file or directory: ' + file, true); 38 | return; 39 | } 40 | 41 | var contents = fs.readFileSync(file, 'utf8'), 42 | lines = contents.split(/\r*\n/); 43 | lines.forEach(function(line) { 44 | var matched = line.match(regex); 45 | if ((options.inverse && !matched) || (!options.inverse && matched)) 46 | grep += line + '\n'; 47 | }); 48 | }); 49 | 50 | return common.ShellString(grep); 51 | } 52 | module.exports = _grep; 53 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/popd.js: -------------------------------------------------------------------------------- 1 | // see dirs.js -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/pushd.js: -------------------------------------------------------------------------------- 1 | // see dirs.js -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/pwd.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var common = require('./common'); 3 | 4 | //@ 5 | //@ ### pwd() 6 | //@ Returns the current directory. 7 | function _pwd(options) { 8 | var pwd = path.resolve(process.cwd()); 9 | return common.ShellString(pwd); 10 | } 11 | module.exports = _pwd; 12 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/sed.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### sed([options ,] search_regex, replace_str, file) 6 | //@ Available options: 7 | //@ 8 | //@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ 9 | //@ 10 | //@ Examples: 11 | //@ 12 | //@ ```javascript 13 | //@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js'); 14 | //@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); 15 | //@ ``` 16 | //@ 17 | //@ Reads an input string from `file` and performs a JavaScript `replace()` on the input 18 | //@ using the given search regex and replacement string. Returns the new string after replacement. 19 | function _sed(options, regex, replacement, file) { 20 | options = common.parseOptions(options, { 21 | 'i': 'inplace' 22 | }); 23 | 24 | if (typeof replacement === 'string') 25 | replacement = replacement; // no-op 26 | else if (typeof replacement === 'number') 27 | replacement = replacement.toString(); // fallback 28 | else 29 | common.error('invalid replacement string'); 30 | 31 | if (!file) 32 | common.error('no file given'); 33 | 34 | if (!fs.existsSync(file)) 35 | common.error('no such file or directory: ' + file); 36 | 37 | var result = fs.readFileSync(file, 'utf8').replace(regex, replacement); 38 | if (options.inplace) 39 | fs.writeFileSync(file, result, 'utf8'); 40 | 41 | return common.ShellString(result); 42 | } 43 | module.exports = _sed; 44 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/to.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | 5 | //@ 6 | //@ ### 'string'.to(file) 7 | //@ 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ cat('input.txt').to('output.txt'); 12 | //@ ``` 13 | //@ 14 | //@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as 15 | //@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ 16 | function _to(options, file) { 17 | if (!file) 18 | common.error('wrong arguments'); 19 | 20 | if (!fs.existsSync( path.dirname(file) )) 21 | common.error('no such file or directory: ' + path.dirname(file)); 22 | 23 | try { 24 | fs.writeFileSync(file, this.toString(), 'utf8'); 25 | } catch(e) { 26 | common.error('could not write to file (code '+e.code+'): '+file, true); 27 | } 28 | } 29 | module.exports = _to; 30 | -------------------------------------------------------------------------------- /test/cordova/node_modules/shelljs/src/toEnd.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | 5 | //@ 6 | //@ ### 'string'.toEnd(file) 7 | //@ 8 | //@ Examples: 9 | //@ 10 | //@ ```javascript 11 | //@ cat('input.txt').toEnd('output.txt'); 12 | //@ ``` 13 | //@ 14 | //@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as 15 | //@ those returned by `cat`, `grep`, etc). 16 | function _toEnd(options, file) { 17 | if (!file) 18 | common.error('wrong arguments'); 19 | 20 | if (!fs.existsSync( path.dirname(file) )) 21 | common.error('no such file or directory: ' + path.dirname(file)); 22 | 23 | try { 24 | fs.appendFileSync(file, this.toString(), 'utf8'); 25 | } catch(e) { 26 | common.error('could not append to file (code '+e.code+'): '+file, true); 27 | } 28 | } 29 | module.exports = _toEnd; 30 | -------------------------------------------------------------------------------- /test/cordova/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var run = require('./lib/run'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Support basic help commands 27 | if (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || 28 | args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { 29 | run.help(); 30 | } else { 31 | reqs.run().done(function() { 32 | return run.run(args); 33 | }, function(err) { 34 | console.error('ERROR: ' + err); 35 | process.exit(2); 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /test/cordova/run.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0run" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /test/cordova/version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | // Coho updates this line: 23 | var VERSION = "3.2.0-rc1"; 24 | 25 | console.log(VERSION); 26 | -------------------------------------------------------------------------------- /test/cordova/version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0version" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /test/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-21 12 | android.library.reference.1=../framework 13 | -------------------------------------------------------------------------------- /test/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/test/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /test/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/test/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /test/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/test/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /test/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/test/res/drawable/icon.png -------------------------------------------------------------------------------- /test/res/drawable/sandy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-cordova-android/a5fc3b8528061e99cc03887a7137b1af7ac0b432/test/res/drawable/sandy.jpg -------------------------------------------------------------------------------- /test/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 24 | 25 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | CordovaNativeTests 22 | 23 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/pluginApi/pluginStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | /* 21 | * This plugin is a test of all the message callbacks and actions available to plugins 22 | * 23 | */ 24 | 25 | package org.apache.cordova.pluginApi; 26 | 27 | import org.apache.cordova.CordovaPlugin; 28 | 29 | public class pluginStub extends CordovaPlugin { 30 | 31 | public String id; 32 | public Object data; 33 | 34 | public Object onMessage(String id, Object input) 35 | { 36 | this.data = input; 37 | return input; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/MainTestActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import org.apache.cordova.CordovaActivity; 22 | 23 | import android.os.Bundle; 24 | 25 | public class MainTestActivity extends CordovaActivity { 26 | /** Called when the activity is first created. */ 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | super.loadUrl("file:///android_asset/www/index.html"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/backbuttonmultipage.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class backbuttonmultipage extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.loadUrl("file:///android_asset/www/backbuttonmultipage/index.html"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/background.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | 23 | import org.apache.cordova.*; 24 | 25 | public class background extends CordovaActivity { 26 | @Override 27 | public void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | //super.init(new FixWebView(this), new CordovaWebViewClient(this), new CordovaChromeClient(this)); 30 | preferences.set("keepRunning", false); 31 | super.loadUrl("file:///android_asset/www/background/index.html"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/backgroundcolor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.graphics.Color; 22 | import android.os.Bundle; 23 | import org.apache.cordova.*; 24 | 25 | public class backgroundcolor extends CordovaActivity { 26 | @Override 27 | public void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | 30 | // backgroundColor can also be set in cordova.xml, but you must use the number equivalent of the color. For example, Color.RED is 31 | // 32 | preferences.set("backgroundColor", Color.GREEN); 33 | 34 | super.loadUrl("file:///android_asset/www/backgroundcolor/index.html"); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/errorurl.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class errorurl extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | preferences.set("errorUrl", "file:///android_asset/www/htmlnotfound/error.html"); 29 | super.loadUrl("file:///android_asset/www/htmlnotfound/index.html"); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/fullscreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class fullscreen extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | 29 | // Properties must be set before init() is called, since some are processed during init(). 30 | 31 | // fullscreen can also be set in cordova.xml. For example, 32 | // 33 | preferences.set("fullscreen", true); 34 | 35 | super.init(); 36 | super.loadUrl("file:///android_asset/www/fullscreen/index.html"); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/htmlnotfound.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class htmlnotfound extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.init(); 29 | super.loadUrl("file:///android_asset/www/htmlnotfound/index.html"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/iframe.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class iframe extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.loadUrl("file:///android_asset/www/iframe/index.html"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/junit/FixWebView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test.junit; 20 | 21 | import android.content.Context; 22 | import android.webkit.WebView; 23 | 24 | public class FixWebView extends WebView { 25 | 26 | public FixWebView(Context context) { 27 | super(context); 28 | } 29 | 30 | @Override 31 | public void pauseTimers() { 32 | // Do nothing 33 | } 34 | 35 | /** 36 | * This method is with different signature in order to stop the timers while move application to background 37 | * @param realPause 38 | */ 39 | public void pauseTimers(@SuppressWarnings("unused") boolean realPause) { 40 | super.pauseTimers(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/junit/LifecycleTest.java: -------------------------------------------------------------------------------- 1 | package org.apache.cordova.test.junit; 2 | /* 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | * 21 | */ 22 | 23 | 24 | import org.apache.cordova.test.lifecycle; 25 | 26 | import android.test.ActivityInstrumentationTestCase2; 27 | 28 | public class LifecycleTest extends ActivityInstrumentationTestCase2 { 29 | 30 | public LifecycleTest() 31 | { 32 | super("org.apache.cordova.test",lifecycle.class); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/junit/MenuTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova.test.junit; 21 | 22 | import org.apache.cordova.test.menus; 23 | 24 | import android.test.ActivityInstrumentationTestCase2; 25 | 26 | public class MenuTest extends ActivityInstrumentationTestCase2 { 27 | 28 | public MenuTest() { 29 | super("org.apache.cordova.test", menus.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/junit/SplashscreenTest.java: -------------------------------------------------------------------------------- 1 | package org.apache.cordova.test.junit; 2 | /* 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | * 21 | */ 22 | 23 | 24 | import org.apache.cordova.CordovaWebView; 25 | import org.apache.cordova.test.splashscreen; 26 | 27 | import android.app.Dialog; 28 | import android.test.ActivityInstrumentationTestCase2; 29 | import android.widget.FrameLayout; 30 | import android.widget.LinearLayout; 31 | 32 | public class SplashscreenTest extends ActivityInstrumentationTestCase2 { 33 | 34 | private splashscreen testActivity; 35 | private Dialog containerView; 36 | 37 | public SplashscreenTest() 38 | { 39 | super("org.apache.cordova.test",splashscreen.class); 40 | } 41 | 42 | protected void setUp() throws Exception { 43 | super.setUp(); 44 | testActivity = this.getActivity(); 45 | //containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); 46 | //containerView = (Dialog) testActivity.findViewById(id); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/junit/XhrTest.java: -------------------------------------------------------------------------------- 1 | package org.apache.cordova.test.junit; 2 | /* 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | * 21 | */ 22 | 23 | 24 | import org.apache.cordova.test.xhr; 25 | 26 | import android.test.ActivityInstrumentationTestCase2; 27 | 28 | public class XhrTest extends ActivityInstrumentationTestCase2 { 29 | 30 | public XhrTest() 31 | { 32 | super(xhr.class); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/lifecycle.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class lifecycle extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.loadUrl("file:///android_asset/www/lifecycle/index.html"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/loading.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class loading extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | preferences.set("loadingDialog", "Testing,Loading..."); 29 | super.loadUrl("http://www.google.com"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/splashscreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class splashscreen extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.init(); 29 | 30 | // Show splashscreen 31 | preferences.set("splashscreen", "sandy"); 32 | 33 | super.loadUrl("file:///android_asset/www/splashscreen/index.html", 2000); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/tests.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class tests extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.init(); 29 | //super.pluginManager.addService("Activity", "org.apache.cordova.test.ActivityPlugin"); 30 | super.loadUrl("file:///android_asset/www/index.html"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/timeout.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class timeout extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.init(); 29 | 30 | // Short timeout to cause error 31 | preferences.set("loadUrlTimeoutValue", 10); 32 | super.loadUrl("http://www.google.com"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/src/org/apache/cordova/test/xhr.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.test; 20 | 21 | import android.os.Bundle; 22 | import org.apache.cordova.*; 23 | 24 | public class xhr extends CordovaActivity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | super.loadUrl("file:///android_asset/www/xhr/index.html"); 29 | } 30 | } 31 | --------------------------------------------------------------------------------