Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
Renamed CRUD=> HUB
Moved corpus into ./test/testData/
  • Loading branch information
yangit committed Sep 19, 2014
1 parent 1bf9490 commit 944e9cf
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions corpus/corpus.js → index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
var assert = require('assert');
var path = require('path');
var fs = require('fs');
var Crud = require('puddle-crud');
var Hub = require('puddle-hub');

module.exports = function (file) {
assert.equal(path.extname(file), '.json');
var corpus = JSON.parse(fs.readFileSync(file));
var crud = new Crud(corpus);
var hub = new Hub(corpus);
var dumpCorpus = function () {
fs.writeFileSync(
file,
JSON.stringify(crud.getState(), undefined, 4)
JSON.stringify(hub.getState(), undefined, 4)
);
};
crud.on('create', dumpCorpus);
crud.on('remove', dumpCorpus);
crud.on('update', dumpCorpus);
return crud;
hub.on('create', dumpCorpus);
hub.on('remove', dumpCorpus);
hub.on('update', dumpCorpus);
return hub;
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "puddle-corpus",
"version": "1.0.1",
"description": "Corpus representaion stored in JSON and wrapped into Corpus CRUD API",
"main": "corpus/corpus.js",
"main": "index.js",
"scripts": {
"coverage": "istanbul check-coverage _mocha",
"coveralls": "coveralls < ./coverage/lcov.info",
Expand All @@ -26,7 +26,7 @@
},
"homepage": "https://github.com/pomagma/puddle-corpus",
"dependencies": {
"puddle-crud": "^1.0.0"
"puddle-hub": "^2.0.2"
},
"devDependencies": {
"coveralls": "^2.11.1",
Expand Down
6 changes: 3 additions & 3 deletions test/convertTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
var assert = require('assert');
var fs = require('fs');
var converter = require('../convert');
var testData = require('./testData.js');
testData.realJson = fs.readFileSync('./corpus/main.json').toString();
testData.realCorpus = fs.readFileSync('./corpus/main.corpus').toString();
var testData = require('./testData/testData.js');
testData.realJson = fs.readFileSync('./test/testData/test.json').toString();
testData.realCorpus = fs.readFileSync('./test/testData/test.corpus').toString();

describe('Conversion utility', function () {

Expand Down
4 changes: 2 additions & 2 deletions test/corpusTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var assert = require('assert');
var path = require('path');
var corpusFile = path.join(__dirname, '../corpus/main.json');
var corpusFile = path.join(__dirname, './testData/test.json');
var uuid = require('node-uuid');
var rewire = require('rewire');
var sinon = require('sinon');
Expand All @@ -15,7 +15,7 @@ describe('Corpus', function () {

beforeEach(function () {
writeSpy = sinon.spy();
corpusUninitialized = rewire('../corpus/corpus.js');
corpusUninitialized = rewire('../index.js');
corpusUninitialized.__set__('fs', {
writeFileSync: writeSpy,
readFileSync: function (filePath) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 944e9cf

Please sign in to comment.