diff options
author | adam <anton@adamansky.com> | 2012-11-02 12:33:29 +0700 |
---|---|---|
committer | adam <anton@adamansky.com> | 2012-11-02 12:33:29 +0700 |
commit | 8a94851ea11673e891851819271c054b2782f74f (patch) | |
tree | 204a455adebd6a2e4bbedc1aa424baae9697b5a8 | |
parent | 7811a458084725f55e6cb450cca54ae8bd4765c6 (diff) | |
download | ejdb-8a94851ea11673e891851819271c054b2782f74f.tar.gz ejdb-8a94851ea11673e891851819271c054b2782f74f.tar.bz2 ejdb-8a94851ea11673e891851819271c054b2782f74f.zip |
#1
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .idea/misc.xml | 3 | ||||
-rw-r--r-- | binding.gyp | 47 | ||||
-rw-r--r-- | node/binding.gyp | 30 | ||||
-rw-r--r-- | node/ejdb.js | 12 | ||||
-rw-r--r-- | node/nbproject/configurations.xml | 4 | ||||
-rw-r--r-- | node/package.json | 5 | ||||
-rw-r--r-- | node/tests/t1.js | 2 | ||||
-rw-r--r-- | package.json | 27 | ||||
-rw-r--r-- | tcejdb/tcejdb.iml | 2 | ||||
-rw-r--r-- | tests.mk | 5 | ||||
-rw-r--r-- | var/.stub | 0 |
12 files changed, 95 insertions, 45 deletions
@@ -44,5 +44,6 @@ /tcejdb/testejdb/t3 /node/nbproject/private -/node/build +/build +/var diff --git a/.idea/misc.xml b/.idea/misc.xml index 1e5cd7e..1e0f4c7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -50,6 +50,9 @@ <option name="referencePos" value="0" /> <option name="showLabels" value="true" /> </component> + <component name="UnicodeBrowser"> + <option name="fontName" value="Lucida Sans Typewriter" /> + </component> <component name="WebServicesPlugin" addRequiredLibraries="true" /> </project> diff --git a/binding.gyp b/binding.gyp new file mode 100644 index 0000000..ca5a1c0 --- /dev/null +++ b/binding.gyp @@ -0,0 +1,47 @@ +{ + 'variables' : { + + }, + + 'target_defaults': { + 'configurations': { + 'Debug': { + }, + 'Release':{ + 'defines': [ 'NDEBUG' ], + } + }, + 'conditions': [ + ['OS == "win"', { + + }, { + 'defines': [ + '_LARGEFILE_SOURCE', + '_FILE_OFFSET_BITS=64', + '_GNU_SOURCE', + ], + }], + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + 'cflags': [ '-Wall', '-pedantic', '-fsigned-char', '-pthread', '-Wno-variadic-macros'], + 'cflags_cc!' : [ '-fno-exceptions' ], + 'libraries' : [ + '-L../tcejdb', + '-Wl,-Bstatic -ltcejdb', + '-Wl,-Bdynamic', + '-lbz2 -lz -lrt -lpthread -lm -lc' + ] + }], + ], + 'include_dirs' : ['tcejdb'], + }, + + 'targets' : [ + { + 'target_name' : 'ejdb_native', + 'sources' : [ + 'node/ejdb_native.cc', + 'node/ejdb_logging.cc' + ] + }, + ] +}
\ No newline at end of file diff --git a/node/binding.gyp b/node/binding.gyp deleted file mode 100644 index 5e3b4db..0000000 --- a/node/binding.gyp +++ /dev/null @@ -1,30 +0,0 @@ -{ - 'targets': [ - { - 'target_name' : 'ejdb_native', - 'sources' : [ - 'ejdb_native.cc', - 'ejdb_logging.cc' - ], - 'include_dirs': ['../tcejdb'], - 'libraries' : [ - '-L../../tcejdb', - '-Wl,-Bstatic -ltcejdb', - '-Wl,-Bdynamic', - '-lbz2 -lz -lrt -lpthread -lm -lc' - ], - 'cflags': [ - '-g', - '-O0', - '-fPIC', - '-pedantic', - '-Wno-variadic-macros', - '-D_GNU_SOURCE', - '-D_FILE_OFFSET_BITS=64', - '-D_LARGEFILE_SOURCE' - ], - 'cflags!': [ '-fno-exceptions' ], - 'cflags_cc!': [ '-fno-exceptions' ] - } - ] -}
\ No newline at end of file diff --git a/node/ejdb.js b/node/ejdb.js index b319762..500d19a 100644 --- a/node/ejdb.js +++ b/node/ejdb.js @@ -1,6 +1,12 @@ -var ejdblib = require("./build/Release/ejdb_native"); -var EJDBImpl = ejdblib.NodeEJDB +var ejdblib; +try { + ejdblib = require("../build/Release/ejdb_native.node"); +} catch(e) { + console.error("Warning: Using the DEBUG version of EJDB nodejs binding"); + ejdblib = require("../build/Debug/ejdb_native.node"); +} +var EJDBImpl = ejdblib.NodeEJDB; const DEFAULT_OPEN_MODE = (ejdblib.JBOWRITER | ejdblib.JBOCREAT); var EJDB = function(dbFile, openMode) { @@ -21,7 +27,7 @@ EJDB.open = function(dbFile, openMode) { EJDB.prototype.close = function() { return this._impl.close(); -} +}; module.exports = EJDB; diff --git a/node/nbproject/configurations.xml b/node/nbproject/configurations.xml index 43263ca..f27e283 100644 --- a/node/nbproject/configurations.xml +++ b/node/nbproject/configurations.xml @@ -9,10 +9,6 @@ </df> </df> </df> - <in>Makefile</in> - <in>binding.Makefile</in> - <in>config.gypi</in> - <in>ejdb_native.target.mk</in> </df> <df name="build"> <df name="Release"> diff --git a/node/package.json b/node/package.json deleted file mode 100644 index 979e83d..0000000 --- a/node/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "ejdb", - "version": "1.0.0", - "main": "./ejdb.js" -}
\ No newline at end of file diff --git a/node/tests/t1.js b/node/tests/t1.js index ffba27a..6b240d0 100644 --- a/node/tests/t1.js +++ b/node/tests/t1.js @@ -1,6 +1,6 @@ var EJDB = require("../ejdb.js"); module.exports.testOpenClose = function(test) { - var jb = EJDB.open("tdb1"); + var jb = EJDB.open("var/tdb1"); test.done(); }
\ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..19567fb --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name" : "ejdb", + "version" : "1.0.0", + "main" : "node/ejdb.js", + "description" : "EJDB - Embedded JSON Database engine", + "homepage" : "https://github.com/Softmotions/ejdb", + "author" : { + "name" : "Anton Adamansky", + "email" : "adamansky@gmail.com" + }, + "repository" : { + "type" : "git", + "url" : "https://github.com/Softmotions/ejdb.git" + }, + "engines" : { + "node" : "0.8.x" + }, + "dependencies" : { + "async" : "latest" + }, + "devDependencies": { + "nodeunit" : ">=0.7.0" + }, + "scripts": { + "test" : "make -f tests.mk" + } +}
\ No newline at end of file diff --git a/tcejdb/tcejdb.iml b/tcejdb/tcejdb.iml index b3e688b..9f9a6f2 100644 --- a/tcejdb/tcejdb.iml +++ b/tcejdb/tcejdb.iml @@ -2,7 +2,7 @@ <module type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> - <content url="file://$MODULE_DIR$/../docs" /> + <content url="file://$MODULE_DIR$/../node" /> <content url="file://$MODULE_DIR$"> <excludeFolder url="file://$MODULE_DIR$/nbproject" /> </content> diff --git a/tests.mk b/tests.mk new file mode 100644 index 0000000..b942d15 --- /dev/null +++ b/tests.mk @@ -0,0 +1,5 @@ + +test : + - mkdir -p var + make -C ./tcejdb check-ejdb + nodeunit ./node/tests
\ No newline at end of file diff --git a/var/.stub b/var/.stub new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/var/.stub |