Skip to content

Commit

Permalink
Código para cargar defaultOpts de .yaml (comentado)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Oct 31, 2016
1 parent a06f8c8 commit 3642deb
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 28 deletions.
43 changes: 29 additions & 14 deletions lib/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,6 @@ function throwIfErrors(errors) {
}
}

txtToSql.defaultOpts = {
columnNamesFormat: 'lowercased_names',
separator: false,
includePrimaryKey: null,
columnAlignedCommas: false,
columnAlignedMaxWidth: 100,
outputEngine: 'postgresql',
verboseErrors: false,
inputEncoding: false,
outputEncoding: false,
addDropTable: false,
ignoreNullLines: false
};

var letterTranslator = {
'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'a', 'å':'a', 'À':'a', 'Á':'a', 'Â':'a', 'Ã':'a', 'Ä':'a', 'Å':'a',
'è':'e', 'é':'e', 'ê':'e', 'ë':'e', 'È':'e', 'É':'e', 'Ê':'e', 'Ë':'e',
Expand Down Expand Up @@ -699,4 +685,33 @@ txtToSql.generatePrepareResult = generatePrepareResult;

txtToSql.engines = engines;

/*
// este codigo es para tratar de evitar la duplicacion de txtToSql.defaultOpts y txt-to-sql-defaults.yaml
// desactivado hasta resolver el funcionamiento en web
var miniTools = require('mini-tools');
var Path = require('path');
var defYaml = Path.resolve(Path.parse(__filename).dir, 'txt-to-sql-defaults.yaml');
miniTools.readConfig([defYaml]).then(function(data) {
// console.log("loading", data)
txtToSql.defaultOpts = data.opts;
}).catch(function(err) {
console.log("txt-to-sql loading error", err)
});
*/

txtToSql.defaultOpts = {
columnNamesFormat: 'lowercased_names',
separator: false,
includePrimaryKey: null,
columnAlignedCommas: false,
columnAlignedMaxWidth: 100,
outputEngine: 'postgresql',
verboseErrors: false,
inputEncoding: false,
outputEncoding: false,
addDropTable: false,
ignoreNullLines: false
};

module.exports = txtToSql;
43 changes: 29 additions & 14 deletions web/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,6 @@ function throwIfErrors(errors) {
}
}

txtToSql.defaultOpts = {
columnNamesFormat: 'lowercased_names',
separator: false,
includePrimaryKey: null,
columnAlignedCommas: false,
columnAlignedMaxWidth: 100,
outputEngine: 'postgresql',
verboseErrors: false,
inputEncoding: false,
outputEncoding: false,
addDropTable: false,
ignoreNullLines: false
};

var letterTranslator = {
'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'a', 'å':'a', 'À':'a', 'Á':'a', 'Â':'a', 'Ã':'a', 'Ä':'a', 'Å':'a',
'è':'e', 'é':'e', 'ê':'e', 'ë':'e', 'È':'e', 'É':'e', 'Ê':'e', 'Ë':'e',
Expand Down Expand Up @@ -699,4 +685,33 @@ txtToSql.generatePrepareResult = generatePrepareResult;

txtToSql.engines = engines;

/*
// este codigo es para tratar de evitar la duplicacion de txtToSql.defaultOpts y txt-to-sql-defaults.yaml
// desactivado hasta resolver el funcionamiento en web
var miniTools = require('mini-tools');
var Path = require('path');
var defYaml = Path.resolve(Path.parse(__filename).dir, 'txt-to-sql-defaults.yaml');
miniTools.readConfig([defYaml]).then(function(data) {
// console.log("loading", data)
txtToSql.defaultOpts = data.opts;
}).catch(function(err) {
console.log("txt-to-sql loading error", err)
});
*/

txtToSql.defaultOpts = {
columnNamesFormat: 'lowercased_names',
separator: false,
includePrimaryKey: null,
columnAlignedCommas: false,
columnAlignedMaxWidth: 100,
outputEngine: 'postgresql',
verboseErrors: false,
inputEncoding: false,
outputEncoding: false,
addDropTable: false,
ignoreNullLines: false
};

module.exports = txtToSql;

0 comments on commit 3642deb

Please sign in to comment.