diff options
author | Mathias Stearn <mathias@10gen.com> | 2010-07-16 15:42:28 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2010-07-16 15:42:51 -0400 |
commit | 5a2c3aa7ee5ed55b707b0ef2fa60ac320333debd (patch) | |
tree | 85d93ea074c1920bd092918eaacbc838eab78a34 | |
parent | 15db784238ae49b0fc9581bb2aeda7333590ae6c (diff) | |
download | mongo-5a2c3aa7ee5ed55b707b0ef2fa60ac320333debd.tar.gz |
Fix js munging
-rw-r--r-- | SConstruct | 9 | ||||
-rw-r--r-- | shell/mongo_vstudio.cpp | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct index 45b06357cbe..2dd8ce37355 100644 --- a/SConstruct +++ b/SConstruct @@ -1070,7 +1070,13 @@ def concatjs(target, source, env): for s in source: f = open( str(s) , 'r' ) for l in f: - l = l.split("//")[0].strip() + + #strip comments. special case if // is potentially in a string + parts = l.split("//", 1) + if (len(parts) > 1) and ('"' not in parts[1]) and ('"' not in parts[1]): + l = parts[0] + + l = l.strip() if len ( l ) == 0: continue @@ -1112,7 +1118,6 @@ def jsToH(target, source, env): for l in open( str(source[0]) , 'r' ): l = l.strip() - l = l.split( "//" )[0] l = l.replace( '\\' , "\\\\" ) l = l.replace( '"' , "\\\"" ) diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp index 3d5b17e23b7..e712575dc79 100644 --- a/shell/mongo_vstudio.cpp +++ b/shell/mongo_vstudio.cpp @@ -264,6 +264,7 @@ const char * jsconcatcode = "print( \"warning: no DBRef\" );}\n" "if ( typeof( BinData ) != \"undefined\" ){\n" "BinData.prototype.tojson = function () {\n" + "//return \"BinData type: \" + this.type + \" len: \" + this.len;\n" "return this.toString();}}\n" "else {\n" "print( \"warning: no BinData class\" );}\n" @@ -522,6 +523,8 @@ const char * jsconcatcode = "print( tojson( x ) );}\n" "shellAutocomplete = function( prefix ){\n" "var a = [];\n" + "//a.push( prefix + \"z\" )\n" + "//a.push( prefix + \"y\" )\n" "__autocomplete__ = a;}\n" "shellHelper = function( command , rest , shouldPrint ){\n" "command = command.trim();\n" @@ -653,7 +656,9 @@ const char * jsconcatcode = "print(\"\\trs.add(hostportstr) add a new member to the set with default attributes\");\n" "print(\"\\trs.conf() return configuration from local.system.replset\");\n" "print();\n" - "print(\"\\tdb.isMaster() check who is primary\");}\n" + "print(\"\\tdb.isMaster() check who is primary\");\n" + "print();\n" + "print(\"\\tsee also http://<host>:28017/_replSet for additional diagnostic info\");}\n" "rs.status = function () { return db._adminCommand(\"replSetGetStatus\"); }\n" "rs.initiate = function (c) { return db._adminCommand({ replSetInitiate: c }); }\n" "rs.add = function (hostport) {\n" @@ -1373,6 +1378,7 @@ const char * jsconcatcode = "DBQuery.prototype.toString = function(){\n" "return \"DBQuery: \" + this._ns + \" -> \" + tojson( this.query );}\n" "DBQuery.shellBatchSize = 20;\n" + "// or db[\"colName\"]\n" "if ( ( typeof DBCollection ) == \"undefined\" ){\n" "DBCollection = function( mongo , db , shortName , fullName ){\n" "this._mongo = mongo;\n" @@ -1679,6 +1685,7 @@ const char * jsconcatcode = "function( spec ){\n" "var coll = mydb.getCollection( shortName + \".$\" + spec.name );\n" "var mysize = coll.storageSize();\n" + "//print( coll + \"\\t\" + mysize + \"\\t\" + tojson( coll.validate() ) );\n" "total += coll.dataSize();}\n" ");\n" "return total;}\n" |