Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace config command with init command.

Created template files are initial example templates to be used to construct the output, not configuration on how DataGen will be used.
  • Loading branch information...
commit c9f46404207946cd3c5c29b8aaedd86888f8bbed 1 parent d5d69de
@cliffano authored
View
2  CHANGELOG.md
@@ -1,5 +1,5 @@
### 0.0.6 (SNAPSHOT)
-*
+* Replace config command with init command
### 0.0.5
* Add template functions: email and phone
View
2  README.md
@@ -15,7 +15,7 @@ Usage
Create example header, segment, and footer template files:
- datagen config
+ datagen init
Generate 8 data files containing 1 million segments in each file, written to data1 ... data8 output files, running over 8 processes, each process is used to generate 1 file:
View
10 lib/cli.js
@@ -11,8 +11,8 @@ var _ = require('underscore'),
**/
function exec() {
- function _config() {
- new datagen().config(bag.cli.exit);
+ function _init() {
+ new datagen().init(bag.cli.exit);
}
function _generate(args) {
@@ -20,9 +20,9 @@ function exec() {
}
var commands = {
- config: {
- desc: 'Create sample configuration file',
- action: _config
+ init: {
+ desc: 'Create example template files',
+ action: _init
},
gen: {
desc: 'Generate data file',
View
8 lib/datagen.js
@@ -11,13 +11,13 @@ function DataGen() {
}
/**
- * DataGen#config(cb)
+ * DataGen#init(cb)
* - cb (Function): standard cb(err, result) callback
*
- * Create sample header, segment, footer configuration files in current directory.
+ * Create example header, segment, footer template files in current directory.
**/
-DataGen.prototype.config = function (cb) {
- console.log('Creating sample configuration files: header, segment, footer');
+DataGen.prototype.init = function (cb) {
+ console.log('Creating example template files: header, segment, footer');
ncp.ncp(p.join(__dirname, '../examples'), '.', cb);
};
View
12 test/cli.js
@@ -20,8 +20,8 @@ describe('cli', function () {
},
'./datagen': function () {
return {
- config: function (exit) {
- checks.datagen_config_exit = exit;
+ init: function (exit) {
+ checks.datagen_init_exit = exit;
},
generate: function (genId, numSegments, numWorkers, outFile, exit) {
checks.datagen_generate_genId = genId;
@@ -46,10 +46,10 @@ describe('cli', function () {
describe('exec', function () {
- it('should contain config command and delegate to datagen config when exec is called', function () {
- checks.bag_parse_commands.config.desc.should.equal('Create sample configuration file');
- checks.bag_parse_commands.config.action();
- checks.datagen_config_exit.should.be.a('function');
+ it('should contain init command and delegate to datagen init when exec is called', function () {
+ checks.bag_parse_commands.init.desc.should.equal('Create example template files');
+ checks.bag_parse_commands.init.action();
+ checks.datagen_init_exit.should.be.a('function');
});
it('should contain generate command and delegate to datagen generate when exec is called', function () {
View
8 test/datagen.js
@@ -25,9 +25,9 @@ describe('datagen', function () {
mocks = {};
});
- describe('config', function () {
+ describe('init', function () {
- it('should copy sample template files to current directory when config is called', function (done) {
+ it('should copy sample template files to current directory when init is called', function (done) {
mocks.requires = {
'ncp': {
ncp: function (source, target, cb) {
@@ -38,13 +38,13 @@ describe('datagen', function () {
}
};
datagen = new (create(checks, mocks))();
- datagen.config(function () {
+ datagen.init(function () {
done();
});
checks.ncp_ncp_source.should.equal('/somedir/datagen/examples');
checks.ncp_ncp_target.should.equal('.');
checks.console_log_messages.length.should.equal(1);
- checks.console_log_messages[0].should.equal('Creating sample configuration files: header, segment, footer');
+ checks.console_log_messages[0].should.equal('Creating example template files: header, segment, footer');
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.