You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Mark Koudritsky <ka...@gmail.com> on 2013/12/12 22:27:04 UTC

Re: Review Request 15775: Add --src & --link to "cordova create"

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/
-----------------------------------------------------------

(Updated Dec. 12, 2013, 9:27 p.m.)


Review request for cordova.


Changes
-------

--link was a boolean before, now it accepts a path, so it's either --src=path or --link=path.
Added a check in config_parser to make sure we are looking at an xml file that looks like Cordova config.xml to avoid overwriting some unrelated config.xml when symlinking to www dir.

Same diff on github: https://github.com/kamrik/cordova-cli/compare/src_www


Bugs: CB-4153
    https://issues.apache.org/jira/browse/CB-4153


Repository: cordova-cli


Description
-------

Add --src & --link to "cordova create".

Both --src and --source are accepted.
The path is passed via the lib.www.uri of the configuration object
that is later written to .cordova/config.json.
    
Cordova will keep going into child www folder(s) of the provided path.


Diffs (updated)
-----

  doc/help.txt 3361dd3 
  e2e/create.spec.js 560f82a 
  spec/metadata/android_parser.spec.js 52fc78a 
  spec/metadata/ios_parser.spec.js b56ddce 
  spec/metadata/windows8_parser.spec.js 5117148 
  spec/metadata/wp7_parser.spec.js 6dc0695 
  spec/metadata/wp8_parser.spec.js 8cd1923 
  src/cli.js 2916062 
  src/config_parser.js b6293d8 
  src/create.js 961d787 
  src/metadata/wp8_parser.js 163d56b 

Diff: https://reviews.apache.org/r/15775/diff/


Testing
-------

npm test;
cordova -d  create TstApp --source=some/www --link
a bunch of other cordova commands in the app


Thanks,

Mark Koudritsky


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Andrew Grieve <ag...@chromium.org>.
Just two nits from me then I think it's good to go!

Let me know if you'd like someone else to look at it, or if I should merge
it in.

Nice work! This will be an appreciated feature I think :)


On Fri, Dec 20, 2013 at 1:43 PM, Andrew Grieve <ag...@chromium.org> wrote:

>    This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15775/
>    src/config_parser.js<https://reviews.apache.org/r/15775/diff/6/?file=401685#file401685line33> (Diff
> revision 6)
>
> function config_parser(path) {
>
>    33
>
>         throw new Error("This file does not seem to be a cordova config.xml file: " + path);
>
>   This seems unrelated to the goal of this change.
>
>
>    src/create.js<https://reviews.apache.org/r/15775/diff/6/?file=401686#file401686line126> (Diff
> revision 6)
>
> var sanedircontents = function (d) {
>
>    125
>
>         var www_id = config_json.lib.www.id || ('random_id_' + (Math.random() * 1e15).toString().substring(0,6));
>
>   we shouldn't need to give it a random ID, should we?
>
> Can you add a TODO about getting rid of the need for it?
>
>
> - Andrew Grieve
>
> On December 20th, 2013, 4:51 p.m. UTC, Mark Koudritsky wrote:
>   Review request for cordova.
> By Mark Koudritsky.
>
> *Updated Dec. 20, 2013, 4:51 p.m.*
>  *Bugs: * CB-4153 <https://issues.apache.org/jira/browse/CB-4153>
>  *Repository: * cordova-cli
> Description
>
> Add --src & --link to "cordova create".
>
> Both --src and --source are accepted.
> The path is passed via the lib.www.uri of the configuration object
> that is later written to .cordova/config.json.
>
> Cordova will keep going into child www folder(s) of the provided path.
>
>   Testing
>
> npm test;
> cordova -d  create TstApp --source=some/www --link
> a bunch of other cordova commands in the app
>
>   Diffs
>
>    - doc/help.txt (3361dd3)
>    - e2e/create.spec.js (560f82a)
>    - spec/cli.spec.js (215c64c)
>    - spec/metadata/android_parser.spec.js (52fc78a)
>    - spec/metadata/ios_parser.spec.js (b56ddce)
>    - spec/metadata/windows8_parser.spec.js (5117148)
>    - spec/metadata/wp7_parser.spec.js (6dc0695)
>    - spec/metadata/wp8_parser.spec.js (8cd1923)
>    - src/cli.js (2916062)
>    - src/config_parser.js (b6293d8)
>    - src/create.js (f741e2f)
>    - src/metadata/wp8_parser.js (163d56b)
>
> View Diff <https://reviews.apache.org/r/15775/diff/>
>

Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Andrew Grieve <ag...@chromium.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/#review30753
-----------------------------------------------------------



src/config_parser.js
<https://reviews.apache.org/r/15775/#comment58861>

    This seems unrelated to the goal of this change.



src/create.js
<https://reviews.apache.org/r/15775/#comment58863>

    we shouldn't need to give it a random ID, should we?
    
    Can you add a TODO about getting rid of the need for it?


- Andrew Grieve


On Dec. 20, 2013, 4:51 p.m., Mark Koudritsky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15775/
> -----------------------------------------------------------
> 
> (Updated Dec. 20, 2013, 4:51 p.m.)
> 
> 
> Review request for cordova.
> 
> 
> Bugs: CB-4153
>     https://issues.apache.org/jira/browse/CB-4153
> 
> 
> Repository: cordova-cli
> 
> 
> Description
> -------
> 
> Add --src & --link to "cordova create".
> 
> Both --src and --source are accepted.
> The path is passed via the lib.www.uri of the configuration object
> that is later written to .cordova/config.json.
>     
> Cordova will keep going into child www folder(s) of the provided path.
> 
> 
> Diffs
> -----
> 
>   doc/help.txt 3361dd3 
>   e2e/create.spec.js 560f82a 
>   spec/cli.spec.js 215c64c 
>   spec/metadata/android_parser.spec.js 52fc78a 
>   spec/metadata/ios_parser.spec.js b56ddce 
>   spec/metadata/windows8_parser.spec.js 5117148 
>   spec/metadata/wp7_parser.spec.js 6dc0695 
>   spec/metadata/wp8_parser.spec.js 8cd1923 
>   src/cli.js 2916062 
>   src/config_parser.js b6293d8 
>   src/create.js f741e2f 
>   src/metadata/wp8_parser.js 163d56b 
> 
> Diff: https://reviews.apache.org/r/15775/diff/
> 
> 
> Testing
> -------
> 
> npm test;
> cordova -d  create TstApp --source=some/www --link
> a bunch of other cordova commands in the app
> 
> 
> Thanks,
> 
> Mark Koudritsky
> 
>


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Mark Koudritsky <ka...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/#review30757
-----------------------------------------------------------



src/create.js
<https://reviews.apache.org/r/15775/#comment58868>

    The idea was that with a random id, it would support git urls for --src flag. It desn't work for now (not sure why). The ideal solution would be to add a new func to lazy_loader for retrieving stuff without caching (and removing that stuff right after it's no longer needed).


- Mark Koudritsky


On Dec. 20, 2013, 4:51 p.m., Mark Koudritsky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15775/
> -----------------------------------------------------------
> 
> (Updated Dec. 20, 2013, 4:51 p.m.)
> 
> 
> Review request for cordova.
> 
> 
> Bugs: CB-4153
>     https://issues.apache.org/jira/browse/CB-4153
> 
> 
> Repository: cordova-cli
> 
> 
> Description
> -------
> 
> Add --src & --link to "cordova create".
> 
> Both --src and --source are accepted.
> The path is passed via the lib.www.uri of the configuration object
> that is later written to .cordova/config.json.
>     
> Cordova will keep going into child www folder(s) of the provided path.
> 
> 
> Diffs
> -----
> 
>   doc/help.txt 3361dd3 
>   e2e/create.spec.js 560f82a 
>   spec/cli.spec.js 215c64c 
>   spec/metadata/android_parser.spec.js 52fc78a 
>   spec/metadata/ios_parser.spec.js b56ddce 
>   spec/metadata/windows8_parser.spec.js 5117148 
>   spec/metadata/wp7_parser.spec.js 6dc0695 
>   spec/metadata/wp8_parser.spec.js 8cd1923 
>   src/cli.js 2916062 
>   src/config_parser.js b6293d8 
>   src/create.js f741e2f 
>   src/metadata/wp8_parser.js 163d56b 
> 
> Diff: https://reviews.apache.org/r/15775/diff/
> 
> 
> Testing
> -------
> 
> npm test;
> cordova -d  create TstApp --source=some/www --link
> a bunch of other cordova commands in the app
> 
> 
> Thanks,
> 
> Mark Koudritsky
> 
>


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Andrew Grieve <ag...@chromium.org>.
Merged.


On Mon, Dec 23, 2013 at 1:26 PM, Mark Koudritsky <ka...@gmail.com> wrote:

>    This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15775/
>   Review request for cordova.
> By Mark Koudritsky.
>
> *Updated Dec. 23, 2013, 6:26 p.m.*
> Changes
>
> Removed random id for lazy_load, explicitly prohibiting --src=url with net urls (containing colon), rebased on current master.
> Same diff on github https://github.com/kamrik/cordova-cli/compare/src_www
>
>   *Bugs: * CB-4153 <https://issues.apache.org/jira/browse/CB-4153>
>  *Repository: * cordova-cli
> Description
>
> Add --src & --link to "cordova create".
>
> Both --src and --source are accepted.
> The path is passed via the lib.www.uri of the configuration object
> that is later written to .cordova/config.json.
>
> Cordova will keep going into child www folder(s) of the provided path.
>
>   Testing
>
> npm test;
> cordova -d  create TstApp --source=some/www --link
> a bunch of other cordova commands in the app
>
>   Diffs (updated)
>
>    - doc/help.txt (3361dd3)
>    - e2e/create.spec.js (560f82a)
>    - spec/cli.spec.js (215c64c)
>    - spec/metadata/android_parser.spec.js (52fc78a)
>    - spec/metadata/ios_parser.spec.js (b56ddce)
>    - spec/metadata/windows8_parser.spec.js (5117148)
>    - spec/metadata/wp7_parser.spec.js (6dc0695)
>    - spec/metadata/wp8_parser.spec.js (8cd1923)
>    - src/cli.js (2916062)
>    - src/config_parser.js (b6293d8)
>    - src/create.js (77d9a69)
>    - src/metadata/wp8_parser.js (163d56b)
>
> View Diff <https://reviews.apache.org/r/15775/diff/>
>

Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Mark Koudritsky <ka...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/
-----------------------------------------------------------

(Updated Dec. 23, 2013, 6:26 p.m.)


Review request for cordova.


Changes
-------

Removed random id for lazy_load, explicitly prohibiting --src=url with net urls (containing colon), rebased on current master.
Same diff on github https://github.com/kamrik/cordova-cli/compare/src_www


Bugs: CB-4153
    https://issues.apache.org/jira/browse/CB-4153


Repository: cordova-cli


Description
-------

Add --src & --link to "cordova create".

Both --src and --source are accepted.
The path is passed via the lib.www.uri of the configuration object
that is later written to .cordova/config.json.
    
Cordova will keep going into child www folder(s) of the provided path.


Diffs (updated)
-----

  doc/help.txt 3361dd3 
  e2e/create.spec.js 560f82a 
  spec/cli.spec.js 215c64c 
  spec/metadata/android_parser.spec.js 52fc78a 
  spec/metadata/ios_parser.spec.js b56ddce 
  spec/metadata/windows8_parser.spec.js 5117148 
  spec/metadata/wp7_parser.spec.js 6dc0695 
  spec/metadata/wp8_parser.spec.js 8cd1923 
  src/cli.js 2916062 
  src/config_parser.js b6293d8 
  src/create.js 77d9a69 
  src/metadata/wp8_parser.js 163d56b 

Diff: https://reviews.apache.org/r/15775/diff/


Testing
-------

npm test;
cordova -d  create TstApp --source=some/www --link
a bunch of other cordova commands in the app


Thanks,

Mark Koudritsky


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Mark Koudritsky <ka...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/
-----------------------------------------------------------

(Updated Dec. 20, 2013, 4:51 p.m.)


Review request for cordova.


Changes
-------

Rebased on current master (minor conflict fixed).


Bugs: CB-4153
    https://issues.apache.org/jira/browse/CB-4153


Repository: cordova-cli


Description
-------

Add --src & --link to "cordova create".

Both --src and --source are accepted.
The path is passed via the lib.www.uri of the configuration object
that is later written to .cordova/config.json.
    
Cordova will keep going into child www folder(s) of the provided path.


Diffs (updated)
-----

  doc/help.txt 3361dd3 
  e2e/create.spec.js 560f82a 
  spec/cli.spec.js 215c64c 
  spec/metadata/android_parser.spec.js 52fc78a 
  spec/metadata/ios_parser.spec.js b56ddce 
  spec/metadata/windows8_parser.spec.js 5117148 
  spec/metadata/wp7_parser.spec.js 6dc0695 
  spec/metadata/wp8_parser.spec.js 8cd1923 
  src/cli.js 2916062 
  src/config_parser.js b6293d8 
  src/create.js f741e2f 
  src/metadata/wp8_parser.js 163d56b 

Diff: https://reviews.apache.org/r/15775/diff/


Testing
-------

npm test;
cordova -d  create TstApp --source=some/www --link
a bunch of other cordova commands in the app


Thanks,

Mark Koudritsky


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Mark Koudritsky <ka...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/
-----------------------------------------------------------

(Updated Dec. 13, 2013, 7:30 p.m.)


Review request for cordova.


Changes
-------

 - Fixed a forgotten test broken by changes in previous diff.
 - Rebased on latest master.


Bugs: CB-4153
    https://issues.apache.org/jira/browse/CB-4153


Repository: cordova-cli


Description
-------

Add --src & --link to "cordova create".

Both --src and --source are accepted.
The path is passed via the lib.www.uri of the configuration object
that is later written to .cordova/config.json.
    
Cordova will keep going into child www folder(s) of the provided path.


Diffs (updated)
-----

  doc/help.txt 3361dd3 
  e2e/create.spec.js 560f82a 
  spec/cli.spec.js 215c64c 
  spec/metadata/android_parser.spec.js 52fc78a 
  spec/metadata/ios_parser.spec.js b56ddce 
  spec/metadata/windows8_parser.spec.js 5117148 
  spec/metadata/wp7_parser.spec.js 6dc0695 
  spec/metadata/wp8_parser.spec.js 8cd1923 
  src/cli.js 2916062 
  src/config_parser.js b6293d8 
  src/create.js 961d787 
  src/metadata/wp8_parser.js 163d56b 

Diff: https://reviews.apache.org/r/15775/diff/


Testing
-------

npm test;
cordova -d  create TstApp --source=some/www --link
a bunch of other cordova commands in the app


Thanks,

Mark Koudritsky


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Mark Koudritsky <ka...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15775/
-----------------------------------------------------------

(Updated Dec. 13, 2013, 2:35 a.m.)


Review request for cordova.


Changes
-------

Addressed comments by Josh Soref (on the dev mailing list).


Bugs: CB-4153
    https://issues.apache.org/jira/browse/CB-4153


Repository: cordova-cli


Description
-------

Add --src & --link to "cordova create".

Both --src and --source are accepted.
The path is passed via the lib.www.uri of the configuration object
that is later written to .cordova/config.json.
    
Cordova will keep going into child www folder(s) of the provided path.


Diffs (updated)
-----

  doc/help.txt 3361dd3 
  e2e/create.spec.js 560f82a 
  spec/metadata/android_parser.spec.js 52fc78a 
  spec/metadata/ios_parser.spec.js b56ddce 
  spec/metadata/windows8_parser.spec.js 5117148 
  spec/metadata/wp7_parser.spec.js 6dc0695 
  spec/metadata/wp8_parser.spec.js 8cd1923 
  src/cli.js 2916062 
  src/config_parser.js b6293d8 
  src/create.js 961d787 
  src/metadata/wp8_parser.js 163d56b 

Diff: https://reviews.apache.org/r/15775/diff/


Testing
-------

npm test;
cordova -d  create TstApp --source=some/www --link
a bunch of other cordova commands in the app


Thanks,

Mark Koudritsky


Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Andrew Grieve <ag...@chromium.org>.
Reviewboard accounts aren't connected to anything sadly. Just like JIRA,
and the Wiki, you need to create a new account.


On Thu, Dec 12, 2013 at 4:59 PM, Josh Soref <js...@blackberry.com> wrote:

> Mark wrote:
> >https://reviews.apache.org/r/15775/
> >--link was a boolean before, now it accepts a path, so it's either
> >--src=path or --link=path.
> >Added a check in config_parser to make sure we are looking at an xml file
> >that looks like Cordova config.xml to avoid overwriting some unrelated
> >config.xml when symlinking to www dir.
> >
> >Same diff on github:
> https://github.com/kamrik/cordova-cli/compare/src_www
>
> I can¹t figure out how to use review board (I guess the account isn¹t
> connected to JIRA, is it connected to anything else?)
>
> > [--src|source=<PATH>] ...... use custom www assets instead of the stock
> >cordova hello-world.
>
> Please use ³Cordova² not ³cordova² unless you mean ³./cordova² or some
> other script.
> (I¹m aware that there¹s a line in another file which has the same
> convention, that¹s a bug, which is hopefully being fixed by some other
> pending pull request, but if it¹s in flight, then it will miss yours)
>
> > [--link=<PATH>] ............ as above, but symlink the custom www dir
> >instead of copying.
>
>
> Please don¹t use ³as above², it¹s asking for things to break when the next
> person inserts a line into the help file.
>
> +var path = require('path');
> +var optimist; // required in try-catch below to print a nice error
> message if it's not installed.
>
>
> I believe general style would be:
>
> var path = require('path'),
>     optimist,
> Š;
>
> +    // If no inputArgs given, use preocess.argv but without the
>
>
> Please don¹t introduce spelling errors, not even in comments.
>
> > _ = require('lodash');
>
>
> What is this, and why don¹t I see it in packages.json?
>
>
> MacBook-Pro:docs $ node
> > require('lodash')
> Error: Cannot find module 'lodash'
>     at Function.Module._resolveFilename (module.js:338:15)
>
>
>
> +        if (inputArgs[0].match('node')) { // On Win first element is full
> path to node.exe
>
>
>
> This is way too hacky.
>
> You¹re reordering a lot of unrelated code. I¹m very uncomfortable with
> mixing rewrites and new features. I¹d personally prefer you split them
> into distinct commits. ‹ It¹s making reviewing the changes here incredibly
> painful.
>
>
> +    if((r.tag !== 'widget') || !r.attrib || (r.attrib.xmlns !== xmlns)) {
>
>
> There should probably be a space after `if`Š
>
> -        if (contents.length == 0) {
> +        if (contents.length === 0) {
>
>
> If this is a style fix, please have it in a style-fix commit instead of
> mixed with a refactor and a feature.
>
>          } else if (contents.length == 1) {
> Also, why didn¹t you change this??
>
>
> -    shell.mkdir('-p', www_dir);
>
>
> there¹s probably a good reason for this, but it¹s now so burried that
> there¹s no way I can figure out what it is :(
>
>
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential
> information, privileged material (including material protected by the
> solicitor-client or other applicable privileges), or constitute non-public
> information. Any use of this information by anyone other than the intended
> recipient is prohibited. If you have received this transmission in error,
> please immediately reply to the sender and delete this information from
> your system. Use, dissemination, distribution, or reproduction of this
> transmission by unintended recipients is not authorized and may be unlawful.
>
>

Re: Review Request 15775: Add --src & --link to "cordova create"

Posted by Josh Soref <js...@blackberry.com>.
Mark wrote:
>https://reviews.apache.org/r/15775/
>--link was a boolean before, now it accepts a path, so it's either
>--src=path or --link=path.
>Added a check in config_parser to make sure we are looking at an xml file
>that looks like Cordova config.xml to avoid overwriting some unrelated
>config.xml when symlinking to www dir.
>
>Same diff on github: https://github.com/kamrik/cordova-cli/compare/src_www

I can¹t figure out how to use review board (I guess the account isn¹t
connected to JIRA, is it connected to anything else?)

> [--src|source=<PATH>] ...... use custom www assets instead of the stock
>cordova hello-world.

Please use ³Cordova² not ³cordova² unless you mean ³./cordova² or some
other script.
(I¹m aware that there¹s a line in another file which has the same
convention, that¹s a bug, which is hopefully being fixed by some other
pending pull request, but if it¹s in flight, then it will miss yours)

> [--link=<PATH>] ............ as above, but symlink the custom www dir
>instead of copying.


Please don¹t use ³as above², it¹s asking for things to break when the next
person inserts a line into the help file.

+var path = require('path');
+var optimist; // required in try-catch below to print a nice error
message if it's not installed.


I believe general style would be:

var path = require('path'),
    optimist,
Š;

+    // If no inputArgs given, use preocess.argv but without the


Please don¹t introduce spelling errors, not even in comments.

> _ = require('lodash');


What is this, and why don¹t I see it in packages.json?


MacBook-Pro:docs $ node
> require('lodash')
Error: Cannot find module 'lodash'
    at Function.Module._resolveFilename (module.js:338:15)



+        if (inputArgs[0].match('node')) { // On Win first element is full
path to node.exe



This is way too hacky.

You¹re reordering a lot of unrelated code. I¹m very uncomfortable with
mixing rewrites and new features. I¹d personally prefer you split them
into distinct commits. ‹ It¹s making reviewing the changes here incredibly
painful.


+    if((r.tag !== 'widget') || !r.attrib || (r.attrib.xmlns !== xmlns)) {


There should probably be a space after `if`Š

-        if (contents.length == 0) {
+        if (contents.length === 0) {


If this is a style fix, please have it in a style-fix commit instead of
mixed with a refactor and a feature.

         } else if (contents.length == 1) {
Also, why didn¹t you change this??


-    shell.mkdir('-p', www_dir);


there¹s probably a good reason for this, but it¹s now so burried that
there¹s no way I can figure out what it is :(


---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.