Whopps, sorry! Will fix once I'm back at a computer.
On Tue, Jul 2, 2013 at 6:09 PM, Filip Maj <[email protected]> wrote: > Hey Bryan can you update the tests for this? I get a slew of errors now > that this commit is in there. > > Make sure to run the tests before committing folks! > > On 7/2/13 12:20 PM, "[email protected]" <[email protected]> wrote: > > >Updated Branches: > > refs/heads/master2 a0966a2c1 -> 627b23b83 > > > > > >[CB-3965] [BlackBerry10] Update bb10 parser now that device config is > >global > > > >- Remove prompting > >- Use check_reqs script rather than re-implement > > > > > >Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo > >Commit: > http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/627b23b8 > >Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/627b23b8 > >Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/627b23b8 > > > >Branch: refs/heads/master2 > >Commit: 627b23b83f6e451e1773cbfc4da4d6304771357a > >Parents: a0966a2 > >Author: Bryan Higgins <[email protected]> > >Authored: Tue Jun 25 09:14:22 2013 -0400 > >Committer: Bryan Higgins <[email protected]> > >Committed: Tue Jul 2 15:20:06 2013 -0400 > > > >---------------------------------------------------------------------- > > src/metadata/blackberry_parser.js | 142 ++------------------------------- > > 1 file changed, 5 insertions(+), 137 deletions(-) > >---------------------------------------------------------------------- > > > > > > > http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/627b23b8/src/metad > >ata/blackberry_parser.js > >---------------------------------------------------------------------- > >diff --git a/src/metadata/blackberry_parser.js > >b/src/metadata/blackberry_parser.js > >index 691d882..ef33392 100644 > >--- a/src/metadata/blackberry_parser.js > >+++ b/src/metadata/blackberry_parser.js > >@@ -19,7 +19,6 @@ > > var fs = require('fs'), > > path = require('path'), > > et = require('elementtree'), > >- prompt = require('prompt'), > > shell = require('shelljs'), > > util = require('../util'), > > config_parser = require('../config_parser'), > >@@ -27,7 +26,7 @@ var fs = require('fs'), > > config = require('../config'); > > > > module.exports = function blackberry_parser(project) { > >- if (!fs.existsSync(path.join(project, 'project.json')) || > >!fs.existsSync(path.join(project, 'www'))) { > >+ if (!fs.existsSync(path.join(project, 'www'))) { > > throw new Error('The provided path "' + project + '" is not a > >Cordova BlackBerry10 project.'); > > } > > this.path = project; > >@@ -36,9 +35,10 @@ module.exports = function blackberry_parser(project) { > > }; > > > > module.exports.check_requirements = function(project_root, callback) { > >- shell.exec('blackberry-deploy', {silent:true, async:true}, > >function(code, output) { > >- if (code > 0) { > >- callback('The binary `blackberry-deploy` was not found. Make > >sure you have the latest BlackBerry 10 WebWorks SDK installed, and have > >its /dependencies/tools/bin folder added to your PATH! Error output: ' + > >output); > >+ var lib_path = path.join(util.libDirectory, 'blackberry', 'cordova', > >require('../../platforms').blackberry.version); > >+ shell.exec(path.join(lib_path, 'bin', 'check_reqs'), {silent:true, > >async:true}, function(code, output) { > >+ if (code != 0) { > >+ callback(output); > > } else { > > callback(false); > > } > >@@ -80,21 +80,6 @@ module.exports.prototype = { > > self.update_overrides(); > > self.update_staging(); > > util.deleteSvnFolders(this.www_dir()); > >- > >- // Do we have BB config? > >- var projectRoot = util.isCordova(this.path); > >- var dotFile = path.join(projectRoot, '.cordova', 'config.json'); > >- var dot = JSON.parse(fs.readFileSync(dotFile, 'utf-8')); > >- if (dot.blackberry === undefined || dot.blackberry.qnx === > >undefined) { > >- events.emit('warn', 'WARNING! Missing BlackBerry 10 > >configuration file, prompting for information...'); > >- this.get_blackberry_environment(function() { > >- self.write_blackberry_environment(); > >- if (callback) callback(); > >- }); > >- } else { > >- self.write_blackberry_environment(); > >- if (callback) callback(); > >- } > > }, > > > > // Returns the platform-specific www directory. > >@@ -155,122 +140,5 @@ module.exports.prototype = { > > var staging = path.join(this.staging_dir(), '*'); > > shell.cp('-rf', staging, this.www_dir()); > > } > >- }, > >- get_cordova_config:function() { > >- var projectRoot = util.isCordova(this.path); > >- var dotFile = path.join(projectRoot, '.cordova', 'config.json'); > >- var dot = JSON.parse(fs.readFileSync(dotFile, 'utf-8')); > >- return dot.blackberry.qnx; > >- }, > >- get_blackberry_environment:function(callback) { > >- var projectRoot = util.isCordova(this.path); > >- var dotFile = path.join(projectRoot, '.cordova', 'config.json'); > >- var dot = JSON.parse(fs.readFileSync(dotFile, 'utf-8')); > >- // Let's save relevant BB SDK + signing info to > >.cordova/config.json > >- events.emit('log', 'Prompting for BlackBerry 10 configuration > >information...'); > >- prompt.start(); > >- prompt.get([{ > >- name:'signing_password', > >- required:true, > >- description:'Enter your BlackBerry 10 signing/keystore > >password', > >- hidden:true > >- },{ > >- name:'device_name', > >- description:'Enter a name for your BB10 device' > >- },{ > >- name:'device_ip', > >- description:'Enter the IP to your BB10 device' > >- },{ > >- name:'device_password', > >- description:'Enter the password for your BB10 device' > >- },{ > >- name:'device_pin', > >- description:'Enter the PIN for your BB10 device (under > >Settings->About->Hardware)' > >- },{ > >- name:'sim_name', > >- description:'Enter a name for your BB10 simulator' > >- },{ > >- name:'sim_ip', > >- description:'Enter the IP to your BB10 simulator' > >- },{ > >- name:'sim_password', > >- description:'Enter the password for your BB10 simulator' > >- } > >- ], function(err, results) { > >- if (err) { > >- if (callback) callback(err); > >- else throw err; > >- } else { > >- // Write out .cordova/config.json file > >- if (dot.blackberry === undefined) dot.blackberry = {}; > >- if (dot.blackberry.qnx === undefined) dot.blackberry.qnx > >= {}; > >- dot.blackberry.qnx.signing_password = > >results.signing_password; > >- dot.blackberry.qnx.device_ip = results.device_ip; > >- dot.blackberry.qnx.device_name = results.device_name; > >- dot.blackberry.qnx.device_password = > >results.device_password; > >- dot.blackberry.qnx.device_pin = results.device_pin; > >- dot.blackberry.qnx.sim_ip = results.sim_ip; > >- dot.blackberry.qnx.sim_name = results.sim_name; > >- dot.blackberry.qnx.sim_password = results.sim_password; > >- fs.writeFileSync(dotFile, JSON.stringify(dot), 'utf-8'); > >- events.emit('log', 'Wrote out BlackBerry 10 > >configuration file to "' + dotFile + '"'); > >- if (callback) callback(); > >- } > >- }); > >- }, > >- write_blackberry_environment:function() { > >- var projectRoot = util.isCordova(this.path); > >- // Write it out to project.json as well > >- var project_json_file = path.join(projectRoot, 'platforms', > >'blackberry', 'project.json'); > >- var proj_json = > >JSON.parse(fs.readFileSync(project_json_file,'utf-8')); > >- > >- // write out stuff to the project.json if user specified it > >- var bb_config = this.get_cordova_config(); > >- if (bb_config.device_name && bb_config.device_ip && > >bb_config.device_password && bb_config.device_pin) { > >- proj_json.targets[bb_config.device_name] = { > >- ip:bb_config.device_ip, > >- type:"device", > >- password:bb_config.device_password, > >- pin:bb_config.device_pin > >- }; > >- proj_json.defaultTarget = bb_config.device_name; > >- events.emit('log', 'Wrote out BlackBerry 10 device > >information to ' + project_json_file); > >- } > >- if (bb_config.sim_name && bb_config.sim_ip && > >bb_config.sim_password) { > >- proj_json.targets[bb_config.sim_name] = { > >- ip:bb_config.sim_ip, > >- type:"simulator", > >- password:bb_config.sim_password > >- }; > >- events.emit('log', 'Wrote out BlackBerry 10 simulator > >information to ' + project_json_file); > >- } > >- fs.writeFileSync(project_json_file, JSON.stringify(proj_json), > >'utf-8'); > >- }, > >- get_all_targets:function() { > >- var json_file = path.join(this.path, 'project.json'); > >- var json = JSON.parse(fs.readFileSync(json_file, 'utf-8')); > >- var targets = []; > >- Object.keys(json.targets).forEach(function(target) { > >- var t = json.targets[target]; > >- t.name = target; > >- targets.push(t); > >- }); > >- return targets; > >- }, > >- get_device_targets:function() { > >- return this.get_all_targets().filter(function(t) { > >- return t.type == 'device'; > >- }); > >- }, > >- get_simulator_targets:function() { > >- return this.get_all_targets().filter(function(t) { > >- return t.type == 'simulator'; > >- }); > >- }, > >- has_device_target:function() { > >- return this.get_device_targets().length > 0; > >- }, > >- has_simulator_target:function() { > >- return this.get_simulator_targets().length > 0; > > } > > }; > > > >
