Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Finshed connection

  • Loading branch information...
commit 2d0613364e2f99d79aa077153b36895b62bb1f1f 1 parent dbaeeca
@pksunkara authored
View
36 Cakefile
@@ -5,21 +5,21 @@ task 'lib', 'Generate the library from the src', ->
coffee.stdout.on 'data', (data) -> console.log data.toString().trim()
task 'docs', 'Generate the documentation from the src', ->
- exec([
- 'rm -rf docs'
- 'for i in $(find src -name *.coffee)'
- 'do mkdir -p $(dirname $i | sed -s "s/src/docs/")'
- ' docco $i'
- ' dirs=$i; ext=""'
- ' while expr $(dirname $dirs) != "src"'
- ' do dirs=$(dirname $dirs)'
- ' ext="..\\/$ext"'
- ' done'
- ' ext=$ext"docco.css"'
- ' file="docs/"$(basename $i | sed -s "s/coffee/html/")'
- ' sed -i "s/docco.css/$ext/" $file'
- ' mv $file $(echo $i | sed -s "s/coffee/html/;s/src/docs/")'
- 'done'
- ].join('; '), (err) ->
- throw err if err
- )
+ # exec([
+ # 'rm -rf docs'
+ # 'for i in $(find src -name *.coffee)'
+ # 'do mkdir -p $(dirname $i | sed -s "s/src/docs/")'
+ # ' docco $i'
+ # ' dirs=$i; ext=""'
+ # ' while expr $(dirname $dirs) != "src"'
+ # ' do dirs=$(dirname $dirs)'
+ # ' ext="..\\/$ext"'
+ # ' done'
+ # ' ext=$ext"docco.css"'
+ # ' file="docs/"$(basename $i | sed -s "s/coffee/html/")'
+ # ' sed -i "s/docco.css/$ext/" $file'
+ # ' mv $file $(echo $i | sed -s "s/coffee/html/;s/src/docs/")'
+ # 'done'
+ # ].join('; '), (err) ->
+ # throw err if err
+ # )
View
0  data/.gitkeep
No changes.
View
28 src/nosqlite.coffee
@@ -1,2 +1,30 @@
path = require 'path'
fs = require 'fs'
+
+nosqlite = module.exports
+
+nosqlite.path = path.join path.resolve(__dirname, '..'), 'data'
+
+nosqlite.Connection = (arg) ->
+ options = {}
+ this.path = nosqlite.path
+
+ if typeof(arg) is 'object'
+ options = arg
+ this.path = options.path
+ else if typeof(arg) is 'string'
+ this.path = arg
+
+nosqlite.Connection::database = (name) ->
+ that = this
+ connection = this
+
+ dir = path.resolve this.dir, name
+
+ name: name
+
+ exists: (cb) ->
+ path.exists dir, cb
+
+ existsSync: ->
+ path.existsSync dir
View
28 test/connection-test.coffee
@@ -0,0 +1,28 @@
+vows = require 'vows'
+assert = require 'assert'
+path = require 'path'
+
+vows
+ .describe('connection')
+ .addBatch
+ 'Connection':
+ topic: require '../src/nosqlite'
+
+ 'should have default path': (nosqlite) ->
+ assert.equal nosqlite.path, path.resolve(__dirname, '..', 'data')
+
+ 'without options':
+ topic: (nosqlite) ->
+ return new(nosqlite.Connection)()
+
+ 'should be successful': (topic) ->
+ assert.equal topic.path, path.resolve(__dirname, '..', 'data')
+
+ 'with options':
+ topic: (nosqlite) ->
+ return new(nosqlite.Connection) path.resolve(__dirname, 'fixtures')
+
+ 'should be successful': (topic) ->
+ assert.equal topic.path, path.resolve(__dirname, 'fixtures')
+
+ .export(module)
View
0  test/fixtures/.gitkeep
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.