Skip to content

Commit

Permalink
Expose package.json as mysql.PACKAGE
Browse files Browse the repository at this point in the history
Fixes #104
  • Loading branch information
felixge committed Aug 31, 2011
1 parent 9cb64cd commit e352ae8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/mysql.js
@@ -1,8 +1,15 @@
var mysql = exports;
var hashish = require('hashish');
var Client = exports.Client = require('./client');
var constants = require('./constants');
var fs = require('fs');

exports.createClient = function(config) {
mysql.PACKAGE = (function() {
var json = fs.readFileSync(__dirname + '/../package.json', 'utf8');
return JSON.parse(json);
})();

mysql.createClient = function(config) {
var client = new Client();
hashish.update(client, config || {});
return client;
Expand Down
8 changes: 8 additions & 0 deletions test/fast/test-mysql.js
@@ -0,0 +1,8 @@
var common = require('../common');
var assert = require('assert');
var test = common.fastOrSlow.fast();
var mysql = require(common.dir.lib + '/mysql');

test('Package JSON is exported', function() {
assert.strictEqual(mysql.PACKAGE.name, 'mysql');
});

0 comments on commit e352ae8

Please sign in to comment.