dat-ecosystem-archive / gasket

Build cross platform data pipelines [ DEPRECATED - More info on active projects and modules at https://dat-ecosystem.org/ ]
191 stars 19 forks source link

another bug? #6

Closed max-mapper closed 10 years ago

max-mapper commented 10 years ago

test.json:

{"float":{"_":"2.9402447","name":"score"},"arr":[{"name":"applicant","str":"Carl Hockett"},{"name":"applicant_sort","str":"Carl Hockett"},{"name":"brief","bool":"true"},{"name":"city","str":"Santa Rosa"},{"name":"dateRcpt","date":"2014-02-21T05:00:00Z"},{"name":"disseminated","date":"2014-02-21T20:25:14.053Z"},{"name":"exParte","bool":"false"},{"name":"id","long":"6017590320"},{"name":"modified","date":"2014-02-21T20:25:14.053Z"},{"name":"pages","int":"1"},{"name":"proceeding","str":"14-28"},{"name":"regFlexAnalysis","bool":"false"},{"name":"smallBusinessImpact","bool":"false"},{"name":"stateCd","str":"CA"},{"name":"submissionType","str":"COMMENT"},{"name":"text","str":"7521074778.txt \nReclassify The Internet As A Common Carrier.  \nAs always, the disclaimer:  I only choose the best alternative option to \"Mr.\" as I \nobject to the title as offensive and refuse to use it.  Had I been a Warrant Officer\nin Vietnam, I would THEN accept it, but I wasn't, so \"Dr.\" it is, since you provide \nno better alternative.\nPage 1\n\n"},{"name":"viewingStatus","str":"Unrestricted"},{"name":"zip","str":"95407"}]}

package.json:

{
  "name": "data",
  "version": "0.0.0",
  "gasket": [
    "jsonmap \"delete this.arr\""
  ],
  "dependencies": {
    "jsonmap": "^1.1.1"
  }
}

what happens:

$ cat test.json | gasket run
$ cat test.json | gasket exec jsonmap "delete this.arr"
$ cat test.json | jsonmap "delete this.arr"
{"float":{"_":"2.9402447","name":"score"}}

they should all output the same thing

finnp commented 10 years ago

I just tracked this down to the npm-execspawn module.

The problem is this line, which removes the quotes: jsonmap "delete this.arr" -> jsonmap delete this.arr

 var parsed = parse(cmd, xtend(opts.env, args, {'':'$'})).map(toString).join(' ')

(https://github.com/mafintosh/npm-execspawn/blob/master/index.js#L29)

I think it is a bug in the npm-execspawn module. I was just able to fix that and will send a pull request to that module.

mafintosh commented 10 years ago

@maxogden try updating to latest - should be fixed