├── .gitattributes ├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .jshintignore ├── .jshintrc ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── RELEASENOTES.md ├── VERSION ├── appveyor.yml ├── bin ├── check_reqs ├── check_reqs.bat ├── create ├── create.bat ├── createTemplates.bat ├── createTemplates.js ├── lib │ ├── check_reqs.js │ ├── create.js │ └── update.js ├── update └── update.bat ├── cordova-js-src ├── exec.js └── platform.js ├── framework ├── .gitignore ├── Images │ ├── appbar.back.rest.png │ ├── appbar.close.rest.png │ ├── appbar.feature.video.rest.png │ ├── appbar.next.rest.png │ ├── appbar.save.rest.png │ └── appbar.stop.rest.png ├── Properties │ └── AssemblyInfo.cs ├── WPCordovaClassLib.csproj ├── WPCordovaClassLib.sln └── resources │ └── notification-beep.wav ├── node ├── node_modules ├── .bin │ ├── nopt │ ├── nopt.cmd │ ├── shjs │ └── shjs.cmd ├── node-uuid │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── benchmark │ │ ├── README.md │ │ ├── bench.gnu │ │ ├── bench.sh │ │ ├── benchmark-native.c │ │ └── benchmark.js │ ├── component.json │ ├── package.json │ ├── test │ │ ├── compare_v1.js │ │ ├── test.html │ │ └── test.js │ └── uuid.js ├── nopt │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── bin │ │ └── nopt.js │ ├── examples │ │ └── my-program.js │ ├── lib │ │ └── nopt.js │ ├── node_modules │ │ └── abbrev │ │ │ ├── CONTRIBUTING.md │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── abbrev.js │ │ │ ├── package.json │ │ │ └── test.js │ ├── package.json │ └── test │ │ └── basic.js ├── 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 │ ├── ln.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 ├── package.json ├── spec ├── .jshintrc ├── e2e │ └── endtoend.spec.js └── unit │ ├── MSBuildTools.spec.js │ ├── build.spec.js │ ├── fixtures │ └── EmptyProject │ │ └── bin │ │ ├── ARM │ │ ├── Debug │ │ │ └── .gitignore │ │ └── Release │ │ │ └── CordovaAppProj_Release_ARM.xap │ │ └── Debug │ │ └── CordovaAppProj_Debug_AnyCPU.xap │ ├── package.spec.js │ └── run.spec.js └── template ├── App.xaml ├── App.xaml.cs ├── ApplicationIcon.png ├── Background.png ├── CordovaWP8AppProj.csproj ├── CordovaWP8Solution.sln ├── Images ├── appbar.back.rest.png ├── appbar.close.rest.png ├── appbar.feature.video.rest.png ├── appbar.next.rest.png ├── appbar.save.rest.png └── appbar.stop.rest.png ├── MainPage.xaml ├── MainPage.xaml.cs ├── MyTemplate.vstemplate ├── Properties ├── AppManifest.xml ├── AssemblyInfo.cs └── WMAppManifest.xml ├── SplashScreenImage.jpg ├── __PreviewImage.jpg ├── __TemplateIcon.png ├── cordova ├── build ├── build.bat ├── clean ├── clean.bat ├── defaults.xml ├── lib │ ├── MSBuildTools.js │ ├── build.js │ ├── clean.js │ ├── device.js │ ├── install-device.bat │ ├── install-emulator.bat │ ├── list-devices.bat │ ├── list-emulator-images.bat │ ├── list-started-emulators.bat │ ├── package.js │ ├── run.js │ ├── start-emulator.bat │ ├── target-list.js │ ├── utils.js │ ├── win_os_version.js │ └── win_sdk_version.js ├── log.bat ├── run ├── run.bat ├── version.bat ├── win_os_version.bat └── win_sdk_version.bat ├── cordovalib ├── BrowserMouseHelper.cs ├── CommandFactory.cs ├── Commands │ └── BaseCommand.cs ├── ConfigHandler.cs ├── ConsoleHelper.cs ├── CordovaCommandCall.cs ├── CordovaView.xaml ├── CordovaView.xaml.cs ├── IBrowserDecorator.cs ├── ImageExifHelper.cs ├── JSON │ └── JsonHelper.cs ├── MimeTypeMapper.cs ├── NativeExecution.cs ├── OrientationHelper.cs ├── PluginResult.cs ├── ScriptCallback.cs └── XHRHelper.cs ├── lib ├── LICENSE.md ├── Newtonsoft.Json.dll ├── Newtonsoft.Json.nuspec └── Newtonsoft.Json.xml └── www ├── cordova.js ├── css └── index.css ├── img └── logo.png ├── index.html └── js └── index.js /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | 3 | # source code 4 | *.php text 5 | *.css text 6 | *.sass text 7 | *.scss text 8 | *.less text 9 | *.styl text 10 | *.js text 11 | *.coffee text 12 | *.json text 13 | *.htm text 14 | *.html text 15 | *.xml text 16 | *.svg text 17 | *.txt text 18 | *.ini text 19 | *.inc text 20 | *.pl text 21 | *.rb text 22 | *.py text 23 | *.scm text 24 | *.sql text 25 | *.sh text 26 | *.bat text 27 | 28 | # templates 29 | *.ejs text 30 | *.hbt text 31 | *.jade text 32 | *.haml text 33 | *.hbs text 34 | *.dot text 35 | *.tmpl text 36 | *.phtml text 37 | 38 | # server config 39 | .htaccess text 40 | 41 | # git config 42 | .gitattributes text 43 | .gitignore text 44 | .gitconfig text 45 | 46 | # code analysis config 47 | .jshintrc text 48 | .jscsrc text 49 | .jshintignore text 50 | .csslintrc text 51 | 52 | # misc config 53 | *.yaml text 54 | *.yml text 55 | .editorconfig text 56 | 57 | # build config 58 | *.npmignore text 59 | *.bowerrc text 60 | 61 | # Heroku 62 | Procfile text 63 | .slugignore text 64 | 65 | # Documentation 66 | *.md text 67 | LICENSE text 68 | AUTHORS text 69 | 70 | 71 | # 72 | ## These files are binary and should be left untouched 73 | # 74 | 75 | # (binary is a macro for -text -diff) 76 | *.png binary 77 | *.jpg binary 78 | *.jpeg binary 79 | *.gif binary 80 | *.ico binary 81 | *.mov binary 82 | *.mp4 binary 83 | *.mp3 binary 84 | *.flv binary 85 | *.fla binary 86 | *.swf binary 87 | *.gz binary 88 | *.zip binary 89 | *.7z binary 90 | *.ttf binary 91 | *.eot binary 92 | *.woff binary 93 | *.pyc binary 94 | *.pdf binary 95 | *.dll binary 96 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | ### Platforms affected 11 | 12 | 13 | ### What does this PR do? 14 | 15 | 16 | ### What testing has been done on this change? 17 | 18 | 19 | ### Checklist 20 | - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database 21 | - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. 22 | - [ ] Added automated test coverage as appropriate for this change. 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | obj 3 | *.csproj.user 4 | *.suo 5 | *.cache 6 | Thumbs.db 7 | 8 | /temp/* 9 | 10 | *.dll 11 | !template/lib/* 12 | 13 | # Ignore template zip files 14 | *.zip 15 | 16 | # Other useful stuff 17 | *.bak 18 | *.cache 19 | *.log 20 | *.swp 21 | *.user 22 | 23 | *.DS_Store 24 | 25 | framework/Bin/* 26 | 27 | node_modules/ 28 | -------------------------------------------------------------------------------- /.jshintignore: -------------------------------------------------------------------------------- 1 | template/www/* 2 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true 3 | , "bitwise": true 4 | , "undef": true 5 | , "trailing": true 6 | , "quotmark": true 7 | , "indent": 4 8 | , "unused": "vars" 9 | , "latedef": "nofunc" 10 | } 11 | -------------------------------------------------------------------------------- /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 | 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | 14 | This product bundles Newtonsoft.Json, which is available under The MIT License (MIT). 15 | For details, see template/lib/LICENSE.md, http://james.newtonking.com/json 16 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2012 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | Apache Cordova for Windows Phone 8 24 | === 25 | 26 | --- 27 | 📌 **Deprecation Notice** 28 | 29 | This repository is deprecated and no more work will be done on this by Apache Cordova. You can continue to use this and it should work as-is but any future issues will not be fixed by the Cordova community. 30 | 31 | Feel free to fork this repository and improve your fork. Existing forks are listed in [Network](../../network) and [Forks](../../network/members). 32 | 33 | - Learn more: https://github.com/apache/cordova/blob/master/deprecated.md#deprecated-platforms 34 | --- 35 | 36 | [![Build status](https://ci.appveyor.com/api/projects/status/apoby7i5j5xnmhy2/branch/master)](https://ci.appveyor.com/project/Humbedooh/cordova-wp8/branch/master) 37 | 38 | 39 | This repo includes code to build Apache Cordova applications that target Windows Phone 8 SDK. 40 | 41 | An Apache Cordova based applications is, at the core, an application written with web technology: HTML, CSS and JavaScript. 42 | 43 | [Apache Cordova][] is a project at The Apache Software Foundation (ASF). 44 | 45 | Requires 46 | --- 47 | 48 | - [Windows Phone SDK 8][] 49 | -- Windows Phone 8 development requires Windows 8 Professional, and Visual Studio 2012 ( express works ) 50 | 51 | 52 | Getting Started 53 | --- 54 | 55 | 56 | ## Create a new project 57 | 58 | Getting Started from the command line 59 | --- 60 | 61 | >.\wp8\bin\create PathToNewProject [ PackageName ] [ AppName ] 62 | 63 | >PathToNewProject : The path to where you wish to create the project 64 | >PackageName : The namespace for the project (default is Cordova.Example) 65 | >AppName : The name of the application (default is CordovaWP8AppProj) 66 | 67 | >example: 68 | >.\wp8\bin\create C:\Users\anonymous\Desktop\MyWP8Proj io.cordova.example CordovaWP8App 69 | 70 | From here you can open it in Visual Studio: 71 | - Launch Visual Studio and open Solution file (.sln) in (C:\Users\anonymous\Desktop\MyWP8Proj) 72 | - Built and Run it 73 | 74 | Or, you can continue with the command line: 75 | - >cd C:\Users\anonymous\Desktop\MyWP8Proj 76 | >cordova\run 77 | 78 | 79 | BUGS? 80 | ----- 81 | 82 | - File them at the [Apache Cordova Issue Tracker][] 83 | 84 | 85 | Further Reading 86 | --- 87 | 88 | - [Apache Cordova Documentation][] 89 | - [Apache Cordova Wiki][] 90 | 91 | [Windows Phone SDK 8]: http://www.microsoft.com/en-us/download/details.aspx?id=35471 "Download Windows Phone SDK 8" 92 | 93 | [Apache Cordova]: http://cordova.io "Apache Cordova" 94 | [Apache Cordova Issue Tracker]: https://issues.apache.org/jira/browse/CB "Apache Cordova Issue Tracker" 95 | [Apache Cordova Documentation]: http://cordova.io/docs "Apache Cordova Documentation" 96 | [Apache Cordova Wiki]: http://wiki.apache.org/cordova "Apache Cordova Wiki" 97 | 98 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 3.9.0-dev 2 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 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 | # appveyor file 21 | # http://www.appveyor.com/docs/appveyor-yml 22 | 23 | install: 24 | - npm install 25 | 26 | build: off 27 | 28 | test_script: 29 | - node --version 30 | - npm --version 31 | - msbuild /version 32 | - npm test -------------------------------------------------------------------------------- /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 for help flag 25 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) { 26 | check_reqs.help(); 27 | } else { 28 | check_reqs.run().done(function success(msbuild) { 29 | console.log('Environment is supported; found MSBuild Tools version ' + msbuild.version + ' at ' + msbuild.path); 30 | }, function (err) { 31 | console.error('Failed to check requirements due to', err); 32 | process.exit(2); 33 | }); 34 | } -------------------------------------------------------------------------------- /bin/check_reqs.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0check_reqs" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'check_reqs' in 'bin' folder, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /bin/create: -------------------------------------------------------------------------------- 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 | /* 23 | * create a cordova/windows8 project 24 | * USAGE 25 | * ./create [path package activity] 26 | * ./bin/create.bat C:\Users\Me\MyTestProj "test.proj" "TestProject" 27 | */ 28 | 29 | var create = require('./lib/create'); 30 | 31 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) { 32 | create.help(); 33 | } else { 34 | create.run(process.argv).done(null, function (err) { 35 | console.error('Failed to create project due to', err); 36 | process.exit(2); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /bin/create.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET full_path=%~dp0 24 | IF EXIST "%full_path%create" ( 25 | node "%full_path%create" %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'create' in 'bin' folder, aborting...>&2 29 | EXIT /B 1 30 | ) 31 | -------------------------------------------------------------------------------- /bin/createTemplates.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | cscript "%~dp0\createTemplates.js" %* //nologo -------------------------------------------------------------------------------- /bin/lib/update.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 | var Q = require('q'), 21 | fs = require('fs'), 22 | path = require('path'), 23 | shell = require('shelljs'), 24 | create = require('./create'); 25 | 26 | // returns package metadata from config.xml with fields 'namespace' and 'name' 27 | function extractMetadata(projectPath) { 28 | if (!fs.existsSync(path.join(projectPath, 'config.xml'))){ 29 | return Q.reject('config.xml does not exist'); 30 | } 31 | 32 | var meta = { // default values 33 | namespace: 'io.cordova.hellocordova', 34 | name: 'HelloCordova' 35 | }; 36 | 37 | // TODO: read real values from config.xml 38 | // in case of Cordova CLI all values will be automatically updated by cli for you 39 | // but the script could be used w/o CLI so we should correctly populate meta 40 | 41 | return Q.resolve(meta); 42 | } 43 | 44 | module.exports.help = function () { 45 | console.log('WARNING : Make sure to back up your project before updating!'); 46 | console.log('Usage: update PathToProject '); 47 | console.log(' PathToProject : The path the project you would like to update.'); 48 | console.log('examples:'); 49 | console.log(' update C:\\Users\\anonymous\\Desktop\\MyProject'); 50 | }; 51 | 52 | // updates the cordova.js in project along with the cordova tooling. 53 | module.exports.run = function (argv) { 54 | var projectPath = argv[2]; 55 | if (!fs.existsSync(projectPath)){ 56 | // if specified project path is not valid then reject promise 57 | Q.reject('The given path to the project does not exist.' + 58 | ' Please provide a path to the project you would like to update.'); 59 | } 60 | 61 | return extractMetadata(projectPath).then(function (metadata) { 62 | shell.rm('-rf', projectPath); 63 | 64 | // setup args for create.run which requires process.argv-like array 65 | var createArgs = argv.concat([metadata.namespace, metadata.name]); 66 | return create.run(createArgs); 67 | }); 68 | }; -------------------------------------------------------------------------------- /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 | 22 | var update = require('./lib/update'); 23 | 24 | // check for help flag 25 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) { 26 | update.help(); 27 | } else { 28 | update.run(process.argv).done(function () { 29 | console.log('Successfully updated windows project.'); 30 | }, function (err) { 31 | console.error('Failed to check requirements due to', err); 32 | process.exit(2); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /bin/update.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0update" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'update' script in 'bin' folder, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /cordova-js-src/exec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | var cordova = require('cordova'), 23 | base64 = require('cordova/base64'); 24 | 25 | /** 26 | * Execute a cordova command. It is up to the native side whether this action 27 | * is synchronous or asynchronous. The native side can return: 28 | * Synchronous: PluginResult object as a JSON string 29 | * Asynchronous: Empty string "" 30 | * If async, the native side will cordova.callbackSuccess or cordova.callbackError, 31 | * depending upon the result of the action. 32 | * 33 | * @param {Function} success The success callback 34 | * @param {Function} fail The fail callback 35 | * @param {String} service The name of the service to use 36 | * @param {String} action Action to be run in cordova 37 | * @param {String[]} [args] Zero or more arguments to pass to the method 38 | 39 | */ 40 | 41 | module.exports = function(success, fail, service, action, args) { 42 | 43 | var callbackId = service + cordova.callbackId++; 44 | if (typeof success == "function" || typeof fail == "function") { 45 | cordova.callbacks[callbackId] = {success:success, fail:fail}; 46 | } 47 | args = args || []; 48 | // generate a new command string, ex. DebugConsole/log/DebugConsole23/["wtf dude?"] 49 | for(var n = 0; n < args.length; n++) 50 | { 51 | // special case for ArrayBuffer which could not be stringified out of the box 52 | if(typeof ArrayBuffer !== "undefined" && args[n] instanceof ArrayBuffer) 53 | { 54 | args[n] = base64.fromArrayBuffer(args[n]); 55 | } 56 | 57 | if(typeof args[n] !== "string") 58 | { 59 | args[n] = JSON.stringify(args[n]); 60 | } 61 | } 62 | var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args); 63 | // pass it on to Notify 64 | try { 65 | if(window.external) { 66 | window.external.Notify(command); 67 | } 68 | else { 69 | console.log("window.external not available :: command=" + command); 70 | } 71 | } 72 | catch(e) { 73 | console.log("Exception calling native with command :: " + command + " :: exception=" + e); 74 | } 75 | }; 76 | 77 | -------------------------------------------------------------------------------- /cordova-js-src/platform.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | module.exports = { 23 | id: 'windowsphone', 24 | bootstrap: function() { 25 | var cordova = require('cordova'), 26 | exec = require('cordova/exec'); 27 | 28 | // Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners 29 | var backButtonChannel = cordova.addDocumentEventHandler('backbutton'); 30 | backButtonChannel.onHasSubscribersChange = function() { 31 | exec(null, null, "CoreEvents", "overridebackbutton", [this.numHandlers == 1]); 32 | }; 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /framework/.gitignore: -------------------------------------------------------------------------------- 1 | /_UpgradeReport_Files/ 2 | -------------------------------------------------------------------------------- /framework/Images/appbar.back.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/Images/appbar.back.rest.png -------------------------------------------------------------------------------- /framework/Images/appbar.close.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/Images/appbar.close.rest.png -------------------------------------------------------------------------------- /framework/Images/appbar.feature.video.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/Images/appbar.feature.video.rest.png -------------------------------------------------------------------------------- /framework/Images/appbar.next.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/Images/appbar.next.rest.png -------------------------------------------------------------------------------- /framework/Images/appbar.save.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/Images/appbar.save.rest.png -------------------------------------------------------------------------------- /framework/Images/appbar.stop.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/Images/appbar.stop.rest.png -------------------------------------------------------------------------------- /framework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | using System.Reflection; 15 | using System.Runtime.CompilerServices; 16 | using System.Runtime.InteropServices; 17 | 18 | // General Information about an assembly is controlled through the following 19 | // set of attributes. Change these attribute values to modify the information 20 | // associated with an assembly. 21 | [assembly: AssemblyTitle("WPCordovaClassLib")] 22 | [assembly: AssemblyDescription("0.0.0")] 23 | [assembly: AssemblyConfiguration("")] 24 | [assembly: AssemblyCompany("Apache Cordova")] 25 | [assembly: AssemblyProduct("WPCordovaClassLib")] 26 | [assembly: AssemblyCopyright("")] 27 | [assembly: AssemblyTrademark("")] 28 | [assembly: AssemblyCulture("")] 29 | 30 | // Setting ComVisible to false makes the types in this assembly not visible 31 | // to COM components. If you need to access a type in this assembly from 32 | // COM, set the ComVisible attribute to true on that type. 33 | [assembly: ComVisible(false)] 34 | 35 | // The following GUID is for the ID of the typelib if this project is exposed to COM 36 | [assembly: Guid("633ee7ad-9a75-4b68-96e9-281528c50275")] 37 | 38 | // Version information for an assembly consists of the following four values: 39 | // 40 | // Major Version 41 | // Minor Version 42 | // Build Number 43 | // Revision 44 | // 45 | // You can specify all the values or you can default the Revision and Build Numbers 46 | // by using the '*' as shown below: 47 | [assembly: AssemblyVersion("0.0.0.0")] 48 | [assembly: AssemblyFileVersion("0.0.0.0")] 49 | -------------------------------------------------------------------------------- /framework/WPCordovaClassLib.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Express 2012 for Windows Phone 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 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPCordovaClassLib", "WPCordovaClassLib.csproj", "{FC6A1A70-892D-46AD-9E4A-9793F72AF780}" 22 | EndProject 23 | Global 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|ARM = Debug|ARM 26 | Debug|Any CPU = Debug|Any CPU 27 | Debug|x86 = Debug|x86 28 | Release|ARM = Release|ARM 29 | Release|Any CPU = Release|Any CPU 30 | Release|x86 = Release|x86 31 | EndGlobalSection 32 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 33 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|ARM.ActiveCfg = Debug|ARM 34 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|ARM.Build.0 = Debug|ARM 35 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|x86.ActiveCfg = Debug|x86 38 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|x86.Build.0 = Debug|x86 39 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|ARM.ActiveCfg = Release|ARM 40 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|ARM.Build.0 = Release|ARM 41 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|x86.ActiveCfg = Release|x86 44 | {FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|x86.Build.0 = Release|x86 45 | EndGlobalSection 46 | GlobalSection(SolutionProperties) = preSolution 47 | HideSolutionNode = FALSE 48 | EndGlobalSection 49 | EndGlobal 50 | 51 | 52 | -------------------------------------------------------------------------------- /framework/resources/notification-beep.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/framework/resources/notification-beep.wav -------------------------------------------------------------------------------- /node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/node -------------------------------------------------------------------------------- /node_modules/.bin/nopt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=`dirname "$0"` 3 | 4 | case `uname` in 5 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@" 10 | ret=$? 11 | else 12 | node "$basedir/../nopt/bin/nopt.js" "$@" 13 | ret=$? 14 | fi 15 | exit $ret 16 | -------------------------------------------------------------------------------- /node_modules/.bin/nopt.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe" "%~dp0\..\nopt\bin\nopt.js" %* 3 | ) ELSE ( 4 | node "%~dp0\..\nopt\bin\nopt.js" %* 5 | ) -------------------------------------------------------------------------------- /node_modules/.bin/shjs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=`dirname "$0"` 3 | 4 | case `uname` in 5 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | "$basedir/node" "$basedir/../shelljs/bin/shjs" "$@" 10 | ret=$? 11 | else 12 | node "$basedir/../shelljs/bin/shjs" "$@" 13 | ret=$? 14 | fi 15 | exit $ret 16 | -------------------------------------------------------------------------------- /node_modules/.bin/shjs.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe" "%~dp0\..\shelljs\bin\shjs" %* 3 | ) ELSE ( 4 | node "%~dp0\..\shelljs\bin\shjs" %* 5 | ) -------------------------------------------------------------------------------- /node_modules/node-uuid/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /node_modules/node-uuid/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2012 Robert Kieffer 2 | MIT License - http://opensource.org/licenses/mit-license.php 3 | -------------------------------------------------------------------------------- /node_modules/node-uuid/benchmark/README.md: -------------------------------------------------------------------------------- 1 | # node-uuid Benchmarks 2 | 3 | ### Results 4 | 5 | To see the results of our benchmarks visit https://github.com/broofa/node-uuid/wiki/Benchmark 6 | 7 | ### Run them yourself 8 | 9 | node-uuid comes with some benchmarks to measure performance of generating UUIDs. These can be run using node.js. node-uuid is being benchmarked against some other uuid modules, that are available through npm namely `uuid` and `uuid-js`. 10 | 11 | To prepare and run the benchmark issue; 12 | 13 | ``` 14 | npm install uuid uuid-js 15 | node benchmark/benchmark.js 16 | ``` 17 | 18 | You'll see an output like this one: 19 | 20 | ``` 21 | # v4 22 | nodeuuid.v4(): 854700 uuids/second 23 | nodeuuid.v4('binary'): 788643 uuids/second 24 | nodeuuid.v4('binary', buffer): 1336898 uuids/second 25 | uuid(): 479386 uuids/second 26 | uuid('binary'): 582072 uuids/second 27 | uuidjs.create(4): 312304 uuids/second 28 | 29 | # v1 30 | nodeuuid.v1(): 938086 uuids/second 31 | nodeuuid.v1('binary'): 683060 uuids/second 32 | nodeuuid.v1('binary', buffer): 1644736 uuids/second 33 | uuidjs.create(1): 190621 uuids/second 34 | ``` 35 | 36 | * The `uuid()` entries are for Nikhil Marathe's [uuid module](https://bitbucket.org/nikhilm/uuidjs) which is a wrapper around the native libuuid library. 37 | * The `uuidjs()` entries are for Patrick Negri's [uuid-js module](https://github.com/pnegri/uuid-js) which is a pure javascript implementation based on [UUID.js](https://github.com/LiosK/UUID.js) by LiosK. 38 | 39 | If you want to get more reliable results you can run the benchmark multiple times and write the output into a log file: 40 | 41 | ``` 42 | for i in {0..9}; do node benchmark/benchmark.js >> benchmark/bench_0.4.12.log; done; 43 | ``` 44 | 45 | If you're interested in how performance varies between different node versions, you can issue the above command multiple times. 46 | 47 | You can then use the shell script `bench.sh` provided in this directory to calculate the averages over all benchmark runs and draw a nice plot: 48 | 49 | ``` 50 | (cd benchmark/ && ./bench.sh) 51 | ``` 52 | 53 | This assumes you have [gnuplot](http://www.gnuplot.info/) and [ImageMagick](http://www.imagemagick.org/) installed. You'll find a nice `bench.png` graph in the `benchmark/` directory then. 54 | -------------------------------------------------------------------------------- /node_modules/node-uuid/benchmark/bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # for a given node version run: 4 | # for i in {0..9}; do node benchmark.js >> bench_0.6.2.log; done; 5 | 6 | PATTERNS=('nodeuuid.v1()' "nodeuuid.v1('binary'," 'nodeuuid.v4()' "nodeuuid.v4('binary'," "uuid()" "uuid('binary')" 'uuidjs.create(1)' 'uuidjs.create(4)' '140byte') 7 | FILES=(node_uuid_v1_string node_uuid_v1_buf node_uuid_v4_string node_uuid_v4_buf libuuid_v4_string libuuid_v4_binary uuidjs_v1_string uuidjs_v4_string 140byte_es) 8 | INDICES=(2 3 2 3 2 2 2 2 2) 9 | VERSIONS=$( ls bench_*.log | sed -e 's/^bench_\([0-9\.]*\)\.log/\1/' | tr "\\n" " " ) 10 | TMPJOIN="tmp_join" 11 | OUTPUT="bench_results.txt" 12 | 13 | for I in ${!FILES[*]}; do 14 | F=${FILES[$I]} 15 | P=${PATTERNS[$I]} 16 | INDEX=${INDICES[$I]} 17 | echo "version $F" > $F 18 | for V in $VERSIONS; do 19 | (VAL=$( grep "$P" bench_$V.log | LC_ALL=en_US awk '{ sum += $'$INDEX' } END { print sum/NR }' ); echo $V $VAL) >> $F 20 | done 21 | if [ $I == 0 ]; then 22 | cat $F > $TMPJOIN 23 | else 24 | join $TMPJOIN $F > $OUTPUT 25 | cp $OUTPUT $TMPJOIN 26 | fi 27 | rm $F 28 | done 29 | 30 | rm $TMPJOIN 31 | 32 | gnuplot bench.gnu 33 | convert -density 200 -resize 800x560 -flatten bench.eps bench.png 34 | rm bench.eps 35 | -------------------------------------------------------------------------------- /node_modules/node-uuid/benchmark/benchmark-native.c: -------------------------------------------------------------------------------- 1 | /* 2 | Test performance of native C UUID generation 3 | 4 | To Compile: cc -luuid benchmark-native.c -o benchmark-native 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int main() { 13 | uuid_t myid; 14 | char buf[36+1]; 15 | int i; 16 | struct timeval t; 17 | double start, finish; 18 | 19 | gettimeofday(&t, NULL); 20 | start = t.tv_sec + t.tv_usec/1e6; 21 | 22 | int n = 2e5; 23 | for (i = 0; i < n; i++) { 24 | uuid_generate(myid); 25 | uuid_unparse(myid, buf); 26 | } 27 | 28 | gettimeofday(&t, NULL); 29 | finish = t.tv_sec + t.tv_usec/1e6; 30 | double dur = finish - start; 31 | 32 | printf("%d uuids/sec", (int)(n/dur)); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /node_modules/node-uuid/benchmark/benchmark.js: -------------------------------------------------------------------------------- 1 | try { 2 | var nodeuuid = require('../uuid'); 3 | } catch (e) { 4 | console.error('node-uuid require failed - skipping tests'); 5 | } 6 | 7 | try { 8 | var uuid = require('uuid'); 9 | } catch (e) { 10 | console.error('uuid require failed - skipping tests'); 11 | } 12 | 13 | try { 14 | var uuidjs = require('uuid-js'); 15 | } catch (e) { 16 | console.error('uuid-js require failed - skipping tests'); 17 | } 18 | 19 | var N = 5e5; 20 | 21 | function rate(msg, t) { 22 | console.log(msg + ': ' + 23 | (N / (Date.now() - t) * 1e3 | 0) + 24 | ' uuids/second'); 25 | } 26 | 27 | console.log('# v4'); 28 | 29 | // node-uuid - string form 30 | if (nodeuuid) { 31 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4(); 32 | rate('nodeuuid.v4() - using node.js crypto RNG', t); 33 | 34 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4({rng: nodeuuid.mathRNG}); 35 | rate('nodeuuid.v4() - using Math.random() RNG', t); 36 | 37 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary'); 38 | rate('nodeuuid.v4(\'binary\')', t); 39 | 40 | var buffer = new nodeuuid.BufferClass(16); 41 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary', buffer); 42 | rate('nodeuuid.v4(\'binary\', buffer)', t); 43 | } 44 | 45 | // libuuid - string form 46 | if (uuid) { 47 | for (var i = 0, t = Date.now(); i < N; i++) uuid(); 48 | rate('uuid()', t); 49 | 50 | for (var i = 0, t = Date.now(); i < N; i++) uuid('binary'); 51 | rate('uuid(\'binary\')', t); 52 | } 53 | 54 | // uuid-js - string form 55 | if (uuidjs) { 56 | for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(4); 57 | rate('uuidjs.create(4)', t); 58 | } 59 | 60 | // 140byte.es 61 | for (var i = 0, t = Date.now(); i < N; i++) 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(s,r){r=Math.random()*16|0;return (s=='x'?r:r&0x3|0x8).toString(16)}); 62 | rate('140byte.es_v4', t); 63 | 64 | console.log(''); 65 | console.log('# v1'); 66 | 67 | // node-uuid - v1 string form 68 | if (nodeuuid) { 69 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1(); 70 | rate('nodeuuid.v1()', t); 71 | 72 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary'); 73 | rate('nodeuuid.v1(\'binary\')', t); 74 | 75 | var buffer = new nodeuuid.BufferClass(16); 76 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary', buffer); 77 | rate('nodeuuid.v1(\'binary\', buffer)', t); 78 | } 79 | 80 | // uuid-js - v1 string form 81 | if (uuidjs) { 82 | for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(1); 83 | rate('uuidjs.create(1)', t); 84 | } 85 | -------------------------------------------------------------------------------- /node_modules/node-uuid/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-uuid", 3 | "repo": "broofa/node-uuid", 4 | "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", 5 | "version": "1.4.0", 6 | "author": "Robert Kieffer ", 7 | "contributors": [ 8 | {"name": "Christoph Tavan ", "github": "https://github.com/ctavan"} 9 | ], 10 | "keywords": ["uuid", "guid", "rfc4122"], 11 | "dependencies": {}, 12 | "development": {}, 13 | "main": "uuid.js", 14 | "scripts": [ 15 | "uuid.js" 16 | ], 17 | "license": "MIT" 18 | } -------------------------------------------------------------------------------- /node_modules/node-uuid/test/compare_v1.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | nodeuuid = require('../uuid'), 3 | uuidjs = require('uuid-js'), 4 | libuuid = require('uuid').generate, 5 | util = require('util'), 6 | exec = require('child_process').exec, 7 | os = require('os'); 8 | 9 | // On Mac Os X / macports there's only the ossp-uuid package that provides uuid 10 | // On Linux there's uuid-runtime which provides uuidgen 11 | var uuidCmd = os.type() === 'Darwin' ? 'uuid -1' : 'uuidgen -t'; 12 | 13 | function compare(ids) { 14 | console.log(ids); 15 | for (var i = 0; i < ids.length; i++) { 16 | var id = ids[i].split('-'); 17 | id = [id[2], id[1], id[0]].join(''); 18 | ids[i] = id; 19 | } 20 | var sorted = ([].concat(ids)).sort(); 21 | 22 | if (sorted.toString() !== ids.toString()) { 23 | console.log('Warning: sorted !== ids'); 24 | } else { 25 | console.log('everything in order!'); 26 | } 27 | } 28 | 29 | // Test time order of v1 uuids 30 | var ids = []; 31 | while (ids.length < 10e3) ids.push(nodeuuid.v1()); 32 | 33 | var max = 10; 34 | console.log('node-uuid:'); 35 | ids = []; 36 | for (var i = 0; i < max; i++) ids.push(nodeuuid.v1()); 37 | compare(ids); 38 | 39 | console.log(''); 40 | console.log('uuidjs:'); 41 | ids = []; 42 | for (var i = 0; i < max; i++) ids.push(uuidjs.create(1).toString()); 43 | compare(ids); 44 | 45 | console.log(''); 46 | console.log('libuuid:'); 47 | ids = []; 48 | var count = 0; 49 | var last = function() { 50 | compare(ids); 51 | } 52 | var cb = function(err, stdout, stderr) { 53 | ids.push(stdout.substring(0, stdout.length-1)); 54 | count++; 55 | if (count < max) { 56 | return next(); 57 | } 58 | last(); 59 | }; 60 | var next = function() { 61 | exec(uuidCmd, cb); 62 | }; 63 | next(); 64 | -------------------------------------------------------------------------------- /node_modules/node-uuid/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /node_modules/nopt/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /node_modules/nopt/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 | -------------------------------------------------------------------------------- /node_modules/nopt/bin/nopt.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var nopt = require("../lib/nopt") 3 | , path = require("path") 4 | , types = { num: Number 5 | , bool: Boolean 6 | , help: Boolean 7 | , list: Array 8 | , "num-list": [Number, Array] 9 | , "str-list": [String, Array] 10 | , "bool-list": [Boolean, Array] 11 | , str: String 12 | , clear: Boolean 13 | , config: Boolean 14 | , length: Number 15 | , file: path 16 | } 17 | , shorthands = { s: [ "--str", "astring" ] 18 | , b: [ "--bool" ] 19 | , nb: [ "--no-bool" ] 20 | , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] 21 | , "?": ["--help"] 22 | , h: ["--help"] 23 | , H: ["--help"] 24 | , n: [ "--num", "125" ] 25 | , c: ["--config"] 26 | , l: ["--length"] 27 | , f: ["--file"] 28 | } 29 | , parsed = nopt( types 30 | , shorthands 31 | , process.argv 32 | , 2 ) 33 | 34 | console.log("parsed", parsed) 35 | 36 | if (parsed.help) { 37 | console.log("") 38 | console.log("nopt cli tester") 39 | console.log("") 40 | console.log("types") 41 | console.log(Object.keys(types).map(function M (t) { 42 | var type = types[t] 43 | if (Array.isArray(type)) { 44 | return [t, type.map(function (type) { return type.name })] 45 | } 46 | return [t, type && type.name] 47 | }).reduce(function (s, i) { 48 | s[i[0]] = i[1] 49 | return s 50 | }, {})) 51 | console.log("") 52 | console.log("shorthands") 53 | console.log(shorthands) 54 | } 55 | -------------------------------------------------------------------------------- /node_modules/nopt/examples/my-program.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | //process.env.DEBUG_NOPT = 1 4 | 5 | // my-program.js 6 | var nopt = require("../lib/nopt") 7 | , Stream = require("stream").Stream 8 | , path = require("path") 9 | , knownOpts = { "foo" : [String, null] 10 | , "bar" : [Stream, Number] 11 | , "baz" : path 12 | , "bloo" : [ "big", "medium", "small" ] 13 | , "flag" : Boolean 14 | , "pick" : Boolean 15 | } 16 | , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] 17 | , "b7" : ["--bar", "7"] 18 | , "m" : ["--bloo", "medium"] 19 | , "p" : ["--pick"] 20 | , "f" : ["--flag", "true"] 21 | , "g" : ["--flag"] 22 | , "s" : "--flag" 23 | } 24 | // everything is optional. 25 | // knownOpts and shorthands default to {} 26 | // arg list defaults to process.argv 27 | // slice defaults to 2 28 | , parsed = nopt(knownOpts, shortHands, process.argv, 2) 29 | 30 | console.log("parsed =\n"+ require("util").inspect(parsed)) 31 | -------------------------------------------------------------------------------- /node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | To get started, sign the 3 | Contributor License Agreement. 4 | -------------------------------------------------------------------------------- /node_modules/nopt/node_modules/abbrev/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 | -------------------------------------------------------------------------------- /node_modules/nopt/node_modules/abbrev/README.md: -------------------------------------------------------------------------------- 1 | # abbrev-js 2 | 3 | Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). 4 | 5 | Usage: 6 | 7 | var abbrev = require("abbrev"); 8 | abbrev("foo", "fool", "folding", "flop"); 9 | 10 | // returns: 11 | { fl: 'flop' 12 | , flo: 'flop' 13 | , flop: 'flop' 14 | , fol: 'folding' 15 | , fold: 'folding' 16 | , foldi: 'folding' 17 | , foldin: 'folding' 18 | , folding: 'folding' 19 | , foo: 'foo' 20 | , fool: 'fool' 21 | } 22 | 23 | This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. 24 | -------------------------------------------------------------------------------- /node_modules/nopt/node_modules/abbrev/abbrev.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = exports = abbrev.abbrev = abbrev 3 | 4 | abbrev.monkeyPatch = monkeyPatch 5 | 6 | function monkeyPatch () { 7 | Object.defineProperty(Array.prototype, 'abbrev', { 8 | value: function () { return abbrev(this) }, 9 | enumerable: false, configurable: true, writable: true 10 | }) 11 | 12 | Object.defineProperty(Object.prototype, 'abbrev', { 13 | value: function () { return abbrev(Object.keys(this)) }, 14 | enumerable: false, configurable: true, writable: true 15 | }) 16 | } 17 | 18 | function abbrev (list) { 19 | if (arguments.length !== 1 || !Array.isArray(list)) { 20 | list = Array.prototype.slice.call(arguments, 0) 21 | } 22 | for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { 23 | args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) 24 | } 25 | 26 | // sort them lexicographically, so that they're next to their nearest kin 27 | args = args.sort(lexSort) 28 | 29 | // walk through each, seeing how much it has in common with the next and previous 30 | var abbrevs = {} 31 | , prev = "" 32 | for (var i = 0, l = args.length ; i < l ; i ++) { 33 | var current = args[i] 34 | , next = args[i + 1] || "" 35 | , nextMatches = true 36 | , prevMatches = true 37 | if (current === next) continue 38 | for (var j = 0, cl = current.length ; j < cl ; j ++) { 39 | var curChar = current.charAt(j) 40 | nextMatches = nextMatches && curChar === next.charAt(j) 41 | prevMatches = prevMatches && curChar === prev.charAt(j) 42 | if (!nextMatches && !prevMatches) { 43 | j ++ 44 | break 45 | } 46 | } 47 | prev = current 48 | if (j === cl) { 49 | abbrevs[current] = current 50 | continue 51 | } 52 | for (var a = current.substr(0, j) ; j <= cl ; j ++) { 53 | abbrevs[a] = current 54 | a += current.charAt(j) 55 | } 56 | } 57 | return abbrevs 58 | } 59 | 60 | function lexSort (a, b) { 61 | return a === b ? 0 : a > b ? 1 : -1 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/nopt/node_modules/abbrev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "abbrev", 3 | "version": "1.0.5", 4 | "description": "Like ruby's abbrev module, but in js", 5 | "author": { 6 | "name": "Isaac Z. Schlueter", 7 | "email": "i@izs.me" 8 | }, 9 | "main": "abbrev.js", 10 | "scripts": { 11 | "test": "node test.js" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "http://github.com/isaacs/abbrev-js" 16 | }, 17 | "license": { 18 | "type": "MIT", 19 | "url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE" 20 | }, 21 | "bugs": { 22 | "url": "https://github.com/isaacs/abbrev-js/issues" 23 | }, 24 | "homepage": "https://github.com/isaacs/abbrev-js", 25 | "_id": "abbrev@1.0.5", 26 | "_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03", 27 | "_from": "abbrev@1", 28 | "_npmVersion": "1.4.7", 29 | "_npmUser": { 30 | "name": "isaacs", 31 | "email": "i@izs.me" 32 | }, 33 | "maintainers": [ 34 | { 35 | "name": "isaacs", 36 | "email": "i@izs.me" 37 | } 38 | ], 39 | "dist": { 40 | "shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03", 41 | "tarball": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz" 42 | }, 43 | "directories": {}, 44 | "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz", 45 | "readme": "ERROR: No README data found!" 46 | } 47 | -------------------------------------------------------------------------------- /node_modules/nopt/node_modules/abbrev/test.js: -------------------------------------------------------------------------------- 1 | var abbrev = require('./abbrev.js') 2 | var assert = require("assert") 3 | var util = require("util") 4 | 5 | console.log("TAP Version 13") 6 | var count = 0 7 | 8 | function test (list, expect) { 9 | count++ 10 | var actual = abbrev(list) 11 | assert.deepEqual(actual, expect, 12 | "abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+ 13 | "actual: "+util.inspect(actual)) 14 | actual = abbrev.apply(exports, list) 15 | assert.deepEqual(abbrev.apply(exports, list), expect, 16 | "abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+ 17 | "actual: "+util.inspect(actual)) 18 | console.log('ok - ' + list.join(' ')) 19 | } 20 | 21 | test([ "ruby", "ruby", "rules", "rules", "rules" ], 22 | { rub: 'ruby' 23 | , ruby: 'ruby' 24 | , rul: 'rules' 25 | , rule: 'rules' 26 | , rules: 'rules' 27 | }) 28 | test(["fool", "foom", "pool", "pope"], 29 | { fool: 'fool' 30 | , foom: 'foom' 31 | , poo: 'pool' 32 | , pool: 'pool' 33 | , pop: 'pope' 34 | , pope: 'pope' 35 | }) 36 | test(["a", "ab", "abc", "abcd", "abcde", "acde"], 37 | { a: 'a' 38 | , ab: 'ab' 39 | , abc: 'abc' 40 | , abcd: 'abcd' 41 | , abcde: 'abcde' 42 | , ac: 'acde' 43 | , acd: 'acde' 44 | , acde: 'acde' 45 | }) 46 | 47 | console.log("0..%d", count) 48 | -------------------------------------------------------------------------------- /node_modules/nopt/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nopt", 3 | "version": "3.0.1", 4 | "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", 5 | "author": { 6 | "name": "Isaac Z. Schlueter", 7 | "email": "i@izs.me", 8 | "url": "http://blog.izs.me/" 9 | }, 10 | "main": "lib/nopt.js", 11 | "scripts": { 12 | "test": "tap test/*.js" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "http://github.com/isaacs/nopt" 17 | }, 18 | "bin": { 19 | "nopt": "./bin/nopt.js" 20 | }, 21 | "license": { 22 | "type": "MIT", 23 | "url": "https://github.com/isaacs/nopt/raw/master/LICENSE" 24 | }, 25 | "dependencies": { 26 | "abbrev": "1" 27 | }, 28 | "devDependencies": { 29 | "tap": "~0.4.8" 30 | }, 31 | "gitHead": "4296f7aba7847c198fea2da594f9e1bec02817ec", 32 | "bugs": { 33 | "url": "https://github.com/isaacs/nopt/issues" 34 | }, 35 | "homepage": "https://github.com/isaacs/nopt", 36 | "_id": "nopt@3.0.1", 37 | "_shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd", 38 | "_from": "nopt@~3", 39 | "_npmVersion": "1.4.18", 40 | "_npmUser": { 41 | "name": "isaacs", 42 | "email": "i@izs.me" 43 | }, 44 | "maintainers": [ 45 | { 46 | "name": "isaacs", 47 | "email": "i@izs.me" 48 | } 49 | ], 50 | "dist": { 51 | "shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd", 52 | "tarball": "http://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz" 53 | }, 54 | "directories": {}, 55 | "_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz", 56 | "readme": "ERROR: No README data found!" 57 | } 58 | -------------------------------------------------------------------------------- /node_modules/q/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | For pull requests: 3 | 4 | - Be consistent with prevalent style and design decisions. 5 | - Add a Jasmine spec to `specs/q-spec.js`. 6 | - Use `npm test` to avoid regressions. 7 | - Run tests in `q-spec/run.html` in as many supported browsers as you 8 | can find the will to deal with. 9 | - Do not build minified versions; we do this each release. 10 | - If you would be so kind, add a note to `CHANGES.md` in an 11 | appropriate section: 12 | 13 | - `Next Major Version` if it introduces backward incompatibilities 14 | to code in the wild using documented features. 15 | - `Next Minor Version` if it adds a new feature. 16 | - `Next Patch Version` if it fixes a bug. 17 | 18 | For releases: 19 | 20 | - Run `npm test`. 21 | - Run tests in `q-spec/run.html` in a representative sample of every 22 | browser under the sun. 23 | - Run `npm run cover` and make sure you're happy with the results. 24 | - Run `npm run minify` and be sure to commit the resulting `q.min.js`. 25 | - Note the Gzipped size output by the previous command, and update 26 | `README.md` if it has changed to 1 significant digit. 27 | - Stash any local changes. 28 | - Update `CHANGES.md` to reflect all changes in the differences 29 | between `HEAD` and the previous tagged version. Give credit where 30 | credit is due. 31 | - Update `README.md` to address all new, non-experimental features. 32 | - Update the API reference on the Wiki to reflect all non-experimental 33 | features. 34 | - Use `npm version major|minor|patch` to update `package.json`, 35 | commit, and tag the new version. 36 | - Use `npm publish` to send up a new release. 37 | - Send an email to the q-continuum mailing list announcing the new 38 | release and the notes from the change log. This helps folks 39 | maintaining other package ecosystems. 40 | 41 | -------------------------------------------------------------------------------- /node_modules/q/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved. 2 | Permission is hereby granted, free of charge, to any person obtaining a copy 3 | of this software and associated documentation files (the "Software"), to 4 | deal in the Software without restriction, including without limitation the 5 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 6 | sell copies of the Software, and to permit persons to whom the Software is 7 | furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in 10 | all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 18 | IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /node_modules/q/benchmark/compare-with-callbacks.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var Q = require("../q"); 4 | var fs = require("fs"); 5 | 6 | suite("A single simple async operation", function () { 7 | bench("with an immediately-fulfilled promise", function (done) { 8 | Q().then(done); 9 | }); 10 | 11 | bench("with direct setImmediate usage", function (done) { 12 | setImmediate(done); 13 | }); 14 | 15 | bench("with direct setTimeout(…, 0)", function (done) { 16 | setTimeout(done, 0); 17 | }); 18 | }); 19 | 20 | suite("A fs.readFile", function () { 21 | var denodeified = Q.denodeify(fs.readFile); 22 | 23 | set("iterations", 1000); 24 | set("delay", 1000); 25 | 26 | bench("directly, with callbacks", function (done) { 27 | fs.readFile(__filename, done); 28 | }); 29 | 30 | bench("with Q.nfcall", function (done) { 31 | Q.nfcall(fs.readFile, __filename).then(done); 32 | }); 33 | 34 | bench("with a Q.denodeify'ed version", function (done) { 35 | denodeified(__filename).then(done); 36 | }); 37 | 38 | bench("with manual usage of deferred.makeNodeResolver", function (done) { 39 | var deferred = Q.defer(); 40 | fs.readFile(__filename, deferred.makeNodeResolver()); 41 | deferred.promise.then(done); 42 | }); 43 | }); 44 | 45 | suite("1000 operations in parallel", function () { 46 | function makeCounter(desiredCount, ultimateCallback) { 47 | var soFar = 0; 48 | return function () { 49 | if (++soFar === desiredCount) { 50 | ultimateCallback(); 51 | } 52 | }; 53 | } 54 | var numberOfOps = 1000; 55 | 56 | bench("with immediately-fulfilled promises", function (done) { 57 | var counter = makeCounter(numberOfOps, done); 58 | 59 | for (var i = 0; i < numberOfOps; ++i) { 60 | Q().then(counter); 61 | } 62 | }); 63 | 64 | bench("with direct setImmediate usage", function (done) { 65 | var counter = makeCounter(numberOfOps, done); 66 | 67 | for (var i = 0; i < numberOfOps; ++i) { 68 | setImmediate(counter); 69 | } 70 | }); 71 | }); 72 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/q/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "q", 3 | "version": "1.0.1", 4 | "description": "A library for promises (CommonJS/Promises/A,B,D)", 5 | "homepage": "https://github.com/kriskowal/q", 6 | "author": { 7 | "name": "Kris Kowal", 8 | "email": "kris@cixar.com", 9 | "url": "https://github.com/kriskowal" 10 | }, 11 | "keywords": [ 12 | "q", 13 | "promise", 14 | "promises", 15 | "promises-a", 16 | "promises-aplus", 17 | "deferred", 18 | "future", 19 | "async", 20 | "flow control", 21 | "fluent", 22 | "browser", 23 | "node" 24 | ], 25 | "contributors": [ 26 | { 27 | "name": "Kris Kowal", 28 | "email": "kris@cixar.com", 29 | "url": "https://github.com/kriskowal" 30 | }, 31 | { 32 | "name": "Irakli Gozalishvili", 33 | "email": "rfobic@gmail.com", 34 | "url": "http://jeditoolkit.com" 35 | }, 36 | { 37 | "name": "Domenic Denicola", 38 | "email": "domenic@domenicdenicola.com", 39 | "url": "http://domenicdenicola.com" 40 | } 41 | ], 42 | "bugs": { 43 | "url": "http://github.com/kriskowal/q/issues" 44 | }, 45 | "license": { 46 | "type": "MIT", 47 | "url": "http://github.com/kriskowal/q/raw/master/LICENSE" 48 | }, 49 | "main": "q.js", 50 | "repository": { 51 | "type": "git", 52 | "url": "git://github.com/kriskowal/q.git" 53 | }, 54 | "engines": { 55 | "node": ">=0.6.0", 56 | "teleport": ">=0.2.0" 57 | }, 58 | "dependencies": {}, 59 | "devDependencies": { 60 | "jshint": "~2.1.9", 61 | "cover": "*", 62 | "jasmine-node": "1.11.0", 63 | "opener": "*", 64 | "promises-aplus-tests": "1.x", 65 | "grunt": "~0.4.1", 66 | "grunt-cli": "~0.1.9", 67 | "grunt-contrib-uglify": "~0.2.2", 68 | "matcha": "~0.2.0" 69 | }, 70 | "scripts": { 71 | "test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter", 72 | "test-browser": "opener spec/q-spec.html", 73 | "benchmark": "matcha", 74 | "lint": "jshint q.js", 75 | "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html", 76 | "minify": "grunt", 77 | "prepublish": "grunt" 78 | }, 79 | "overlay": { 80 | "teleport": { 81 | "dependencies": { 82 | "system": ">=0.0.4" 83 | } 84 | } 85 | }, 86 | "directories": { 87 | "test": "./spec" 88 | }, 89 | "_id": "q@1.0.1", 90 | "dist": { 91 | "shasum": "11872aeedee89268110b10a718448ffb10112a14", 92 | "tarball": "http://registry.npmjs.org/q/-/q-1.0.1.tgz" 93 | }, 94 | "_from": "q@~1", 95 | "_npmVersion": "1.4.4", 96 | "_npmUser": { 97 | "name": "kriskowal", 98 | "email": "kris.kowal@cixar.com" 99 | }, 100 | "maintainers": [ 101 | { 102 | "name": "kriskowal", 103 | "email": "kris.kowal@cixar.com" 104 | }, 105 | { 106 | "name": "domenic", 107 | "email": "domenic@domenicdenicola.com" 108 | } 109 | ], 110 | "_shasum": "11872aeedee89268110b10a718448ffb10112a14", 111 | "_resolved": "https://registry.npmjs.org/q/-/q-1.0.1.tgz", 112 | "readme": "ERROR: No README data found!" 113 | } 114 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/.documentup.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ShellJS", 3 | "twitter": [ 4 | "r2r" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /node_modules/shelljs/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "loopfunc": true, 3 | "sub": true, 4 | "undef": true, 5 | "unused": true, 6 | "node": true 7 | } -------------------------------------------------------------------------------- /node_modules/shelljs/.npmignore: -------------------------------------------------------------------------------- 1 | test/ 2 | tmp/ -------------------------------------------------------------------------------- /node_modules/shelljs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | - "0.11" 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/global.js: -------------------------------------------------------------------------------- 1 | var shell = require('./shell.js'); 2 | for (var cmd in shell) 3 | global[cmd] = shell[cmd]; 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shelljs", 3 | "version": "0.3.0", 4 | "author": { 5 | "name": "Artur Adib", 6 | "email": "aadib@mozilla.com" 7 | }, 8 | "description": "Portable Unix shell commands for Node.js", 9 | "keywords": [ 10 | "unix", 11 | "shell", 12 | "makefile", 13 | "make", 14 | "jake", 15 | "synchronous" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "git://github.com/arturadib/shelljs.git" 20 | }, 21 | "license": "BSD*", 22 | "homepage": "http://github.com/arturadib/shelljs", 23 | "main": "./shell.js", 24 | "scripts": { 25 | "test": "node scripts/run-tests" 26 | }, 27 | "bin": { 28 | "shjs": "./bin/shjs" 29 | }, 30 | "dependencies": {}, 31 | "devDependencies": { 32 | "jshint": "~2.1.11" 33 | }, 34 | "optionalDependencies": {}, 35 | "engines": { 36 | "node": ">=0.8.0" 37 | }, 38 | "bugs": { 39 | "url": "https://github.com/arturadib/shelljs/issues" 40 | }, 41 | "_id": "shelljs@0.3.0", 42 | "dist": { 43 | "shasum": "3596e6307a781544f591f37da618360f31db57b1", 44 | "tarball": "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz" 45 | }, 46 | "_from": "shelljs@~0.3", 47 | "_npmVersion": "1.3.11", 48 | "_npmUser": { 49 | "name": "artur", 50 | "email": "arturadib@gmail.com" 51 | }, 52 | "maintainers": [ 53 | { 54 | "name": "artur", 55 | "email": "arturadib@gmail.com" 56 | } 57 | ], 58 | "directories": {}, 59 | "_shasum": "3596e6307a781544f591f37da618360f31db57b1", 60 | "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", 61 | "readme": "ERROR: No README data found!" 62 | } 63 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/shell.js: -------------------------------------------------------------------------------- 1 | // 2 | // ShellJS 3 | // Unix shell commands on top of Node's API 4 | // 5 | // Copyright (c) 2012 Artur Adib 6 | // http://github.com/arturadib/shelljs 7 | // 8 | 9 | var common = require('./src/common'); 10 | 11 | 12 | //@ 13 | //@ All commands run synchronously, unless otherwise stated. 14 | //@ 15 | 16 | //@include ./src/cd 17 | var _cd = require('./src/cd'); 18 | exports.cd = common.wrap('cd', _cd); 19 | 20 | //@include ./src/pwd 21 | var _pwd = require('./src/pwd'); 22 | exports.pwd = common.wrap('pwd', _pwd); 23 | 24 | //@include ./src/ls 25 | var _ls = require('./src/ls'); 26 | exports.ls = common.wrap('ls', _ls); 27 | 28 | //@include ./src/find 29 | var _find = require('./src/find'); 30 | exports.find = common.wrap('find', _find); 31 | 32 | //@include ./src/cp 33 | var _cp = require('./src/cp'); 34 | exports.cp = common.wrap('cp', _cp); 35 | 36 | //@include ./src/rm 37 | var _rm = require('./src/rm'); 38 | exports.rm = common.wrap('rm', _rm); 39 | 40 | //@include ./src/mv 41 | var _mv = require('./src/mv'); 42 | exports.mv = common.wrap('mv', _mv); 43 | 44 | //@include ./src/mkdir 45 | var _mkdir = require('./src/mkdir'); 46 | exports.mkdir = common.wrap('mkdir', _mkdir); 47 | 48 | //@include ./src/test 49 | var _test = require('./src/test'); 50 | exports.test = common.wrap('test', _test); 51 | 52 | //@include ./src/cat 53 | var _cat = require('./src/cat'); 54 | exports.cat = common.wrap('cat', _cat); 55 | 56 | //@include ./src/to 57 | var _to = require('./src/to'); 58 | String.prototype.to = common.wrap('to', _to); 59 | 60 | //@include ./src/toEnd 61 | var _toEnd = require('./src/toEnd'); 62 | String.prototype.toEnd = common.wrap('toEnd', _toEnd); 63 | 64 | //@include ./src/sed 65 | var _sed = require('./src/sed'); 66 | exports.sed = common.wrap('sed', _sed); 67 | 68 | //@include ./src/grep 69 | var _grep = require('./src/grep'); 70 | exports.grep = common.wrap('grep', _grep); 71 | 72 | //@include ./src/which 73 | var _which = require('./src/which'); 74 | exports.which = common.wrap('which', _which); 75 | 76 | //@include ./src/echo 77 | var _echo = require('./src/echo'); 78 | exports.echo = _echo; // don't common.wrap() as it could parse '-options' 79 | 80 | //@include ./src/dirs 81 | var _dirs = require('./src/dirs').dirs; 82 | exports.dirs = common.wrap("dirs", _dirs); 83 | var _pushd = require('./src/dirs').pushd; 84 | exports.pushd = common.wrap('pushd', _pushd); 85 | var _popd = require('./src/dirs').popd; 86 | exports.popd = common.wrap("popd", _popd); 87 | 88 | //@include ./src/ln 89 | var _ln = require('./src/ln'); 90 | exports.ln = common.wrap('ln', _ln); 91 | 92 | //@ 93 | //@ ### exit(code) 94 | //@ Exits the current process with the given exit code. 95 | exports.exit = process.exit; 96 | 97 | //@ 98 | //@ ### env['VAR_NAME'] 99 | //@ Object containing environment variables (both getter and setter). Shortcut to process.env. 100 | exports.env = process.env; 101 | 102 | //@include ./src/exec 103 | var _exec = require('./src/exec'); 104 | exports.exec = common.wrap('exec', _exec, {notUnix:true}); 105 | 106 | //@include ./src/chmod 107 | var _chmod = require('./src/chmod'); 108 | exports.chmod = common.wrap('chmod', _chmod); 109 | 110 | 111 | 112 | //@ 113 | //@ ## Non-Unix commands 114 | //@ 115 | 116 | //@include ./src/tempdir 117 | var _tempDir = require('./src/tempdir'); 118 | exports.tempdir = common.wrap('tempdir', _tempDir); 119 | 120 | 121 | //@include ./src/error 122 | var _error = require('./src/error'); 123 | exports.error = _error; 124 | 125 | 126 | 127 | //@ 128 | //@ ## Configuration 129 | //@ 130 | 131 | exports.config = common.config; 132 | 133 | //@ 134 | //@ ### config.silent 135 | //@ Example: 136 | //@ 137 | //@ ```javascript 138 | //@ var silentState = config.silent; // save old silent state 139 | //@ config.silent = true; 140 | //@ /* ... */ 141 | //@ config.silent = silentState; // restore old silent state 142 | //@ ``` 143 | //@ 144 | //@ Suppresses all command output if `true`, except for `echo()` calls. 145 | //@ Default is `false`. 146 | 147 | //@ 148 | //@ ### config.fatal 149 | //@ Example: 150 | //@ 151 | //@ ```javascript 152 | //@ config.fatal = true; 153 | //@ cp('this_file_does_not_exist', '/dev/null'); // dies here 154 | //@ /* more commands... */ 155 | //@ ``` 156 | //@ 157 | //@ If `true` the script will die on errors. Default is `false`. 158 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/ln.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var common = require('./common'); 4 | var os = require('os'); 5 | 6 | //@ 7 | //@ ### ln(options, source, dest) 8 | //@ ### ln(source, dest) 9 | //@ Available options: 10 | //@ 11 | //@ + `s`: symlink 12 | //@ + `f`: force 13 | //@ 14 | //@ Examples: 15 | //@ 16 | //@ ```javascript 17 | //@ ln('file', 'newlink'); 18 | //@ ln('-sf', 'file', 'existing'); 19 | //@ ``` 20 | //@ 21 | //@ Links source to dest. Use -f to force the link, should dest already exist. 22 | function _ln(options, source, dest) { 23 | options = common.parseOptions(options, { 24 | 's': 'symlink', 25 | 'f': 'force' 26 | }); 27 | 28 | if (!source || !dest) { 29 | common.error('Missing and/or '); 30 | } 31 | 32 | source = path.resolve(process.cwd(), String(source)); 33 | dest = path.resolve(process.cwd(), String(dest)); 34 | 35 | if (!fs.existsSync(source)) { 36 | common.error('Source file does not exist', true); 37 | } 38 | 39 | if (fs.existsSync(dest)) { 40 | if (!options.force) { 41 | common.error('Destination file exists', true); 42 | } 43 | 44 | fs.unlinkSync(dest); 45 | } 46 | 47 | if (options.symlink) { 48 | fs.symlinkSync(source, dest, os.platform() === "win32" ? "junction" : null); 49 | } else { 50 | fs.linkSync(source, dest, os.platform() === "win32" ? "junction" : null); 51 | } 52 | } 53 | module.exports = _ln; 54 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/ls.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | var common = require('./common'); 4 | var _cd = require('./cd'); 5 | var _pwd = require('./pwd'); 6 | 7 | //@ 8 | //@ ### ls([options ,] path [,path ...]) 9 | //@ ### ls([options ,] path_array) 10 | //@ Available options: 11 | //@ 12 | //@ + `-R`: recursive 13 | //@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`) 14 | //@ 15 | //@ Examples: 16 | //@ 17 | //@ ```javascript 18 | //@ ls('projs/*.js'); 19 | //@ ls('-R', '/users/me', '/tmp'); 20 | //@ ls('-R', ['/users/me', '/tmp']); // same as above 21 | //@ ``` 22 | //@ 23 | //@ Returns array of files in the given path, or in current directory if no path provided. 24 | function _ls(options, paths) { 25 | options = common.parseOptions(options, { 26 | 'R': 'recursive', 27 | 'A': 'all', 28 | 'a': 'all_deprecated' 29 | }); 30 | 31 | if (options.all_deprecated) { 32 | // We won't support the -a option as it's hard to image why it's useful 33 | // (it includes '.' and '..' in addition to '.*' files) 34 | // For backwards compatibility we'll dump a deprecated message and proceed as before 35 | common.log('ls: Option -a is deprecated. Use -A instead'); 36 | options.all = true; 37 | } 38 | 39 | if (!paths) 40 | paths = ['.']; 41 | else if (typeof paths === 'object') 42 | paths = paths; // assume array 43 | else if (typeof paths === 'string') 44 | paths = [].slice.call(arguments, 1); 45 | 46 | var list = []; 47 | 48 | // Conditionally pushes file to list - returns true if pushed, false otherwise 49 | // (e.g. prevents hidden files to be included unless explicitly told so) 50 | function pushFile(file, query) { 51 | // hidden file? 52 | if (path.basename(file)[0] === '.') { 53 | // not explicitly asking for hidden files? 54 | if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1)) 55 | return false; 56 | } 57 | 58 | if (common.platform === 'win') 59 | file = file.replace(/\\/g, '/'); 60 | 61 | list.push(file); 62 | return true; 63 | } 64 | 65 | paths.forEach(function(p) { 66 | if (fs.existsSync(p)) { 67 | var stats = fs.statSync(p); 68 | // Simple file? 69 | if (stats.isFile()) { 70 | pushFile(p, p); 71 | return; // continue 72 | } 73 | 74 | // Simple dir? 75 | if (stats.isDirectory()) { 76 | // Iterate over p contents 77 | fs.readdirSync(p).forEach(function(file) { 78 | if (!pushFile(file, p)) 79 | return; 80 | 81 | // Recursive? 82 | if (options.recursive) { 83 | var oldDir = _pwd(); 84 | _cd('', p); 85 | if (fs.statSync(file).isDirectory()) 86 | list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*')); 87 | _cd('', oldDir); 88 | } 89 | }); 90 | return; // continue 91 | } 92 | } 93 | 94 | // p does not exist - possible wildcard present 95 | 96 | var basename = path.basename(p); 97 | var dirname = path.dirname(p); 98 | // Wildcard present on an existing dir? (e.g. '/tmp/*.js') 99 | if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) { 100 | // Escape special regular expression chars 101 | var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1'); 102 | // Translates wildcard into regex 103 | regexp = '^' + regexp.replace(/\*/g, '.*') + '$'; 104 | // Iterate over directory contents 105 | fs.readdirSync(dirname).forEach(function(file) { 106 | if (file.match(new RegExp(regexp))) { 107 | if (!pushFile(path.normalize(dirname+'/'+file), basename)) 108 | return; 109 | 110 | // Recursive? 111 | if (options.recursive) { 112 | var pp = dirname + '/' + file; 113 | if (fs.lstatSync(pp).isDirectory()) 114 | list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*')); 115 | } // recursive 116 | } // if file matches 117 | }); // forEach 118 | return; 119 | } 120 | 121 | common.error('no such file or directory: ' + p, true); 122 | }); 123 | 124 | return list; 125 | } 126 | module.exports = _ls; 127 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/mkdir.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | 5 | // Recursively creates 'dir' 6 | function mkdirSyncRecursive(dir) { 7 | var baseDir = path.dirname(dir); 8 | 9 | // Base dir exists, no recursion necessary 10 | if (fs.existsSync(baseDir)) { 11 | fs.mkdirSync(dir, parseInt('0777', 8)); 12 | return; 13 | } 14 | 15 | // Base dir does not exist, go recursive 16 | mkdirSyncRecursive(baseDir); 17 | 18 | // Base dir created, can create dir 19 | fs.mkdirSync(dir, parseInt('0777', 8)); 20 | } 21 | 22 | //@ 23 | //@ ### mkdir([options ,] dir [, dir ...]) 24 | //@ ### mkdir([options ,] dir_array) 25 | //@ Available options: 26 | //@ 27 | //@ + `p`: full path (will create intermediate dirs if necessary) 28 | //@ 29 | //@ Examples: 30 | //@ 31 | //@ ```javascript 32 | //@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g'); 33 | //@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above 34 | //@ ``` 35 | //@ 36 | //@ Creates directories. 37 | function _mkdir(options, dirs) { 38 | options = common.parseOptions(options, { 39 | 'p': 'fullpath' 40 | }); 41 | if (!dirs) 42 | common.error('no paths given'); 43 | 44 | if (typeof dirs === 'string') 45 | dirs = [].slice.call(arguments, 1); 46 | // if it's array leave it as it is 47 | 48 | dirs.forEach(function(dir) { 49 | if (fs.existsSync(dir)) { 50 | if (!options.fullpath) 51 | common.error('path already exists: ' + dir, true); 52 | return; // skip dir 53 | } 54 | 55 | // Base dir does not exist, and no -p option given 56 | var baseDir = path.dirname(dir); 57 | if (!fs.existsSync(baseDir) && !options.fullpath) { 58 | common.error('no such file or directory: ' + baseDir, true); 59 | return; // skip dir 60 | } 61 | 62 | if (options.fullpath) 63 | mkdirSyncRecursive(dir); 64 | else 65 | fs.mkdirSync(dir, parseInt('0777', 8)); 66 | }); 67 | } // mkdir 68 | module.exports = _mkdir; 69 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/mv.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var common = require('./common'); 4 | 5 | //@ 6 | //@ ### mv(source [, source ...], dest') 7 | //@ ### mv(source_array, dest') 8 | //@ Available options: 9 | //@ 10 | //@ + `f`: force 11 | //@ 12 | //@ Examples: 13 | //@ 14 | //@ ```javascript 15 | //@ mv('-f', 'file', 'dir/'); 16 | //@ mv('file1', 'file2', 'dir/'); 17 | //@ mv(['file1', 'file2'], 'dir/'); // same as above 18 | //@ ``` 19 | //@ 20 | //@ Moves files. The wildcard `*` is accepted. 21 | function _mv(options, sources, dest) { 22 | options = common.parseOptions(options, { 23 | 'f': 'force' 24 | }); 25 | 26 | // Get sources, dest 27 | if (arguments.length < 3) { 28 | common.error('missing and/or '); 29 | } else if (arguments.length > 3) { 30 | sources = [].slice.call(arguments, 1, arguments.length - 1); 31 | dest = arguments[arguments.length - 1]; 32 | } else if (typeof sources === 'string') { 33 | sources = [sources]; 34 | } else if ('length' in sources) { 35 | sources = sources; // no-op for array 36 | } else { 37 | common.error('invalid arguments'); 38 | } 39 | 40 | sources = common.expand(sources); 41 | 42 | var exists = fs.existsSync(dest), 43 | stats = exists && fs.statSync(dest); 44 | 45 | // Dest is not existing dir, but multiple sources given 46 | if ((!exists || !stats.isDirectory()) && sources.length > 1) 47 | common.error('dest is not a directory (too many sources)'); 48 | 49 | // Dest is an existing file, but no -f given 50 | if (exists && stats.isFile() && !options.force) 51 | common.error('dest file already exists: ' + dest); 52 | 53 | sources.forEach(function(src) { 54 | if (!fs.existsSync(src)) { 55 | common.error('no such file or directory: '+src, true); 56 | return; // skip file 57 | } 58 | 59 | // If here, src exists 60 | 61 | // When copying to '/path/dir': 62 | // thisDest = '/path/dir/file1' 63 | var thisDest = dest; 64 | if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) 65 | thisDest = path.normalize(dest + '/' + path.basename(src)); 66 | 67 | if (fs.existsSync(thisDest) && !options.force) { 68 | common.error('dest file already exists: ' + thisDest, true); 69 | return; // skip file 70 | } 71 | 72 | if (path.resolve(src) === path.dirname(path.resolve(thisDest))) { 73 | common.error('cannot move to self: '+src, true); 74 | return; // skip file 75 | } 76 | 77 | fs.renameSync(src, thisDest); 78 | }); // forEach(src) 79 | } // mv 80 | module.exports = _mv; 81 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/popd.js: -------------------------------------------------------------------------------- 1 | // see dirs.js -------------------------------------------------------------------------------- /node_modules/shelljs/src/pushd.js: -------------------------------------------------------------------------------- 1 | // see dirs.js -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/rm.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | // Recursively removes 'dir' 5 | // Adapted from https://github.com/ryanmcgrath/wrench-js 6 | // 7 | // Copyright (c) 2010 Ryan McGrath 8 | // Copyright (c) 2012 Artur Adib 9 | // 10 | // Licensed under the MIT License 11 | // http://www.opensource.org/licenses/mit-license.php 12 | function rmdirSyncRecursive(dir, force) { 13 | var files; 14 | 15 | files = fs.readdirSync(dir); 16 | 17 | // Loop through and delete everything in the sub-tree after checking it 18 | for(var i = 0; i < files.length; i++) { 19 | var file = dir + "/" + files[i], 20 | currFile = fs.lstatSync(file); 21 | 22 | if(currFile.isDirectory()) { // Recursive function back to the beginning 23 | rmdirSyncRecursive(file, force); 24 | } 25 | 26 | else if(currFile.isSymbolicLink()) { // Unlink symlinks 27 | if (force || isWriteable(file)) { 28 | try { 29 | common.unlinkSync(file); 30 | } catch (e) { 31 | common.error('could not remove file (code '+e.code+'): ' + file, true); 32 | } 33 | } 34 | } 35 | 36 | else // Assume it's a file - perhaps a try/catch belongs here? 37 | if (force || isWriteable(file)) { 38 | try { 39 | common.unlinkSync(file); 40 | } catch (e) { 41 | common.error('could not remove file (code '+e.code+'): ' + file, true); 42 | } 43 | } 44 | } 45 | 46 | // Now that we know everything in the sub-tree has been deleted, we can delete the main directory. 47 | // Huzzah for the shopkeep. 48 | 49 | var result; 50 | try { 51 | result = fs.rmdirSync(dir); 52 | } catch(e) { 53 | common.error('could not remove directory (code '+e.code+'): ' + dir, true); 54 | } 55 | 56 | return result; 57 | } // rmdirSyncRecursive 58 | 59 | // Hack to determine if file has write permissions for current user 60 | // Avoids having to check user, group, etc, but it's probably slow 61 | function isWriteable(file) { 62 | var writePermission = true; 63 | try { 64 | var __fd = fs.openSync(file, 'a'); 65 | fs.closeSync(__fd); 66 | } catch(e) { 67 | writePermission = false; 68 | } 69 | 70 | return writePermission; 71 | } 72 | 73 | //@ 74 | //@ ### rm([options ,] file [, file ...]) 75 | //@ ### rm([options ,] file_array) 76 | //@ Available options: 77 | //@ 78 | //@ + `-f`: force 79 | //@ + `-r, -R`: recursive 80 | //@ 81 | //@ Examples: 82 | //@ 83 | //@ ```javascript 84 | //@ rm('-rf', '/tmp/*'); 85 | //@ rm('some_file.txt', 'another_file.txt'); 86 | //@ rm(['some_file.txt', 'another_file.txt']); // same as above 87 | //@ ``` 88 | //@ 89 | //@ Removes files. The wildcard `*` is accepted. 90 | function _rm(options, files) { 91 | options = common.parseOptions(options, { 92 | 'f': 'force', 93 | 'r': 'recursive', 94 | 'R': 'recursive' 95 | }); 96 | if (!files) 97 | common.error('no paths given'); 98 | 99 | if (typeof files === 'string') 100 | files = [].slice.call(arguments, 1); 101 | // if it's array leave it as it is 102 | 103 | files = common.expand(files); 104 | 105 | files.forEach(function(file) { 106 | if (!fs.existsSync(file)) { 107 | // Path does not exist, no force flag given 108 | if (!options.force) 109 | common.error('no such file or directory: '+file, true); 110 | 111 | return; // skip file 112 | } 113 | 114 | // If here, path exists 115 | 116 | var stats = fs.lstatSync(file); 117 | if (stats.isFile() || stats.isSymbolicLink()) { 118 | 119 | // Do not check for file writing permissions 120 | if (options.force) { 121 | common.unlinkSync(file); 122 | return; 123 | } 124 | 125 | if (isWriteable(file)) 126 | common.unlinkSync(file); 127 | else 128 | common.error('permission denied: '+file, true); 129 | 130 | return; 131 | } // simple file 132 | 133 | // Path is an existing directory, but no -r flag given 134 | if (stats.isDirectory() && !options.recursive) { 135 | common.error('path is a directory', true); 136 | return; // skip path 137 | } 138 | 139 | // Recursively remove existing directory 140 | if (stats.isDirectory() && options.recursive) { 141 | rmdirSyncRecursive(file, options.force); 142 | } 143 | }); // forEach(file) 144 | } // rm 145 | module.exports = _rm; 146 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/sed.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### sed([options ,] search_regex, replacement, 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 or function. 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' || typeof replacement === 'function') 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 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/tempdir.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var os = require('os'); 3 | var fs = require('fs'); 4 | 5 | // Returns false if 'dir' is not a writeable directory, 'dir' otherwise 6 | function writeableDir(dir) { 7 | if (!dir || !fs.existsSync(dir)) 8 | return false; 9 | 10 | if (!fs.statSync(dir).isDirectory()) 11 | return false; 12 | 13 | var testFile = dir+'/'+common.randomFileName(); 14 | try { 15 | fs.writeFileSync(testFile, ' '); 16 | common.unlinkSync(testFile); 17 | return dir; 18 | } catch (e) { 19 | return false; 20 | } 21 | } 22 | 23 | 24 | //@ 25 | //@ ### tempdir() 26 | //@ 27 | //@ Examples: 28 | //@ 29 | //@ ```javascript 30 | //@ var tmp = tempdir(); // "/tmp" for most *nix platforms 31 | //@ ``` 32 | //@ 33 | //@ Searches and returns string containing a writeable, platform-dependent temporary directory. 34 | //@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). 35 | function _tempDir() { 36 | var state = common.state; 37 | if (state.tempDir) 38 | return state.tempDir; // from cache 39 | 40 | state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+ 41 | writeableDir(process.env['TMPDIR']) || 42 | writeableDir(process.env['TEMP']) || 43 | writeableDir(process.env['TMP']) || 44 | writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS 45 | writeableDir('C:\\TEMP') || // Windows 46 | writeableDir('C:\\TMP') || // Windows 47 | writeableDir('\\TEMP') || // Windows 48 | writeableDir('\\TMP') || // Windows 49 | writeableDir('/tmp') || 50 | writeableDir('/var/tmp') || 51 | writeableDir('/usr/tmp') || 52 | writeableDir('.'); // last resort 53 | 54 | return state.tempDir; 55 | } 56 | module.exports = _tempDir; 57 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/test.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | 4 | //@ 5 | //@ ### test(expression) 6 | //@ Available expression primaries: 7 | //@ 8 | //@ + `'-b', 'path'`: true if path is a block device 9 | //@ + `'-c', 'path'`: true if path is a character device 10 | //@ + `'-d', 'path'`: true if path is a directory 11 | //@ + `'-e', 'path'`: true if path exists 12 | //@ + `'-f', 'path'`: true if path is a regular file 13 | //@ + `'-L', 'path'`: true if path is a symboilc link 14 | //@ + `'-p', 'path'`: true if path is a pipe (FIFO) 15 | //@ + `'-S', 'path'`: true if path is a socket 16 | //@ 17 | //@ Examples: 18 | //@ 19 | //@ ```javascript 20 | //@ if (test('-d', path)) { /* do something with dir */ }; 21 | //@ if (!test('-f', path)) continue; // skip if it's a regular file 22 | //@ ``` 23 | //@ 24 | //@ Evaluates expression using the available primaries and returns corresponding value. 25 | function _test(options, path) { 26 | if (!path) 27 | common.error('no path given'); 28 | 29 | // hack - only works with unary primaries 30 | options = common.parseOptions(options, { 31 | 'b': 'block', 32 | 'c': 'character', 33 | 'd': 'directory', 34 | 'e': 'exists', 35 | 'f': 'file', 36 | 'L': 'link', 37 | 'p': 'pipe', 38 | 'S': 'socket' 39 | }); 40 | 41 | var canInterpret = false; 42 | for (var key in options) 43 | if (options[key] === true) { 44 | canInterpret = true; 45 | break; 46 | } 47 | 48 | if (!canInterpret) 49 | common.error('could not interpret expression'); 50 | 51 | if (options.link) { 52 | try { 53 | return fs.lstatSync(path).isSymbolicLink(); 54 | } catch(e) { 55 | return false; 56 | } 57 | } 58 | 59 | if (!fs.existsSync(path)) 60 | return false; 61 | 62 | if (options.exists) 63 | return true; 64 | 65 | var stats = fs.statSync(path); 66 | 67 | if (options.block) 68 | return stats.isBlockDevice(); 69 | 70 | if (options.character) 71 | return stats.isCharacterDevice(); 72 | 73 | if (options.directory) 74 | return stats.isDirectory(); 75 | 76 | if (options.file) 77 | return stats.isFile(); 78 | 79 | if (options.pipe) 80 | return stats.isFIFO(); 81 | 82 | if (options.socket) 83 | return stats.isSocket(); 84 | } // test 85 | module.exports = _test; 86 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /node_modules/shelljs/src/which.js: -------------------------------------------------------------------------------- 1 | var common = require('./common'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | 5 | // Cross-platform method for splitting environment PATH variables 6 | function splitPath(p) { 7 | for (i=1;i<2;i++) {} 8 | 9 | if (!p) 10 | return []; 11 | 12 | if (common.platform === 'win') 13 | return p.split(';'); 14 | else 15 | return p.split(':'); 16 | } 17 | 18 | function checkPath(path) { 19 | return fs.existsSync(path) && fs.statSync(path).isDirectory() == false; 20 | } 21 | 22 | //@ 23 | //@ ### which(command) 24 | //@ 25 | //@ Examples: 26 | //@ 27 | //@ ```javascript 28 | //@ var nodeExec = which('node'); 29 | //@ ``` 30 | //@ 31 | //@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions. 32 | //@ Returns string containing the absolute path to the command. 33 | function _which(options, cmd) { 34 | if (!cmd) 35 | common.error('must specify command'); 36 | 37 | var pathEnv = process.env.path || process.env.Path || process.env.PATH, 38 | pathArray = splitPath(pathEnv), 39 | where = null; 40 | 41 | // No relative/absolute paths provided? 42 | if (cmd.search(/\//) === -1) { 43 | // Search for command in PATH 44 | pathArray.forEach(function(dir) { 45 | if (where) 46 | return; // already found it 47 | 48 | var attempt = path.resolve(dir + '/' + cmd); 49 | if (checkPath(attempt)) { 50 | where = attempt; 51 | return; 52 | } 53 | 54 | if (common.platform === 'win') { 55 | var baseAttempt = attempt; 56 | attempt = baseAttempt + '.exe'; 57 | if (checkPath(attempt)) { 58 | where = attempt; 59 | return; 60 | } 61 | attempt = baseAttempt + '.cmd'; 62 | if (checkPath(attempt)) { 63 | where = attempt; 64 | return; 65 | } 66 | attempt = baseAttempt + '.bat'; 67 | if (checkPath(attempt)) { 68 | where = attempt; 69 | return; 70 | } 71 | } // if 'win' 72 | }); 73 | } 74 | 75 | // Command not found anywhere? 76 | if (!checkPath(cmd) && !where) 77 | return null; 78 | 79 | where = where || path.resolve(cmd); 80 | 81 | return common.ShellString(where); 82 | } 83 | module.exports = _which; 84 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-wp8", 3 | "version": "3.9.0-dev", 4 | "description": "cordova-wp8 release", 5 | "main": "bin/create", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/apache/cordova-wp8" 9 | }, 10 | "keywords": [ 11 | "wp8", 12 | "windowsphone", 13 | "cordova", 14 | "apache" 15 | ], 16 | "dependencies": { 17 | "nopt": "~3", 18 | "shelljs": "~0.3", 19 | "node-uuid": "~1.4", 20 | "q": "~1" 21 | }, 22 | "bundledDependencies": [ 23 | "nopt", 24 | "shelljs", 25 | "node-uuid", 26 | "q" 27 | ], 28 | "devDependencies": { 29 | "jasmine-node": "~1", 30 | "jshint": "^2.6.0", 31 | "rewire": ">=2.1.3", 32 | "istanbul": "^0.3.4" 33 | }, 34 | "scripts": { 35 | "test": "npm run jshint && npm run test-unit && npm run test-e2e", 36 | "test-unit": "node node_modules/jasmine-node/lib/jasmine-node/cli.js --captureExceptions spec/unit", 37 | "test-e2e": "node node_modules/jasmine-node/lib/jasmine-node/cli.js --captureExceptions spec/e2e", 38 | "cover": "node node_modules/istanbul/lib/cli.js cover --root template --print detail node_modules/jasmine-node/bin/jasmine-node -- spec/unit", 39 | "jshint": "node node_modules/jshint/bin/jshint bin && node node_modules/jshint/bin/jshint template && node node_modules/jshint/bin/jshint spec" 40 | }, 41 | "author": "Apache Software Foundation", 42 | "license": "Apache Version 2.0" 43 | } 44 | -------------------------------------------------------------------------------- /spec/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true 3 | , "bitwise": true 4 | , "undef": true 5 | , "trailing": true 6 | , "quotmark": true 7 | , "indent": 4 8 | , "unused": "vars" 9 | , "latedef": "nofunc" 10 | , "jasmine": true 11 | } 12 | -------------------------------------------------------------------------------- /spec/e2e/endtoend.spec.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 | var shell = require('shelljs'), 20 | fs = require('fs'), 21 | path = require('path'); 22 | 23 | describe('Cordova create and build', function(){ 24 | 25 | var projectFolder = 'testcreate 応用', 26 | buildDirectory = path.join(__dirname, '../..'), 27 | anycpuPackageFolder = path.join(buildDirectory, projectFolder, 'Bin', 'Debug'), 28 | x86PackageFolder = path.join(buildDirectory, projectFolder, 'Bin', 'x86', 'Debug'), 29 | armPackageFolder = path.join(buildDirectory, projectFolder, 'Bin', 'ARM', 'Debug'), 30 | buildScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'build') + '"', 31 | originalTimeout; 32 | 33 | beforeEach(function(){ 34 | shell.exec(path.join('bin', 'create') + ' "' + projectFolder + '" com.test.app 応用', {silent : true}); 35 | originalTimeout = jasmine.getEnv().defaultTimeoutInterval; 36 | jasmine.getEnv().defaultTimeoutInterval = 30000; 37 | }); 38 | 39 | afterEach(function() { 40 | shell.cd(buildDirectory); 41 | shell.rm('-rf', projectFolder); 42 | jasmine.getEnv().defaultTimeoutInterval = originalTimeout; 43 | }); 44 | 45 | it('spec.1 should create new project', function(){ 46 | expect(fs.existsSync(projectFolder)).toBe(true); 47 | }); 48 | 49 | it('spec.2 should build project', function(){ 50 | shell.exec(buildScriptPath, {silent:true}); 51 | var packages = shell.ls(anycpuPackageFolder); 52 | expect(packages.filter(function(file) { return file.match(/.*AnyCPU\.xap$/); }).length).toBe(1); 53 | }); 54 | 55 | it('spec.3 should build project for particular CPU', function(){ 56 | shell.exec(buildScriptPath + ' --archs=\"x86\"', {silent : true}); 57 | var x86Package = shell.ls(x86PackageFolder); 58 | expect(x86Package.filter(function(file) { return file.match(/.*x86\.xap$/); }).length).toBe(1); 59 | }); 60 | 61 | it('spec.4 should build project for CPUs separated by whitespaces', function(){ 62 | shell.exec(buildScriptPath + ' --archs=\"x86 arm anycpu\"', {silent : true}); 63 | var anycpuPackage = shell.ls(anycpuPackageFolder); 64 | expect(anycpuPackage.filter(function(file) { return file.match(/.*AnyCPU\.xap$/); }).length).toBe(1); 65 | var x86Package = shell.ls(x86PackageFolder); 66 | expect(x86Package.filter(function(file) { return file.match(/.*x86\.xap$/); }).length).toBe(1); 67 | var armPackage = shell.ls(armPackageFolder); 68 | expect(armPackage.filter(function(file) { return file.match(/.*ARM\.xap$/); }).length).toBe(1); 69 | }); 70 | }); 71 | -------------------------------------------------------------------------------- /spec/unit/fixtures/EmptyProject/bin/ARM/Debug/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/spec/unit/fixtures/EmptyProject/bin/ARM/Debug/.gitignore -------------------------------------------------------------------------------- /spec/unit/fixtures/EmptyProject/bin/ARM/Release/CordovaAppProj_Release_ARM.xap: -------------------------------------------------------------------------------- 1 | (dummy package) -------------------------------------------------------------------------------- /spec/unit/fixtures/EmptyProject/bin/Debug/CordovaAppProj_Debug_AnyCPU.xap: -------------------------------------------------------------------------------- 1 | (dummy package) -------------------------------------------------------------------------------- /spec/unit/package.spec.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 | var path = require('path'), 20 | rewire = require('rewire'), 21 | shell = require('shelljs'), 22 | platformRoot = '../../template', 23 | pkgRoot = './template/', 24 | pkgPath = path.join(pkgRoot, 'Bin'), 25 | testPkgPath = './spec/unit/fixtures/EmptyProject/Bin', 26 | pkg = rewire(platformRoot + '/cordova/lib/package.js'); 27 | 28 | function isXapPackage(pack) { 29 | return pack.packagePath.indexOf('.xap') >= 0; 30 | } 31 | 32 | describe('getPackage method', function() { 33 | it('start', function () { 34 | shell.rm('-rf', pkgPath); 35 | shell.cp('-R', testPkgPath, pkgRoot); 36 | }); 37 | 38 | it('spec.1 should find arm release package', function(done) { 39 | var rejected = jasmine.createSpy(); 40 | 41 | pkg.getPackage('release', 'arm') 42 | .then(function(pack) { 43 | expect(isXapPackage(pack)).toBe(true); 44 | }, rejected) 45 | .finally(function() { 46 | expect(rejected).not.toHaveBeenCalled(); 47 | done(); 48 | }); 49 | }); 50 | 51 | it('spec.2 should find anycpu debug package', function(done) { 52 | var rejected = jasmine.createSpy(); 53 | 54 | pkg.getPackage('debug', 'anycpu') 55 | .then(function(pack) { 56 | expect(isXapPackage(pack)).toBe(true); 57 | }, rejected) 58 | .finally(function() { 59 | expect(rejected).not.toHaveBeenCalled(); 60 | done(); 61 | }); 62 | }); 63 | 64 | it('spec.3 should not find x86 release package and reject', function(done) { 65 | var resolved = jasmine.createSpy(); 66 | 67 | pkg.getPackage('release', 'x86') 68 | .then(resolved) 69 | .finally(function() { 70 | expect(resolved).not.toHaveBeenCalled(); 71 | done(); 72 | }); 73 | }); 74 | 75 | it('spec.4 should not find arm debug package and reject', function(done) { 76 | var resolved = jasmine.createSpy(); 77 | 78 | pkg.getPackage('debug', 'arm') 79 | .then(resolved) 80 | .finally(function() { 81 | expect(resolved).not.toHaveBeenCalled(); 82 | done(); 83 | }); 84 | }); 85 | 86 | it('end', function() { 87 | shell.rm('-rf', pkgPath); 88 | }); 89 | }); 90 | -------------------------------------------------------------------------------- /template/App.xaml: -------------------------------------------------------------------------------- 1 |  19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /template/ApplicationIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/ApplicationIcon.png -------------------------------------------------------------------------------- /template/Background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Background.png -------------------------------------------------------------------------------- /template/CordovaWP8Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | # 5 | # Licensed to the Apache Software Foundation (ASF) under one 6 | # or more contributor license agreements. See the NOTICE file 7 | # distributed with this work for additional information 8 | # regarding copyright ownership. The ASF licenses this file 9 | # to you under the Apache License, Version 2.0 (the 10 | # "License"); you may not use this file except in compliance 11 | # with the License. You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, 16 | # software distributed under the License is distributed on an 17 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | # KIND, either express or implied. See the License for the 19 | # specific language governing permissions and limitations 20 | # under the License. 21 | # 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CordovaWP8AppProj", "CordovaWP8AppProj.csproj", "{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}" 23 | EndProject 24 | Global 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 26 | Debug|Any CPU = Debug|Any CPU 27 | Debug|ARM = Debug|ARM 28 | Debug|x64 = Debug|x64 29 | Debug|x86 = Debug|x86 30 | Release|Any CPU = Release|Any CPU 31 | Release|ARM = Release|ARM 32 | Release|x64 = Release|x64 33 | Release|x86 = Release|x86 34 | EndGlobalSection 35 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 36 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 39 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|ARM.ActiveCfg = Debug|ARM 40 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|ARM.Build.0 = Debug|ARM 41 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|ARM.Deploy.0 = Debug|ARM 42 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x64.ActiveCfg = Debug|x64 43 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x64.Build.0 = Debug|x64 44 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x64.Deploy.0 = Debug|x64 45 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x86.ActiveCfg = Debug|x86 46 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x86.Build.0 = Debug|x86 47 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x86.Deploy.0 = Debug|x86 48 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|Any CPU.Build.0 = Release|Any CPU 50 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|Any CPU.Deploy.0 = Release|Any CPU 51 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|ARM.ActiveCfg = Release|ARM 52 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|ARM.Build.0 = Release|ARM 53 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|ARM.Deploy.0 = Release|ARM 54 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x64.ActiveCfg = Release|x64 55 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x64.Build.0 = Release|x64 56 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x64.Deploy.0 = Release|x64 57 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x86.ActiveCfg = Release|x86 58 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x86.Build.0 = Release|x86 59 | {3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x86.Deploy.0 = Release|x86 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | EndGlobal 65 | -------------------------------------------------------------------------------- /template/Images/appbar.back.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Images/appbar.back.rest.png -------------------------------------------------------------------------------- /template/Images/appbar.close.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Images/appbar.close.rest.png -------------------------------------------------------------------------------- /template/Images/appbar.feature.video.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Images/appbar.feature.video.rest.png -------------------------------------------------------------------------------- /template/Images/appbar.next.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Images/appbar.next.rest.png -------------------------------------------------------------------------------- /template/Images/appbar.save.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Images/appbar.save.rest.png -------------------------------------------------------------------------------- /template/Images/appbar.stop.rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/Images/appbar.stop.rest.png -------------------------------------------------------------------------------- /template/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 19 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /template/MainPage.xaml.cs: -------------------------------------------------------------------------------- 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 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Net; 24 | using System.Windows; 25 | using System.Windows.Controls; 26 | using System.Windows.Documents; 27 | using System.Windows.Input; 28 | using System.Windows.Media; 29 | using System.Windows.Media.Animation; 30 | using System.Windows.Shapes; 31 | using Microsoft.Phone.Controls; 32 | using System.IO; 33 | using System.Windows.Media.Imaging; 34 | using System.Windows.Resources; 35 | 36 | 37 | namespace $safeprojectname$ 38 | { 39 | public partial class MainPage : PhoneApplicationPage 40 | { 41 | // Constructor 42 | public MainPage() 43 | { 44 | InitializeComponent(); 45 | this.CordovaView.Loaded += CordovaView_Loaded; 46 | } 47 | 48 | private void CordovaView_Loaded(object sender, RoutedEventArgs e) 49 | { 50 | this.CordovaView.Loaded -= CordovaView_Loaded; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /template/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  14 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /template/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | using System.Reflection; 15 | using System.Runtime.CompilerServices; 16 | using System.Runtime.InteropServices; 17 | using System.Resources; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("CordovaAppProj")] 23 | [assembly: AssemblyDescription("2.0.0.0")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("Apache Cordova")] 26 | [assembly: AssemblyProduct("CordovaAppProj")] 27 | [assembly: AssemblyCopyright("Copyright © Apache Cordova 2013")] 28 | [assembly: AssemblyTrademark("Apache Cordova")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | 32 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 33 | 34 | // Setting ComVisible to false makes the types in this assembly not visible 35 | // to COM components. If you need to access a type in this assembly from 36 | // COM, set the ComVisible attribute to true on that type. 37 | [assembly: ComVisible(false)] 38 | 39 | // The following GUID is for the ID of the typelib if this project is exposed to COM 40 | [assembly: Guid("9e27b972-0825-4386-ba17-63c695262c3d")] 41 | 42 | // Version information for an assembly consists of the following four values: 43 | // 44 | // Major Version 45 | // Minor Version 46 | // Build Number 47 | // Revision 48 | // 49 | // You can specify all the values or you can default the Revision and Build Numbers 50 | // by using the '*' as shown below: 51 | [assembly: AssemblyVersion("1.0.0.0")] 52 | [assembly: AssemblyFileVersion("1.0.0.0")] 53 | -------------------------------------------------------------------------------- /template/Properties/WMAppManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 16 | 17 | 18 | 19 | 20 | 21 | ApplicationIcon.png 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Background.png 33 | 0 34 | Background.png 35 | $safeprojectname$ 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | false 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /template/SplashScreenImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/SplashScreenImage.jpg -------------------------------------------------------------------------------- /template/__PreviewImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/__PreviewImage.jpg -------------------------------------------------------------------------------- /template/__TemplateIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/__TemplateIcon.png -------------------------------------------------------------------------------- /template/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 | args = process.argv; 24 | 25 | // Handle help flag 26 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) { 27 | build.help(); 28 | } else { 29 | build.run(args).done(null, function(err) { 30 | var errorMessage = (err && err.stack) ? err.stack : err; 31 | console.error('ERROR: ' + errorMessage); 32 | process.exit(2); 33 | }); 34 | } -------------------------------------------------------------------------------- /template/cordova/build.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0build" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'build' in cordova, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/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 | 24 | clean.run(process.argv).done(null, function(err) { 25 | console.error('ERROR: ' + err); 26 | process.exit(2); 27 | }); -------------------------------------------------------------------------------- /template/cordova/clean.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0clean" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordova/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /template/cordova/lib/MSBuildTools.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 | var Q = require('q'), 21 | path = require('path'), 22 | utils = require('./utils'); 23 | 24 | function MSBuildTools (version, path) { 25 | this.version = version; 26 | this.path = path; 27 | } 28 | 29 | MSBuildTools.prototype.buildProject = function(projFile, buildType, buildarch) { 30 | console.log('\nBuilding project: ' + projFile); 31 | console.log('\tConfiguration : ' + buildType); 32 | console.log('\tPlatform : ' + buildarch); 33 | 34 | var args = ['/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal', '/nologo', 35 | '/p:Configuration=' + buildType, 36 | '/p:Platform=' + buildarch]; 37 | 38 | return utils.spawn(path.join(this.path, 'msbuild'), [projFile].concat(args)); 39 | }; 40 | 41 | // returns full path to msbuild tools required to build the project and tools version 42 | module.exports.findAvailableVersion = function (searchFor32Bit) { 43 | var versions = ['14.0', '12.0', '4.0']; 44 | 45 | return Q.all(versions.map(function (version) { 46 | return checkMSBuildVersion(version, searchFor32Bit); 47 | })) 48 | .then(function (versions) { 49 | // select first msbuild version available, and resolve promise with it 50 | var msbuildTools = versions[0] || versions[1] || versions[2]; 51 | return msbuildTools ? Q.resolve(msbuildTools) : Q.reject('MSBuild tools not found'); 52 | }); 53 | }; 54 | 55 | function checkMSBuildVersion(version, searchFor32Bit) { 56 | var deferred = Q.defer(); 57 | 58 | var regRoot = searchFor32Bit ? 'HKLM\\SOFTWARE\\Wow6432Node' : 'HKLM\\SOFTWARE'; 59 | 60 | utils.exec('reg query ' + regRoot + '\\Microsoft\\MSBuild\\ToolsVersions\\' + version + ' /v MSBuildToolsPath') 61 | .then(function(output) { 62 | // fetch msbuild path from 'reg' output 63 | var path = /MSBuildToolsPath\s+REG_SZ\s+(.*)/i.exec(output); 64 | if (path) { 65 | deferred.resolve(new MSBuildTools(version, path[1])); 66 | return; 67 | } 68 | deferred.resolve(null); // not found 69 | }, function () { 70 | deferred.resolve(null); 71 | }); 72 | return deferred.promise; 73 | } -------------------------------------------------------------------------------- /template/cordova/lib/build.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 | /* jshint sub:true */ 21 | 22 | var Q = require('q'), 23 | path = require('path'), 24 | nopt = require('nopt'), 25 | utils = require('./utils'), 26 | shell = require('shelljs'), 27 | MSBuildTools = require('./MSBuildTools'); 28 | 29 | // Platform project root folder 30 | var ROOT = path.join(__dirname, '..', '..'); 31 | 32 | function parseAndValidateArgs(argv) { 33 | // parse and validate args 34 | var args = nopt({'debug': Boolean, 'release': Boolean, 'archs': [String]}, {'-r': '--release'}, argv); 35 | // Validate args 36 | if (args.debug && args.release) { 37 | return Q.reject('Only one of "debug"/"release" options should be specified'); 38 | } 39 | // get build options/defaults and resolvew with buildopts object 40 | return Q.resolve({ 41 | buildType: args.release ? 'release' : 'debug', 42 | buildArchs: args.archs ? args.archs.split(' ') : ['anycpu'], 43 | }); 44 | } 45 | 46 | // help/usage function 47 | module.exports.help = function () { 48 | console.log(''); 49 | console.log('Usage: build [ --debug | --release ] [--archs=""]'); 50 | console.log(' --help : Displays this dialog.'); 51 | console.log(' --debug : Cleans and builds project in debug mode.'); 52 | console.log(' --release : Cleans and builds project in release mode.'); 53 | console.log(' --release : Cleans and builds project in release mode.'); 54 | console.log(' --archs : Builds project binaries for specific chip architectures. `arm` and `x86` are supported for wp8'); 55 | console.log('examples:'); 56 | console.log(' build '); 57 | console.log(' build --debug'); 58 | console.log(' build --release'); 59 | console.log(' build --release --archs="arm x86"'); 60 | console.log(''); 61 | }; 62 | 63 | // builds cordova-windows application with parameters provided. 64 | // See 'help' function for args list 65 | module.exports.run = function (argv) { 66 | if (!utils.isCordovaProject(ROOT)){ 67 | return Q.reject('Could not find project at ' + ROOT); 68 | } 69 | 70 | return parseAndValidateArgs(argv) 71 | .then(function (buildopts) { 72 | // WP8 requires x86 version of MSBuild, CB-6732 73 | var is64bitSystem = process.env['PROCESSOR_ARCHITECTURE'] != 'x86'; 74 | 75 | // Get available msbuild tools 76 | return MSBuildTools.findAvailableVersion(is64bitSystem) 77 | .then(function (msbuildTools) { 78 | // then build all architectures specified 79 | // chain promises each after previous with reduce function 80 | return buildopts.buildArchs.reduce(function (promise, buildarch) { 81 | return promise.then(function () { 82 | buildarch = buildarch == 'anycpu' ? 'any cpu' : buildarch; 83 | // search for first solution file found 84 | // this is performed due to solution file can be renamed in create 85 | var solutionFiles = shell.ls(path.join(ROOT, '*.sln')); 86 | if (solutionFiles && solutionFiles[0]) { 87 | return msbuildTools.buildProject(solutionFiles[0], buildopts.buildType, buildarch); 88 | } 89 | return Q.reject('No solution files found in project directory'); 90 | }); 91 | }, Q()); 92 | }); 93 | }); 94 | }; -------------------------------------------------------------------------------- /template/cordova/lib/clean.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 | var Q = require('q'), 21 | path = require('path'), 22 | shell = require('shelljs'); 23 | 24 | var ROOT = path.join(__dirname, '..', '..'); 25 | 26 | module.exports.run = function (argv) { 27 | var projectPath = ROOT; 28 | ['obj', 'Bin'].forEach(function(dir) { 29 | shell.rm('-rf', path.join(projectPath, dir)); 30 | }); 31 | return Q.resolve(); 32 | }; -------------------------------------------------------------------------------- /template/cordova/lib/device.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 | var Q = require('q'), 21 | utils = require('./utils'); 22 | 23 | // returns one of available devices which name match with parovided string 24 | // return rejected promise if device with name specified not found 25 | module.exports.findDevice = function (target) { 26 | target = target.toLowerCase(); 27 | return module.exports.listDevices().then(function(deviceList) { 28 | // CB-7616 since we use partial match shorter names should go first, 29 | // example case is ['Emulator WVGA 512MB', 'Emulator WVGA'] 30 | var sortedList = deviceList.concat().sort(function (l, r) { return l.length > r.length; }); 31 | for (var idx in sortedList) { 32 | if (sortedList[idx].toLowerCase().indexOf(target) > -1) { 33 | // we should return index based on original list 34 | return Q.resolve(deviceList.indexOf(sortedList[idx])); 35 | } 36 | } 37 | return Q.reject('Specified device not found'); 38 | }); 39 | }; 40 | 41 | // returns array of available devices names 42 | module.exports.listDevices = function () { 43 | return utils.getXapDeploy() 44 | .then(function(xapDeploy) { 45 | return utils.exec('"' + xapDeploy + '" /enumeratedevices') 46 | .then(function(output) { 47 | return Q.resolve(output.split('\n').map(function(line) { 48 | var match = /\s*(\d)+\s+(.*)/.exec(line); 49 | return match && match[2]; 50 | }).filter(function (line) { 51 | return line; 52 | })); 53 | }); 54 | }); 55 | }; -------------------------------------------------------------------------------- /template/cordova/lib/install-device.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0\..\run" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* --device --nobuild 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'deploy' in cordova, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordova/lib/install-emulator.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0\..\run" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* --emulator --nobuild 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'run' in cordova, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordova/lib/list-devices.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0target-list.js" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* --devices 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'target-list.js' in cordova/lib, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordova/lib/list-emulator-images.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0target-list.js" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* --emulators 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'target-list.js' in cordova/lib, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordova/lib/list-started-emulators.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | ECHO Sorry, list-started-emulators is not availible yet for Windows Phone. 1>&2 24 | EXIT /B 1 -------------------------------------------------------------------------------- /template/cordova/lib/package.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 | var Q = require('q'), 21 | fs = require('fs'), 22 | path = require('path'), 23 | shell = require('shelljs'), 24 | device = require ('./device'), 25 | utils = require('./utils'); 26 | 27 | function Package (packagepath) { 28 | this.packagePath = packagepath; 29 | } 30 | 31 | Package.prototype.deployTo = function (deployTarget) { 32 | var pkg = this; 33 | return utils.getXapDeploy() 34 | .then(function (xapDeploy) { 35 | var getTarget = deployTarget == 'device' ? Q('de') : 36 | deployTarget == 'emulator' ? Q('xd') : device.findDevice(deployTarget); 37 | 38 | return getTarget.then(function (target) { 39 | return utils.spawn(xapDeploy, ['/installlaunch', pkg.packagePath, '/targetdevice:' + target]); 40 | }); 41 | }); 42 | }; 43 | 44 | // returns full path to package with chip architecture, build and project types specified 45 | module.exports.getPackage = function (buildtype, buildarch) { 46 | var projectPath = path.resolve(path.join(__dirname, '..', '..')); 47 | var buildFolder = buildarch.toLowerCase() == 'anycpu' ? 48 | path.join(projectPath, 'Bin', buildtype) : 49 | path.join(projectPath, 'Bin', buildarch, buildtype); 50 | 51 | // reject promise if buildFolder folder doesn't exists 52 | if (!fs.existsSync(buildFolder)) { 53 | return Q.reject('Directory with build artefacts doesn\'t exists'); 54 | } 55 | 56 | // search for first .appx file in specified folder 57 | var appxFiles = shell.ls(path.join(buildFolder, '*.xap')); 58 | if (appxFiles && appxFiles[0]) { 59 | // resolve with full path to file if found 60 | return Q.resolve(new Package(appxFiles[0])); 61 | } 62 | // else reject with error 63 | return Q.reject('Can\'t find package with ' + buildtype + ' build type and ' + buildarch + ' chip architecture'); 64 | }; 65 | -------------------------------------------------------------------------------- /template/cordova/lib/run.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 | var Q = require('q'), 21 | nopt = require('nopt'), 22 | path = require('path'), 23 | build = require('./build'), 24 | utils = require('./utils'), 25 | packages = require('./package'); 26 | 27 | var ROOT = path.join(__dirname, '..', '..'); 28 | 29 | module.exports.run = function (argv) { 30 | if (!utils.isCordovaProject(ROOT)) { 31 | return Q.reject('Could not find project at ' + ROOT); 32 | } 33 | 34 | // parse args 35 | var args = nopt({'debug': Boolean, 'release': Boolean, 'nobuild': Boolean, 36 | 'device': Boolean, 'emulator': Boolean, 'target': String, 'archs': String}, 37 | {'r' : '--release'}, argv); 38 | 39 | // Validate args 40 | if (args.debug && args.release) { 41 | return Q.reject('Only one of "debug"/"release" options should be specified'); 42 | } 43 | if ((args.device && args.emulator) || ((args.device || args.emulator) && args.target)) { 44 | return Q.reject('Only one of "device"/"emulator"/"target" options should be specified'); 45 | } 46 | 47 | // Get build/deploy options 48 | var buildType = args.release ? 'release' : 'debug', 49 | buildArchs = args.archs ? args.archs.split(' ') : ['anycpu']; 50 | 51 | // if --nobuild isn't specified then build app first 52 | var buildPackages = args.nobuild ? Q() : build.run(argv); 53 | 54 | return buildPackages 55 | .then(function () { 56 | return packages.getPackage(buildType, buildArchs[0]); 57 | }) 58 | .then(function (builtPackage) { 59 | // Get deploy options 60 | var deployTarget = args.target ? args.target : args.device ? 'device' : 61 | args.emulator ? 'emulator' : null; 62 | 63 | if (deployTarget) { 64 | console.log('\nDeploying package to ' + deployTarget); 65 | return builtPackage.deployTo(deployTarget); 66 | } 67 | // no deploy target specified - try device first & then emulator 68 | console.log('\nTrying to deploy to device'); 69 | return builtPackage.deployTo('device').catch(function (error) { 70 | console.log(error); 71 | console.log('\nFalling back to deploy to emulator instead'); 72 | return builtPackage.deployTo('emulator'); 73 | }); 74 | }); 75 | }; 76 | 77 | module.exports.help = function () { 78 | console.log(''); 79 | console.log('Usage:'); 80 | console.log(' run [ --device || --emulator || --target= ] '); 81 | console.log(' [ --debug || --release || --nobuild ]'); 82 | console.log(' [--archs=\"\"]'); 83 | console.log(' --device : Deploys and runs the project on the connected device.'); 84 | console.log(' --emulator : [DEFAULT] Deploys and runs the project on an emulator.'); 85 | console.log(' --target= : Deploys and runs the project on the specified target.'); 86 | console.log(' --debug : [DEFAULT] Builds project in debug mode.'); 87 | console.log(' --release : Builds project in release mode.'); 88 | console.log(' --nobuild : Ueses pre-built xap, or errors if project is not built.'); 89 | console.log(' --archs : Builds project binaries for specific chip architectures.'); 90 | console.log(' Deploys and runs package with first architecture specified.'); 91 | console.log(' arm` and `x86` are supported for wp8'); 92 | console.log('Examples:'); 93 | console.log(' run'); 94 | console.log(' run --emulator'); 95 | console.log(' run --device'); 96 | console.log(' run --target=7988B8C3-3ADE-488d-BA3E-D052AC9DC710'); 97 | console.log(' run --device --release'); 98 | console.log(' run --emulator --debug'); 99 | console.log(''); 100 | }; -------------------------------------------------------------------------------- /template/cordova/lib/start-emulator.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | ECHO Sorry, start-emulator is not availible yet for Windows Phone. 1>&2 24 | EXIT /B 1 -------------------------------------------------------------------------------- /template/cordova/lib/target-list.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 | var devices = require('./device'), 21 | args = process.argv.slice(2); 22 | 23 | // help/usage function 24 | function help() { 25 | console.log(''); 26 | console.log('Usage: node target-list.js [ --emulators | --devices | --started_emulators | --all ]'); 27 | console.log(' --emulators : List the possible target emulators availible.'); 28 | console.log(' --devices : List the possible target devices availible. *NOT IMPLEMENTED YET*'); 29 | console.log(' --started_emulators : List any started emulators availible. *NOT IMPLEMENTED YET*'); 30 | console.log(' --all : List all devices returned by CordovaDeploy.exe -devices '); 31 | console.log('examples:'); 32 | console.log(' node target-list.js --emulators'); 33 | console.log(' node target-list.js --devices'); 34 | console.log(' node target-list.js --started_emulators'); 35 | console.log(' node target-list.js --all'); 36 | console.log(''); 37 | } 38 | 39 | // Handle help flag 40 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[0]) > -1) { 41 | help(); 42 | } else { 43 | devices.listDevices() 44 | .then(function (deviceList) { 45 | deviceList.forEach(function (device) { 46 | console.log(device); 47 | }); 48 | }); 49 | } -------------------------------------------------------------------------------- /template/cordova/lib/win_os_version.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 | var utils = require('./utils'); 21 | 22 | utils.getOSVersion().then(function (version) { 23 | console.log(version); 24 | }, function (err) { 25 | console.error(err); 26 | process.exit(2); 27 | }); 28 | -------------------------------------------------------------------------------- /template/cordova/lib/win_sdk_version.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 | var utils = require('./utils'); 21 | 22 | utils.getSDKVersion().then(function (version) { 23 | console.log(version); 24 | }, function (err) { 25 | console.error(err); 26 | process.exit(2); 27 | }); 28 | -------------------------------------------------------------------------------- /template/cordova/log.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | @ECHO OFF 24 | ECHO Sorry, logging is not supported for Windows Phone. 1>&2 25 | EXIT /B 1 -------------------------------------------------------------------------------- /template/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 args = process.argv, 23 | run = require('./lib/run'); 24 | 25 | // Handle help flag 26 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) { 27 | run.help(); 28 | } else { 29 | run.run(args).done(null, function (err) { 30 | var errorMessage = (err && err.stack) ? err.stack : err; 31 | console.error('ERROR: ' + errorMessage); 32 | process.exit(2); 33 | }); 34 | } -------------------------------------------------------------------------------- /template/cordova/run.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0run" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'run' in cordova, aborting...>&2 29 | EXIT /B 1 30 | ) 31 | -------------------------------------------------------------------------------- /template/cordova/version.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | @ECHO OFF 24 | SET script_path="%~dp0..\VERSION" 25 | IF EXIST %script_path% ( 26 | type %script_path% 27 | ) ELSE ( 28 | ECHO. 29 | ECHO ERROR: Could not find file VERSION in project folder, path tried was %script_path% >&2 30 | EXIT /B 1 31 | ) -------------------------------------------------------------------------------- /template/cordova/win_os_version.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0lib\win_os_version.js" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'win_os_version.js' in 'bin' folder, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordova/win_sdk_version.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | goto endheader 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 | :endheader 22 | 23 | SET script_path="%~dp0lib\win_sdk_version.js" 24 | IF EXIST %script_path% ( 25 | node %script_path% %* 26 | ) ELSE ( 27 | ECHO. 28 | ECHO ERROR: Could not find 'win_sdk_version.js' in 'bin' folder, aborting...>&2 29 | EXIT /B 1 30 | ) -------------------------------------------------------------------------------- /template/cordovalib/CordovaCommandCall.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | using System; 16 | using System.Net; 17 | using System.Windows; 18 | using System.Windows.Controls; 19 | using System.Windows.Documents; 20 | using System.Windows.Ink; 21 | using System.Windows.Input; 22 | using System.Windows.Media; 23 | using System.Windows.Media.Animation; 24 | using System.Windows.Shapes; 25 | using System.Linq; 26 | using System.Collections.Generic; 27 | 28 | namespace WPCordovaClassLib.Cordova 29 | { 30 | /// 31 | /// Represents Cordova native command call: action callback, etc 32 | /// 33 | public class CordovaCommandCall 34 | { 35 | public String Service { get; private set; } 36 | public String Action { get; private set; } 37 | public String CallbackId { get; private set; } 38 | public String Args { get; private set; } 39 | public String Namespace { get; set; } 40 | 41 | /// 42 | /// Retrieves command call parameters and creates wrapper for them 43 | /// 44 | /// Command string in the form 'service/action/callback/args' 45 | /// New class instance or null of string does not represent Cordova command 46 | public static CordovaCommandCall Parse(string commandStr) 47 | { 48 | //System.Diagnostics.Debug.WriteLine("CommandString : " + commandStr); 49 | if (string.IsNullOrEmpty(commandStr)) 50 | { 51 | return null; 52 | } 53 | 54 | string[] split = commandStr.Split('/'); 55 | if (split.Length < 3) 56 | { 57 | return null; 58 | } 59 | 60 | CordovaCommandCall commandCallParameters = new CordovaCommandCall(); 61 | commandCallParameters.Service = split[0]; 62 | commandCallParameters.Action = split[1]; 63 | commandCallParameters.CallbackId = split[2]; 64 | commandCallParameters.Namespace = String.Empty; 65 | 66 | try 67 | { 68 | string arg = split.Length <= 3 ? "[]" : String.Join("/", split.Skip(3)); 69 | if (!arg.StartsWith("[")) // save the exception 70 | { 71 | arg = string.Format("[{0}]", arg); 72 | } 73 | List args = JSON.JsonHelper.Deserialize>(arg); 74 | args.Add(commandCallParameters.CallbackId); 75 | commandCallParameters.Args = JSON.JsonHelper.Serialize(args.ToArray()); 76 | } 77 | catch (Exception) 78 | { 79 | return null; 80 | } 81 | // sanity check for illegal names 82 | // was failing with :: 83 | // CordovaCommandResult :: 1, Device1, {"status":1,"message":"{\"name\":\"XD..... 84 | if (commandCallParameters.Service.IndexOfAny(new char[] { '@', ':', ',', '!', ' ' }) > -1) 85 | { 86 | return null; 87 | } 88 | 89 | return commandCallParameters; 90 | } 91 | 92 | 93 | /// 94 | /// Private ctr to disable class creation. 95 | /// New class instance must be initialized via CordovaCommandCall.Parse static method. 96 | /// 97 | private CordovaCommandCall() { } 98 | 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /template/cordovalib/CordovaView.xaml: -------------------------------------------------------------------------------- 1 |  19 | 30 | 31 | 32 | 33 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /template/cordovalib/IBrowserDecorator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | using Microsoft.Phone.Controls; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace WPCordovaClassLib.CordovaLib 23 | { 24 | interface IBrowserDecorator 25 | { 26 | WebBrowser Browser { get; set; } 27 | void InjectScript(); 28 | bool HandleCommand(string cmd); 29 | void AttachNativeHandlers(); 30 | void DetachNativeHandlers(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /template/cordovalib/JSON/JsonHelper.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | using System; 16 | using System.Runtime.Serialization.Json; 17 | using System.IO; 18 | using System.Text; 19 | using System.Diagnostics; 20 | using Newtonsoft.Json; 21 | 22 | namespace WPCordovaClassLib.Cordova.JSON 23 | { 24 | /// 25 | /// Provides JSON serialization/deserialization functionality. 26 | /// 27 | public static class JsonHelper 28 | { 29 | /// 30 | /// Serializes object to JSON string representation 31 | /// 32 | /// object to serialize 33 | /// JSON representation of the object. Returns 'null' string for null passed as argument 34 | public static string Serialize(object obj, bool bUseJsonDotNet = false) 35 | { 36 | if (bUseJsonDotNet) 37 | { 38 | return JsonConvert.SerializeObject(obj); 39 | } 40 | else if (obj == null) 41 | { 42 | return "null"; 43 | } 44 | else 45 | { 46 | 47 | DataContractJsonSerializer ser = new DataContractJsonSerializer(obj.GetType()); 48 | 49 | MemoryStream ms = new MemoryStream(); 50 | ser.WriteObject(ms, obj); 51 | 52 | ms.Position = 0; 53 | 54 | string json = String.Empty; 55 | 56 | using (StreamReader sr = new StreamReader(ms)) 57 | { 58 | json = sr.ReadToEnd(); 59 | } 60 | 61 | ms.Close(); 62 | 63 | return json; 64 | } 65 | 66 | } 67 | 68 | /// 69 | /// Parses json string to object instance 70 | /// 71 | /// type of the object 72 | /// json string representation of the object 73 | /// Deserialized object instance 74 | public static T Deserialize(string json, bool bUseJsonDotNet = false) 75 | { 76 | 77 | if (bUseJsonDotNet) 78 | { 79 | return JsonConvert.DeserializeObject(json); 80 | } 81 | else 82 | { 83 | DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(T)); 84 | object result = null; 85 | try 86 | { 87 | using (MemoryStream mem = new MemoryStream(Encoding.UTF8.GetBytes(json))) 88 | { 89 | result = deserializer.ReadObject(mem); 90 | } 91 | } 92 | catch (Exception ex) 93 | { 94 | Debug.WriteLine(ex.Message); 95 | Debug.WriteLine("Failed to deserialize " + typeof(T) + " with JSON value :: " + json); 96 | } 97 | 98 | return (T)result; 99 | } 100 | 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /template/cordovalib/PluginResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | using System; 16 | using System.Net; 17 | using System.Windows; 18 | using System.Windows.Controls; 19 | using System.Windows.Documents; 20 | using System.Windows.Ink; 21 | using System.Windows.Input; 22 | using System.Windows.Media; 23 | using System.Windows.Media.Animation; 24 | using System.Windows.Shapes; 25 | using System.Text; 26 | using System.Diagnostics; 27 | 28 | namespace WPCordovaClassLib.Cordova 29 | { 30 | /// 31 | /// Represents command execution result 32 | /// 33 | public class PluginResult : EventArgs 34 | { 35 | /// 36 | /// Predefined resultant messages 37 | /// 38 | public static string[] StatusMessages = new string[] 39 | { 40 | "No result", 41 | "OK", 42 | "Class not found", 43 | "Illegal access", 44 | "Instantiation error", 45 | "Malformed url", 46 | "IO error", 47 | "Invalid action", 48 | "JSON error", 49 | "Error" 50 | }; 51 | 52 | /// 53 | /// Possible command results status codes 54 | /// 55 | public enum Status : int 56 | { 57 | NO_RESULT = 0, 58 | OK, 59 | CLASS_NOT_FOUND_EXCEPTION, 60 | ILLEGAL_ACCESS_EXCEPTION, 61 | INSTANTIATION_EXCEPTION, 62 | MALFORMED_URL_EXCEPTION, 63 | IO_EXCEPTION, 64 | INVALID_ACTION, 65 | JSON_EXCEPTION, 66 | ERROR 67 | }; 68 | 69 | public Status Result { get; private set; } 70 | public string Message { get; set; } 71 | public bool KeepCallback { get; set; } 72 | public string CallbackId { get; set; } 73 | 74 | /// 75 | /// Whether command succeded or not 76 | /// 77 | public bool IsSuccess 78 | { 79 | get 80 | { 81 | return this.Result == Status.OK || this.Result == Status.NO_RESULT; 82 | } 83 | } 84 | 85 | /// 86 | /// Creates new instance of the PluginResult class. 87 | /// 88 | /// Execution result 89 | public PluginResult(Status status) 90 | : this(status, PluginResult.StatusMessages[(int)status]) 91 | { 92 | } 93 | 94 | /// 95 | /// Creates new instance of the PluginResult class. 96 | /// 97 | /// Execution result 98 | /// The message 99 | public PluginResult(Status status, object message) 100 | { 101 | this.Result = status; 102 | this.Message = JSON.JsonHelper.Serialize(message); 103 | } 104 | 105 | public string ToJSONString() 106 | { 107 | string res = String.Format("\"status\":{0},\"message\":{1},\"keepCallback\":{2}", 108 | (int)this.Result, 109 | this.Message, 110 | this.KeepCallback.ToString().ToLower()); 111 | 112 | res = "{" + res + "}"; 113 | return res; 114 | 115 | } 116 | 117 | [Obsolete] 118 | public string ToCallbackString(string callbackId, string successCallback, string errorCallback) 119 | { 120 | if (this.IsSuccess) 121 | { 122 | StringBuilder buf = new StringBuilder(""); 123 | buf.Append(String.Format("{0}('{1}',{2});", successCallback, callbackId, this.ToJSONString())); 124 | return buf.ToString(); 125 | } 126 | else 127 | { 128 | return String.Format("{0}('{1}',{2});", errorCallback, callbackId, this.ToJSONString()); 129 | } 130 | } 131 | 132 | public override String ToString() 133 | { 134 | return this.ToJSONString(); 135 | } 136 | 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /template/cordovalib/ScriptCallback.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | using System; 16 | using System.Net; 17 | using System.Windows; 18 | using System.Windows.Controls; 19 | using System.Windows.Documents; 20 | using System.Windows.Ink; 21 | using System.Windows.Input; 22 | using System.Windows.Media; 23 | using System.Windows.Media.Animation; 24 | using System.Windows.Shapes; 25 | using WPCordovaClassLib.Cordova.JSON; 26 | using System.Diagnostics; 27 | 28 | namespace WPCordovaClassLib.Cordova 29 | { 30 | /// 31 | /// Represents client script function to execute 32 | /// 33 | public class ScriptCallback : EventArgs 34 | { 35 | /// 36 | /// The scripting function to execute. 37 | /// 38 | public string ScriptName { get; private set; } 39 | 40 | /// 41 | /// A variable number of strings to pass to the function as parameters. 42 | /// 43 | public string[] Args { get; private set; } 44 | 45 | /// 46 | /// Creates new instance of a ScriptCallback class. 47 | /// 48 | /// The scripting function to execute 49 | /// A variable number of strings to pass to the function as parameters 50 | public ScriptCallback(string function, string[] args) 51 | { 52 | this.ScriptName = function; 53 | this.Args = args; 54 | } 55 | 56 | /// 57 | /// Creates new instance of a ScriptCallback class. 58 | /// 59 | /// The scripting function to execute 60 | /// The id argument 61 | /// The message argument 62 | /// The value argument 63 | public ScriptCallback(string function, string id, object msg, object value) 64 | { 65 | this.ScriptName = function; 66 | 67 | String arg = String.Format("{{\"id\": {0}, \"msg\": {1}, \"value\": {2}}}", 68 | JsonHelper.Serialize(id), JsonHelper.Serialize(msg), JsonHelper.Serialize(value)); 69 | 70 | this.Args = new string[] { arg }; 71 | } 72 | 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /template/lib/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /template/lib/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/lib/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /template/lib/Newtonsoft.Json.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Newtonsoft.Json 5 | 6.0.8 6 | Json.NET 7 | James Newton-King 8 | James Newton-King 9 | https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md 10 | http://james.newtonking.com/json 11 | false 12 | Json.NET is a popular high-performance JSON framework for .NET 13 | en-US 14 | json 15 | 16 | -------------------------------------------------------------------------------- /template/www/css/index.css: -------------------------------------------------------------------------------- 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 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 21 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 22 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 23 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 24 | } 25 | 26 | body { 27 | background-color:#E4E4E4; 28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 31 | background-image:-webkit-gradient( 32 | linear, 33 | left top, 34 | left bottom, 35 | color-stop(0, #A7A7A7), 36 | color-stop(0.51, #E4E4E4) 37 | ); 38 | background-attachment:fixed; 39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 40 | font-size:12px; 41 | height:100%; 42 | margin:0px; 43 | padding:0px; 44 | text-transform:uppercase; 45 | width:100%; 46 | } 47 | 48 | /* Portrait layout (default) */ 49 | .app { 50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ 51 | position:absolute; /* position in the center of the screen */ 52 | left:50%; 53 | top:50%; 54 | height:50px; /* text area height */ 55 | width:225px; /* text area width */ 56 | text-align:center; 57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ 58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ 59 | /* offset horizontal: half of text area width */ 60 | } 61 | 62 | /* Landscape layout (with min-width) */ 63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { 64 | .app { 65 | background-position:left center; 66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ 67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ 68 | /* offset horizontal: half of image width and text area width */ 69 | } 70 | } 71 | 72 | h1 { 73 | font-size:24px; 74 | font-weight:normal; 75 | margin:0px; 76 | overflow:visible; 77 | padding:0px; 78 | text-align:center; 79 | } 80 | 81 | .event { 82 | border-radius:4px; 83 | -webkit-border-radius:4px; 84 | color:#FFFFFF; 85 | font-size:12px; 86 | margin:0px 30px; 87 | padding:2px 0px; 88 | } 89 | 90 | .event.listening { 91 | background-color:#333333; 92 | display:block; 93 | } 94 | 95 | .event.received { 96 | background-color:#4B946A; 97 | display:none; 98 | } 99 | 100 | @keyframes fade { 101 | from { opacity: 1.0; } 102 | 50% { opacity: 0.4; } 103 | to { opacity: 1.0; } 104 | } 105 | 106 | @-webkit-keyframes fade { 107 | from { opacity: 1.0; } 108 | 50% { opacity: 0.4; } 109 | to { opacity: 1.0; } 110 | } 111 | 112 | .blink { 113 | animation:fade 3000ms infinite; 114 | -webkit-animation:fade 3000ms infinite; 115 | } 116 | -------------------------------------------------------------------------------- /template/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cordova-wp8/f3b7fbc45c9484f06a9a27a78c9fbf6a01e04d36/template/www/img/logo.png -------------------------------------------------------------------------------- /template/www/index.html: -------------------------------------------------------------------------------- 1 |  2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Hello World 28 | 29 | 30 |
31 |

Apache Cordova

32 | 36 |
37 | 38 | 39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /template/www/js/index.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 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | this.bindEvents(); 23 | }, 24 | // Bind Event Listeners 25 | // 26 | // Bind any events that are required on startup. Common events are: 27 | // `load`, `deviceready`, `offline`, and `online`. 28 | bindEvents: function() { 29 | document.addEventListener('deviceready', this.onDeviceReady, false); 30 | }, 31 | // deviceready Event Handler 32 | // 33 | // The scope of `this` is the event. In order to call the `receivedEvent` 34 | // function, we must explicity call `app.receivedEvent(...);` 35 | onDeviceReady: function() { 36 | app.receivedEvent('deviceready'); 37 | }, 38 | // Update DOM on a Received Event 39 | receivedEvent: function(id) { 40 | var parentElement = document.getElementById(id); 41 | var listeningElement = parentElement.querySelector('.listening'); 42 | var receivedElement = parentElement.querySelector('.received'); 43 | 44 | listeningElement.setAttribute('style', 'display:none;'); 45 | receivedElement.setAttribute('style', 'display:block;'); 46 | 47 | console.log('Received Event: ' + id); 48 | } 49 | }; 50 | --------------------------------------------------------------------------------