[ 
https://issues.apache.org/jira/browse/CB-7350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14107130#comment-14107130
 ] 

ASF GitHub Bot commented on CB-7350:
------------------------------------

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


> Make createmobilespec friendlier
> --------------------------------
>
>                 Key: CB-7350
>                 URL: https://issues.apache.org/jira/browse/CB-7350
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: mobile-spec
>    Affects Versions: 3.5.0
>            Reporter: Josh Soref
>            Assignee: Josh Soref
>
> * Don't assume that the people running mobilespec are developers -- In my 
> experience, they aren't
> * The READMEs needed a refresh
> * Asking people to install grunt-cli globally is silly, we have npm 
> dependencies, we can use them.
> * The pushd/popd spam is really not helpful afaict
> * Provide information about how to use coho to get the right things more or 
> less at the right time
> * Fix the __dirname output to be correct
> ... some other stuff...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to