[Groonga-commit] nroonga/nroonga [master] keep generated JS script in repository

Back to archive index

null+****@clear***** null+****@clear*****
2011年 11月 25日 (金) 15:06:35 JST


Yoji SHIDARA	2011-11-25 06:06:35 +0000 (Fri, 25 Nov 2011)

  New Revision: 8c96a8d77d01076781fd16073dac3d8e8bbd4a6c

  Log:
    keep generated JS script in repository

  Added files:
    lib/nroonga.js
  Modified files:
    .gitignore
    package.json
    wscript

  Modified: .gitignore (+0 -1)
===================================================================
--- .gitignore    2011-11-25 00:44:32 +0000 (76525a8)
+++ .gitignore    2011-11-25 06:06:35 +0000 (65f1641)
@@ -2,4 +2,3 @@ build
 .lock-wscript
 node_modules
 lib/nroonga_bindings.node
-lib/nroonga.js

  Added: lib/nroonga.js (+41 -0) 100644
===================================================================
--- /dev/null
+++ lib/nroonga.js    2011-11-25 06:06:35 +0000 (987006f)
@@ -0,0 +1,41 @@
+(function() {
+  var nroonga, optionsToCommandString;
+
+  nroonga = module.exports = require('./nroonga_bindings.node');
+
+  optionsToCommandString = function(command, options) {
+    var args, key, value;
+    args = [command];
+    if (options != null) {
+      for (key in options) {
+        value = options[key];
+        args.push('--' + key);
+        args.push(value);
+      }
+    }
+    return args.join(' ');
+  };
+
+  nroonga.Database.prototype.commandSync = function(command, options) {
+    var result;
+    result = this.commandSyncString(optionsToCommandString(command, options));
+    if (result.length > 0) {
+      return JSON.parse(result);
+    } else {
+      return;
+    }
+  };
+
+  nroonga.Database.prototype.command = function(command, options, callback) {
+    var wrappedCallback;
+    if (arguments.length === 2) {
+      callback = options;
+      options = void 0;
+    }
+    wrappedCallback = callback != null ? function(error, data) {
+      return callback(error, data != null ? JSON.parse(data) : void 0);
+    } : void 0;
+    return this.commandString(optionsToCommandString(command, options), wrappedCallback);
+  };
+
+}).call(this);

  Modified: package.json (+2 -1)
===================================================================
--- package.json    2011-11-25 00:44:32 +0000 (cd107e8)
+++ package.json    2011-11-25 06:06:35 +0000 (3156306)
@@ -9,7 +9,8 @@
     "express":""
   },
   "scripts": {
-    "test": "expresso"
+    "test": "expresso",
+    "watch": "coffee -c -w -o lib src"
   },
   "main": "./lib/nroonga"
 }

  Modified: wscript (+0 -2)
===================================================================
--- wscript    2011-11-25 00:44:32 +0000 (7dfad74)
+++ wscript    2011-11-25 06:06:35 +0000 (e0682c3)
@@ -22,8 +22,6 @@ def build(bld):
   obj.source = "src/nroonga.cc"
   obj.uselib = ["GROONGA"]
 
-  os.system('coffee -o lib/ -c src/')
-
 def shutdown():
   if exists(built):
     copy(built, dest)




Groonga-commit メーリングリストの案内
Back to archive index