cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: CB-10519 Wrap all sync calls inside of `...
Date Tue, 16 Feb 2016 09:28:50 GMT
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/384#discussion_r52985929
  
    --- Diff: cordova-lib/src/cordova/build.js ---
    @@ -17,22 +17,26 @@
         under the License.
     */
     
    -var cordovaUtil      = require('./util'),
    -    HooksRunner           = require('../hooks/HooksRunner');
    +var Q = require('q'),
    +    cordovaUtil = require('./util'),
    +    HooksRunner = require('../hooks/HooksRunner');
     
     // Returns a promise.
     module.exports = function build(options) {
    -    var projectRoot = cordovaUtil.cdProjectRoot();
    -    options = cordovaUtil.preProcessOptions(options);
    -
    -    // fire build hooks
    -    var hooksRunner = new HooksRunner(projectRoot);
    -    return hooksRunner.fire('before_build', options)
    -    .then(function() {
    -        return require('./cordova').raw.prepare(options);
    -    }).then(function() {
    -        return require('./cordova').raw.compile(options);
    -    }).then(function() {
    -        return hooksRunner.fire('after_build', options);
    +    return Q().then(function() {
    +        var opts = cordovaUtil.preProcessOptions(options);
    +        var projectRoot = cordovaUtil.cdProjectRoot();
    +        return [new HooksRunner(projectRoot), opts];
    +    })
    +    .spread(function (hooksRunner, options) {
    --- End diff --
    
    > Why can't we just essentially wrap the entire method in return `Q().then(function()
{ ... };`?
    
    We can and basically this would be same. I think it's just a matter of taste..
    If you wish, i can update the PR in the manner you proposed


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message