Permalink
Browse files

Prep for publishing via npm

Add package.json
Move redisql.js to index.js
Reformat README in Markdown
  • Loading branch information...
1 parent 9f031ab commit 80627e81fa55407b0c8ad1e010f82321aa988e10 @mranney committed Oct 29, 2010
Showing with 52 additions and 25 deletions.
  1. +0 −15 README
  2. +24 −0 README.md
  3. +1 −1 examples/pop_denorm.js
  4. +14 −9 examples/redisql_examples.js
  5. 0 redisql.js → index.js
  6. +13 −0 package.json
View
15 README
@@ -1,15 +0,0 @@
-
-This is the Node.js (http://nodejs.org/) client for Redisql (http://code.google.com/p/redisql/)
-
-To install you must first install
-1.) node
-2.) npm (http://github.com/isaacs/npm)
-3.) Redisql
-
-Then type "npm install Redisql"
-
-
-To test,
-1.) make sure ./redisql-server is running
-2.) THIS TEST WILL CALL "FLUSHDB" on database 0 of redisql -> you will lose data
-3.) type "node examples/redisql_examples.js"
View
24 README.md
@@ -0,0 +1,24 @@
+node_Redisql
+============
+
+This is the [Node.js](http://nodejs.org/) client for [Redisql](http://code.google.com/p/redisql/).
+
+## Prerequisites
+
+To install `node_Redisql` you must first install:
+
+1. node
+2. [npm](http://github.com/isaacs/npm)
+3. Redisql
+
+## Installation
+
+Installation is done with `npm`.
+
+ npm install redisql
+
+To test:
+
+1. make sure ./redisql-server is running
+2. THIS TEST WILL CALL "FLUSHDB" on database 0 of redisql -> you will lose data
+3. type "node examples/redisql_examples.js"
View
2 examples/pop_denorm.js
@@ -1,4 +1,4 @@
-var redisql = require("./redisql");
+var redisql = require("redisql");
var client = redisql.createClient();
var init = true;
var verbose = false;
View
23 examples/redisql_examples.js
@@ -1,4 +1,4 @@
-var redisql = require("./redisql");
+var redisql = require("redisql");
var client = redisql.createClient();
function last_command(err, res) {
@@ -24,7 +24,7 @@ function insert_worker(redisql, client) {
client.insert("worker", "(9,22,1,31111.99,ken)", redisql.print);
client.insert_return_size("worker", "(10,33,4,111111.99,seth)", redisql.print);
}
-
+
function scanselect_worker(redisql, client) {
client.scanselect("*", "worker", redisql.print);
client.scanselect("*", "worker", "name=bill", redisql.print);
@@ -35,13 +35,13 @@ function update_worker(redisql, client) {
client.update("worker", "name=JIM", "id = 1", redisql.print);
client.select("*", "worker", "id = 1", redisql.print);
}
-
+
function delete_worker(redisql, client) {
client.select("*", "worker", "id = 2", redisql.print);
client.delete("worker", "id = 2", redisql.print);
client.select("*", "worker", "id = 2", redisql.print);
}
-
+
function desc_worker(redisql, client) {
client.desc("worker", redisql.print);
}
@@ -75,14 +75,18 @@ function create_table_from_redis_object_example(redisql, client) {
client.dump("zset_example_table", redisql.print);
}
-function create_table_as_example(redisql, client) {
+function create_table_as_example(redisql, client, callback) {
client.zadd("zset_example", 3.3, "bob", redisql.print);
client.zadd("zset_example", 1.1, "ted", redisql.print);
client.zadd("zset_example", 4.4, "ken", redisql.print);
client.zadd("zset_example", 2.2, "mac", redisql.print);
client.create_table_as("zset_beginning",
"ZREVRANGE", "zset_example", "0 1", redisql.print);
- client.dump("zset_beginning", redisql.print);
+ client.dump("zset_beginning", redisql.print, function (err, res) {
+ if (typeof callback === "function") {
+ callback(err, res);
+ }
+ });
}
client.flushdb(redisql.print);
@@ -95,9 +99,10 @@ desc_worker(redisql, client);
dump_worker(redisql, client);
istore_worker_name_list(redisql, client);
create_table_from_redis_object_example(redisql, client);
-create_table_as_example(redisql, client);
+create_table_as_example(redisql, client, function (err, res) {
+ console.log("End of example, sending QUIT command");
+ client.quit();
+});
//drop_index_worker(redisql, client);
//drop_table_worker(redisql, client);
-
-client.ping(last_command); // final command to exit cleanly
View
0 redisql.js → index.js
File renamed without changes.
View
13 package.json
@@ -0,0 +1,13 @@
+{ "name" : "redisql",
+ "version" : "0.0.1",
+ "description" : "Redisql client library",
+ "author": "First Last <email@sub.domain>",
+ "main": "./index.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/JakSprats/node_Redisql.git"
+ },
+ "dependencies": {
+ "redis": ">=0.3.5"
+ }
+}

0 comments on commit 80627e8

Please sign in to comment.