[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user asfgit closed the pull request at: https://github.com/apache/cordova-ios/pull/146 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user purplecabbage commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/146#discussion_r32759726 --- Diff: bin/templates/project/__CLI__.xcodeproj/project.pbxproj --- @@ -374,7 +374,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cordova/lib/copy-www-build-step.sh"; + shellScript = "node cordova/lib/copy-www-build-step.js"; --- End diff -- +1 The cli dependent on node, so it makes sense to require it in the path. Does this affect users who are not using the cli? Probably still not a big deal either way. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user daserge commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/146#discussion_r32742742 --- Diff: bin/templates/project/__CLI__.xcodeproj/project.pbxproj --- @@ -374,7 +374,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cordova/lib/copy-www-build-step.sh"; + shellScript = "node cordova/lib/copy-www-build-step.js"; --- End diff -- Hello @shazron, @nikhilkh, Thanks for your review. Regarding node' path - I propose to leave it as is taking into account that stand-alone case is uncommon. We can address it later in case of issues. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user shazron commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/146#discussion_r32547846 --- Diff: bin/templates/project/__CLI__.xcodeproj/project.pbxproj --- @@ -374,7 +374,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cordova/lib/copy-www-build-step.sh"; + shellScript = "node cordova/lib/copy-www-build-step.js"; --- End diff -- I thought about this earlier when the PR came in and I think its a good assumption since it's a Cordova project and the user is using the CLI. The scenario where a user would take the project from platforms/ios and run it stand-alone is miniscule. Not sure if this is supported fully but Xcode.app does include node.js under `/Applications/Xcode.app/Contents/Developer/usr/share/xcs/Node/bin/node` You would dynamically get this path by using `xcode-select --print-path` then appending `/usr/share/xcs/Node/bin/node` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user nikhilkh commented on the pull request: https://github.com/apache/cordova-ios/pull/146#issuecomment-112483772 LGTM. Adding `glob` does increase the size of ios platform considerably. I'm assuming there is no other cheaper way to do this. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user nikhilkh commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/146#discussion_r32538324 --- Diff: bin/templates/project/__CLI__.xcodeproj/project.pbxproj --- @@ -374,7 +374,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cordova/lib/copy-www-build-step.sh"; + shellScript = "node cordova/lib/copy-www-build-step.js"; --- End diff -- This change assumes `node` to be in the $PATH for this to work. I'm not familiar with OS X and I'm assuming this assumption does not cause a problem. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
GitHub user daserge opened a pull request: https://github.com/apache/cordova-ios/pull/146 CB-8197 Switch to nodejs for ios platform scripts Convert `copy-www-build-step.sh` to nodejs Adds `glob` module and `bundledDependencies` to `package.json` [Jira issue](https://issues.apache.org/jira/browse/CB-8197) You can merge this pull request into a Git repository by running: $ git pull https://github.com/MSOpenTech/cordova-ios CB-8197 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-ios/pull/146.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #146 commit 8e8d2710f8b1a7ef9241d39623f76f9672ebe6f6 Author: daserge Date: 2015-06-11T18:13:06Z CB-8197 Switch to nodejs for ios platform scripts Convert copy-www-build-step.sh to nodejs Adds glob module and bundledDependencies to package.json --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user asfgit closed the pull request at: https://github.com/apache/cordova-ios/pull/126 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23373501 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { +return path.extname(name) === '.xcodeproj'; +}); + +if (xcodeProjFiles.length === 0) { +return Q.reject("No Xcode project found in " + projectPath); +} +if (xcodeProjFiles.length > 1) { +console.warn('Found multiple .xcodeproj directories in \n' + +projectPath + '\nUsing first one'); +} + +var projectName = path.basename(xcodeProjFiles[0], '.xcodeproj'); + +var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app'); +// select command to run and arguments depending whether +// we're running on device/emulator +if (args.device) { +return checkDeviceConnected().then(function () { +return deployToDevice(appPath); +}).fail(function () { +// if device connection check failed use emulator then +return deployToSim(appPath, args.target); +}); +} else { +return deployToSim(appPath, args.target); +} +}); +}; + +/** + * Checks if any iOS device is connected + * @return {Promise} Fullfilled when any devi
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23373440 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { +return path.extname(name) === '.xcodeproj'; +}); + +if (xcodeProjFiles.length === 0) { +return Q.reject("No Xcode project found in " + projectPath); +} +if (xcodeProjFiles.length > 1) { +console.warn('Found multiple .xcodeproj directories in \n' + +projectPath + '\nUsing first one'); +} + +var projectName = path.basename(xcodeProjFiles[0], '.xcodeproj'); + +var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app'); +// select command to run and arguments depending whether +// we're running on device/emulator +if (args.device) { +return checkDeviceConnected().then(function () { +return deployToDevice(appPath); +}).fail(function () { --- End diff -- Well, i just ported an original flow. Take a look: ```bash DEVICE_CONNECTED=$(ios-deploy -c) if [ $? != 0 ]; then echo "No device is connected, trying Simulator." 1>&2; USE_SIMULATOR=true else # if we got here, we can deploy the app, then exit success if ! [ "$NO_BUILD" = true ]
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23373246 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { --- End diff -- Updated in https://github.com/MSOpenTech/cordova-ios/commit/079fcf3c32aa8fce98ad68ee062aaff00cb0dab3 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23373228 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); --- End diff -- Don't knew that this will work. Thanks for advice! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23373146 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); --- End diff -- Updated in https://github.com/MSOpenTech/cordova-ios/commit/079fcf3c32aa8fce98ad68ee062aaff00cb0dab3 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23373137 --- Diff: bin/node_modules/nopt/.npmignore --- @@ -0,0 +1 @@ +node_modules --- End diff -- This file introduced by nopt, not by me. Anyway we're shipping node dependencies bundled in this package so this won't affect en-user. @agrieve Your thoughts? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23372879 --- Diff: bin/lib/versions.js --- @@ -85,17 +85,59 @@ exports.get_apple_xcode_version = function() { child_process.exec('xcodebuild -version', function(error, stdout, stderr) { if (error) { d.reject(stderr); +} else { +var version = stdout.split('\n')[0].slice(6); +d.resolve(version); } -else { +}); +return d.promise; +}; + +/** + * Gets ios-deploy util version + * @return {Promise} Promise that either resolved with ios-deploy version + * or rejected in case of error + */ +exports.get_ios_deploy_version = function() { +var d = Q.defer(); +child_process.exec('ios-deploy --version', function(error, stdout, stderr) { +if (error) { +d.reject(stderr); +} else { d.resolve(stdout); } }); +return d.promise; +}; -return d.promise.then(function(output) { -output = output.split('\n'); -console.log(output[0].slice(6)); -return Q(); -}, function(stderr) { -return Q.reject(stderr); +/** + * Gets ios-sim util version + * @return {Promise} Promise that either resolved with ios-sim version + * or rejected in case of error + */ +exports.get_ios_sim_version = function() { +var d = Q.defer(); +child_process.exec('ios-sim --version', function(error, stdout, stderr) { +if (error) { +d.reject(stderr); +} else { +d.resolve(stdout); +} }); -} +return d.promise; +}; + +/** + * Gets specific tool version + * @param {String} toolName Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy' + * @return {Promise} Promise that either resolved with tool version + * or rejected in case of error + */ +exports.get_tool_version = function (toolName) { +switch (toolName) { +case 'xcodebuild': return exports.get_apple_xcode_version(); +case 'ios-sim': return exports.get_apple_xcode_version(); --- End diff -- Updated in https://github.com/MSOpenTech/cordova-ios/commit/079fcf3c32aa8fce98ad68ee062aaff00cb0dab3 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23372869 --- Diff: bin/lib/check_reqs.js --- @@ -0,0 +1,94 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true, + indent:4, unused:vars, latedef:nofunc, + sub:true, laxcomma:true, laxbreak:true +*/ + +var Q = require('Q'), +os= require('os'), +shell = require('shelljs'), +versions = require('./versions'); + +var XCODEBUILD_MIN_VERSION = 4.6; + +var IOS_SIM_MIN_VERSION = 3.0; +var IOS_SIM_NOT_FOUND_MESSAGE = 'ios-sim was not found. Please download, build and install version ' + IOS_SIM_MIN_VERSION + +' or greater from https://github.com/phonegap/ios-sim into your path.' + +' Or \'npm install -g ios-sim\' using node.js: http://nodejs.org'; + +var IOS_DEPLOY_MIN_VERSION = 1.2; +var IOS_DEPLOY_NOT_FOUND_MESSAGE = 'ios-deploy was not found. Please download, build and install version ' + IOS_DEPLOY_MIN_VERSION + +' or greater from https://github.com/phonegap/ios-deploy into your path.' + +' Or \'npm install -g ios-deploy\' using node.js: http://nodejs.org'; + +/** + * Checks if xcode util is available + * @return {Promise} Returns a promise either resolved with xcode version or rejected + */ +module.exports.run = module.exports.check_xcodebuild = function () { +return checkTool('xcodebuild', XCODEBUILD_MIN_VERSION); +}; + +/** + * Checks if ios-deploy util is available + * @return {Promise} Returns a promise either resolved with ios-deploy version or rejected + */ +module.exports.check_ios_deploy = function () { +return checkTool('ios-deploy', IOS_DEPLOY_MIN_VERSION, IOS_DEPLOY_NOT_FOUND_MESSAGE); +}; + +/** + * Checks if ios-sim util is available + * @return {Promise} Returns a promise either resolved with ios-sim version or rejected + */ +module.exports.check_ios_sim = function () { +return checkTool('ios-sim', IOS_SIM_MIN_VERSION, IOS_SIM_NOT_FOUND_MESSAGE); +}; + +module.exports.help = function () { +console.log('Usage: check_reqs or node check_reqs'); +}; + +/** + * Checks if specific tool is available. + * @param {String} tool Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy' + * @param {Number} minVersion Min allowed tool version. + * @param {String} optMessage Message that will be used to reject promise. + * @return {Promise} Returns a promise either resolved with tool version or rejected + */ +function checkTool (tool, minVersion, optMessage) { +if (os.platform() !== 'darwin'){ +// Build iOS apps available for OSX platform only, so we reject on others platforms +return Q.reject('Cordova tooling for iOS requires Apple OS X'); +} +// Check whether tool command is available at all +var tool_command = shell.which(tool); +if (!tool_command) { +return Q.reject(optMessage || (tool + 'command is unavailable.')); +} +// check if tool version is greater than specified one +return versions.get_tool_version(tool).then(function (version) { +return minVersion <= parseFloat(version) ? --- End diff -- Updated in https://github.com/MSOpenTech/cordova-ios/commit/079fcf3c32aa8fce98ad68ee062aaff00cb0dab3 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23372861 --- Diff: bin/lib/versions.js --- @@ -85,17 +85,59 @@ exports.get_apple_xcode_version = function() { child_process.exec('xcodebuild -version', function(error, stdout, stderr) { if (error) { d.reject(stderr); +} else { +var version = stdout.split('\n')[0].slice(6); --- End diff -- Updated in https://github.com/MSOpenTech/cordova-ios/commit/079fcf3c32aa8fce98ad68ee062aaff00cb0dab3 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23305082 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); --- End diff -- So you did this in another place as well, but you don't need to return a promise here. It would be the same to just "return", and even shorter to: if (!args.nobuild) { return build.run(argv); } // by default, returns undefined, which is the same as returning Q() --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23305562 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { +return path.extname(name) === '.xcodeproj'; +}); + +if (xcodeProjFiles.length === 0) { +return Q.reject("No Xcode project found in " + projectPath); +} +if (xcodeProjFiles.length > 1) { +console.warn('Found multiple .xcodeproj directories in \n' + +projectPath + '\nUsing first one'); +} + +var projectName = path.basename(xcodeProjFiles[0], '.xcodeproj'); + +var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app'); +// select command to run and arguments depending whether +// we're running on device/emulator +if (args.device) { +return checkDeviceConnected().then(function () { +return deployToDevice(appPath); +}).fail(function () { +// if device connection check failed use emulator then +return deployToSim(appPath, args.target); +}); +} else { +return deployToSim(appPath, args.target); +} +}); +}; + +/** + * Checks if any iOS device is connected + * @return {Promise} Fullfilled when any device is con
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23305406 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { +return path.extname(name) === '.xcodeproj'; +}); + +if (xcodeProjFiles.length === 0) { +return Q.reject("No Xcode project found in " + projectPath); +} +if (xcodeProjFiles.length > 1) { +console.warn('Found multiple .xcodeproj directories in \n' + +projectPath + '\nUsing first one'); +} + +var projectName = path.basename(xcodeProjFiles[0], '.xcodeproj'); + +var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app'); +// select command to run and arguments depending whether +// we're running on device/emulator +if (args.device) { --- End diff -- I don't think this is quite right. If `--device`, then we want to only attempt `deployToDevice()`. `checkDeviceConnected()` should run only if neither flag is passed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- -
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23305293 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { +return path.extname(name) === '.xcodeproj'; +}); + +if (xcodeProjFiles.length === 0) { +return Q.reject("No Xcode project found in " + projectPath); +} +if (xcodeProjFiles.length > 1) { +console.warn('Found multiple .xcodeproj directories in \n' + +projectPath + '\nUsing first one'); +} + +var projectName = path.basename(xcodeProjFiles[0], '.xcodeproj'); + +var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app'); +// select command to run and arguments depending whether +// we're running on device/emulator +if (args.device) { +return checkDeviceConnected().then(function () { +return deployToDevice(appPath); +}).fail(function () { --- End diff -- This will deploy to simulator if deployToDevice() fails. I think we want it to only do this if checkDeviceConnected() fails. So, you should: return checkDeviceConnected().then(function () { return deployToDevice(appPath); }, function () { return deployToSim(appPath, args.target); }); --- If your project is set
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23305135 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); + +// support for CB-8168 `cordova/run --list` +if (args.list) { +if (args.device) return listDevices(); +if (args.emulator) return listEmulators(); +return listDevices().then(function () { +return listEmulators(); +}); +} + +return checkTools.then(function () { +if (args.nobuild) { +// --nobuild option is passed. Skipping build... +return Q(); +} +// if --nobuild isn't specified then build app first +return build.run(argv); +}).then(function () { + +var xcodeProjFiles = shell.ls(projectPath).filter(function (name) { --- End diff -- Seen this in a few spots now. Probably would be good to make a helper function for it. Maybe stick it in build.js? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23304929 --- Diff: bin/templates/scripts/cordova/lib/run.js --- @@ -0,0 +1,184 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/*jshint node: true*/ + +var Q = require('q'), +nopt = require('nopt'), +path = require('path'), +shell = require('shelljs'), +build = require('./build'), +spawn = require('./spawn'), +check_reqs = require('./check_reqs'); + +var cordovaPath = path.join(__dirname, '..'); +var projectPath = path.join(__dirname, '..', '..'); + +module.exports.run = function (argv) { + +// parse args here +// --debug and --release args not parsed here +// but still valid since they can be passed down to build command +var args = nopt({ +// "archs": String, // TODO: add support for building different archs +"list": Boolean, +"nobuild": Boolean, +"device": Boolean, "emulator": Boolean, "target": String +}, {}, argv); + +// Validate args +if (args.device && args.emulator) { +return Q.reject('Only one of "device"/"emulator" options should be specified'); +} + +// validate target device for ios-sim +// Valid values for "--target" (case sensitive): +var validTargets = ["iPhone-4s", "iPhone-5", "iPhone-5s", "iPhone-6-Plus", "iPhone-6", +"iPad-2", "iPad-Retina", "iPad-Air", "Resizable-iPhone", "Resizable-iPad"]; +if (args.target && validTargets.indexOf(args.target) < 0 ) { +return Q.reject(args.target + " is not a valid target for emulator"); +} + +// check for either ios-sim or ios-deploy is available +// depending on arguments provided +var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim(); --- End diff -- This should come after args.list, no? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23304383 --- Diff: bin/node_modules/nopt/.npmignore --- @@ -0,0 +1 @@ +node_modules --- End diff -- NVM - I see it now :S --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23304345 --- Diff: bin/node_modules/nopt/.npmignore --- @@ -0,0 +1 @@ +node_modules --- End diff -- Also - do you not need to check in the "abbrev" module, since nopt depends on it? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23304211 --- Diff: bin/node_modules/nopt/.npmignore --- @@ -0,0 +1 @@ +node_modules --- End diff -- Why exclude nopt's dependencies when npm pack'ing, and not just exclude nopt itself? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23304037 --- Diff: bin/lib/versions.js --- @@ -85,17 +85,59 @@ exports.get_apple_xcode_version = function() { child_process.exec('xcodebuild -version', function(error, stdout, stderr) { if (error) { d.reject(stderr); +} else { +var version = stdout.split('\n')[0].slice(6); +d.resolve(version); } -else { +}); +return d.promise; +}; + +/** + * Gets ios-deploy util version + * @return {Promise} Promise that either resolved with ios-deploy version + * or rejected in case of error + */ +exports.get_ios_deploy_version = function() { +var d = Q.defer(); +child_process.exec('ios-deploy --version', function(error, stdout, stderr) { +if (error) { +d.reject(stderr); +} else { d.resolve(stdout); } }); +return d.promise; +}; -return d.promise.then(function(output) { -output = output.split('\n'); -console.log(output[0].slice(6)); -return Q(); -}, function(stderr) { -return Q.reject(stderr); +/** + * Gets ios-sim util version + * @return {Promise} Promise that either resolved with ios-sim version + * or rejected in case of error + */ +exports.get_ios_sim_version = function() { +var d = Q.defer(); +child_process.exec('ios-sim --version', function(error, stdout, stderr) { +if (error) { +d.reject(stderr); +} else { +d.resolve(stdout); +} }); -} +return d.promise; +}; + +/** + * Gets specific tool version + * @param {String} toolName Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy' + * @return {Promise} Promise that either resolved with tool version + * or rejected in case of error + */ +exports.get_tool_version = function (toolName) { +switch (toolName) { +case 'xcodebuild': return exports.get_apple_xcode_version(); +case 'ios-sim': return exports.get_apple_xcode_version(); --- End diff -- these two are pointing to the wrong function. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23303870 --- Diff: bin/lib/check_reqs.js --- @@ -0,0 +1,94 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true, + indent:4, unused:vars, latedef:nofunc, + sub:true, laxcomma:true, laxbreak:true +*/ + +var Q = require('Q'), +os= require('os'), +shell = require('shelljs'), +versions = require('./versions'); + +var XCODEBUILD_MIN_VERSION = 4.6; + +var IOS_SIM_MIN_VERSION = 3.0; +var IOS_SIM_NOT_FOUND_MESSAGE = 'ios-sim was not found. Please download, build and install version ' + IOS_SIM_MIN_VERSION + +' or greater from https://github.com/phonegap/ios-sim into your path.' + +' Or \'npm install -g ios-sim\' using node.js: http://nodejs.org'; + +var IOS_DEPLOY_MIN_VERSION = 1.2; +var IOS_DEPLOY_NOT_FOUND_MESSAGE = 'ios-deploy was not found. Please download, build and install version ' + IOS_DEPLOY_MIN_VERSION + +' or greater from https://github.com/phonegap/ios-deploy into your path.' + +' Or \'npm install -g ios-deploy\' using node.js: http://nodejs.org'; + +/** + * Checks if xcode util is available + * @return {Promise} Returns a promise either resolved with xcode version or rejected + */ +module.exports.run = module.exports.check_xcodebuild = function () { +return checkTool('xcodebuild', XCODEBUILD_MIN_VERSION); +}; + +/** + * Checks if ios-deploy util is available + * @return {Promise} Returns a promise either resolved with ios-deploy version or rejected + */ +module.exports.check_ios_deploy = function () { +return checkTool('ios-deploy', IOS_DEPLOY_MIN_VERSION, IOS_DEPLOY_NOT_FOUND_MESSAGE); +}; + +/** + * Checks if ios-sim util is available + * @return {Promise} Returns a promise either resolved with ios-sim version or rejected + */ +module.exports.check_ios_sim = function () { +return checkTool('ios-sim', IOS_SIM_MIN_VERSION, IOS_SIM_NOT_FOUND_MESSAGE); +}; + +module.exports.help = function () { +console.log('Usage: check_reqs or node check_reqs'); +}; + +/** + * Checks if specific tool is available. + * @param {String} tool Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy' + * @param {Number} minVersion Min allowed tool version. + * @param {String} optMessage Message that will be used to reject promise. + * @return {Promise} Returns a promise either resolved with tool version or rejected + */ +function checkTool (tool, minVersion, optMessage) { +if (os.platform() !== 'darwin'){ +// Build iOS apps available for OSX platform only, so we reject on others platforms +return Q.reject('Cordova tooling for iOS requires Apple OS X'); +} +// Check whether tool command is available at all +var tool_command = shell.which(tool); +if (!tool_command) { +return Q.reject(optMessage || (tool + 'command is unavailable.')); +} +// check if tool version is greater than specified one +return versions.get_tool_version(tool).then(function (version) { +return minVersion <= parseFloat(version) ? --- End diff -- I don't think apple restricts to two-number versions (e.g. Xcode 5.1.1 was a thing). Maybe best approach (rather than checking in all of semver module), is to add a helper to versions.js for comparing versions via splitting on '.' --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. -
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/126#discussion_r23303819 --- Diff: bin/lib/versions.js --- @@ -85,17 +85,59 @@ exports.get_apple_xcode_version = function() { child_process.exec('xcodebuild -version', function(error, stdout, stderr) { if (error) { d.reject(stderr); +} else { +var version = stdout.split('\n')[0].slice(6); --- End diff -- Would be better to use a regexp here I think: var m = /Xcode (.*)/.exec(stdout); if (m) { d.resolve(m[1]); ... --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-ios pull request: CB-8197 Switch to nodejs for ios platfor...
GitHub user vladimir-kotikov opened a pull request: https://github.com/apache/cordova-ios/pull/126 CB-8197 Switch to nodejs for ios platform scripts Implementation for [CB-8197](https://issues.apache.org/jira/browse/CB-8197) Part of this work is already done for create/update scripts in https://issues.apache.org/jira/browse/CB-5706 but platform scripts placed in cordova folder of platform is still being unported. You can merge this pull request into a Git repository by running: $ git pull https://github.com/MSOpenTech/cordova-ios CB-8197 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-ios/pull/126.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #126 commit 70b6681446d9d031d2da0c1bf4216e70ca54d7c4 Author: Vladimir Kotikov Date: 2014-12-22T08:58:54Z CB-8197 Updates check_reqs script to use NodeJS instead of shell * adds check_ios_deploy and check_ios_sim methods to exports for future use in build/run scripts * adds get_ios_deploy_version and get_ios_sim_version methods to versions module * fixes get_apple_xcode_version method to return version value, not just print it to console. commit b1355929cc27877c17159b78201cbba7161b2894 Author: Vladimir Kotikov Date: 2014-12-22T09:02:42Z CB-8197 Adds spawn module to platform scripts commit e7a4827486e7a9f2eeffca2da2c7fd3ff5d97dd3 Author: Vladimir Kotikov Date: 2014-12-22T09:05:34Z CB-8197 Rewrite build script using NodeJS commit 63a3f46a96044594cfde87e4eb9e5a669a85b885 Author: Vladimir Kotikov Date: 2014-12-22T09:08:52Z CB-8197 Rewrite run script using NodeJS * removes emulate script since it almost a duplicate of old run script and can be replaced with `run --emulator` command * removes install-device and install-emulator scripts since they can be replaced with `run --nobuild --device/--emulator` * adds support for `cordova/run --list` option commit 46303bb57d8c331b9c399c26b223156e20bc3dd8 Author: Vladimir Kotikov Date: 2014-12-22T09:09:16Z CB-8197 Rewrite clean script using NodeJS --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org