cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jengee <...@git.apache.org>
Subject [GitHub] cordova-mobile-spec pull request: CB-7350 Make createmobilespec fr...
Date Fri, 22 Aug 2014 17:28:54 GMT
Github user jengee commented on a diff in the pull request:

    https://github.com/apache/cordova-mobile-spec/pull/103#discussion_r16609983
  
    --- Diff: createmobilespec/createmobilespec.js ---
    @@ -210,122 +267,153 @@ if (argv.plugman) {
         shelljs.cp("-f", path.join(mobile_spec_git_dir, 'config.xml'), path.join(projectDirName,
'config.xml'));
     
         // Config.json file ---> linked to local libraries
    -    shelljs.pushd(cli_project_dir);
    +    pushd(cli_project_dir);
         var localPlatforms = {
    -        "amazon-fireos" : top_dir + "cordova-amazon-fireos" ,
    -        "android" : top_dir + "cordova-android" ,
    -        "ios" : top_dir + "cordova-ios" ,
    -        "blackberry10" : top_dir + "cordova-blackberry" ,
    -        "wp8" : top_dir + "cordova-wp8" + path.sep + "wp8",
    -        "windows8" : top_dir + "cordova-windows",
    -        "windows" : path.join(top_dir, "cordova-windows", "windows")
    +        "amazon-fireos" : [top_dir, "cordova-amazon-fireos"],
    +        "android" : [top_dir, "cordova-android"],
    +        "ios" : [top_dir, "cordova-ios"],
    +        "blackberry10" : [top_dir, "cordova-blackberry"],
    +        "wp8" : [top_dir, "cordova-wp8", "wp8"],
    +        "windows8" : [top_dir, "cordova-windows"],
    +        "windows" : [top_dir, "cordova-windows", "windows"]
         };
     
         // Executing platform Add
         console.log("Adding platforms...");
    -    platforms.forEach(function (platform) {
    +    [].concat(platforms).forEach(function (platform) {
             console.log("Adding Platform: " + platform);
    -        var platformArg = argv.global ? platform : localPlatforms[platform];
    +        var platformArg;
    +        if (argv.global) {
    +            platformArg = platform;
    +        } else {
    +            platformArg = path.join.apply(null, localPlatforms[platform]);
    +            if (!fs.existsSync(platformArg)) {
    +                couldNotFind(localPlatforms[platform][1], platform);
    +                platforms = platforms.filter(function (p) { return p != platform; });
    +                return;
    +            }
    +        }
             console.log("platformArg: " + cli + " " + platformArg);
             shelljs.exec(cli + ' platform add "' + platformArg + '" --verbose');
         });
    -    shelljs.popd();
    +    popd();
     }
     
     ////////////////////// install plugins for each platform
    -
    -if (argv.plugman) {
    -    console.log("Adding plugins using plugman...");
    -    platforms.forEach(function (platform) {
    -        var projName = getProjName(platform),
    -            nodeCommand = /^win/.test(process.platform) ? process.argv[0] +" " : "";
    -        shelljs.pushd(projName);
    -        // plugin path must be relative and not absolute (sigh)
    -        shelljs.exec(nodeCommand + path.join(top_dir, "cordova-plugman", "main.js") +
    -                     " install --platform " + platform +
    -                     " --project . --plugin " + path.join("..", "cordova-mobile-spec",
"dependencies-plugin") +
    -                     " --searchpath " + top_dir);
    -        shelljs.popd();
    -    });
    -} else {
    -    // don't use local git repos for plugins when using --global
    -    var searchpath = argv.global ? "" : " --searchpath " + top_dir;
    -    shelljs.pushd(cli_project_dir);
    -    console.log("Adding plugins using CLI...");
    -    console.log("Searchpath:", searchpath);
    -    shelljs.exec(cli + " plugin add " + path.join(mobile_spec_git_dir, "dependencies-plugin")
+
    -                 searchpath);
    -    shelljs.popd();
    -}
    +function installPlugins() {
    +    if (argv.plugman) {
    +        console.log("Adding plugins using plugman...");
    +        if (!fs.existsSync(path.join(top_dir, "cordova-plugman"))) {
    +            couldNotFind('plugman');
    +            console.log("  ln -s cordova-lib/cordova-lib cordova-plugman/node_modules");
    +            return;
    --- End diff --
    
    this needs some `..`'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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message