Format files split into pg and ogr directories

This commit is contained in:
Raul Ochoa 2015-05-13 15:15:53 +02:00
parent 80e485d475
commit 6bb3ccbe1e
11 changed files with 29 additions and 21 deletions

View File

@ -1,3 +1,3 @@
test/support/ test/support/
test/websocket_test/ test/websocket_test/
app/models/formats/topojson.js app/models/formats/pg/topojson.js

View File

@ -1,6 +1,10 @@
1.22.1 - 2015-mm-dd 1.22.1 - 2015-mm-dd
------------------- -------------------
Enhancements:
* Format files split into pg and ogr directories
1.22.0 - 2015-04-09 1.22.0 - 2015-04-09
------------------- -------------------

View File

@ -1,16 +1,20 @@
// var fs = require("fs");
// load all the formats
//
var formats = {}; var formats = {};
var path = require('path');
var folder = __dirname + "/";
require("fs").readdirSync(folder).forEach(function(file) { function formatFilesWithPath(dir) {
if (path.extname(file) === '.js' && file !== 'index.js' && file !== 'ogr.js' && file !== 'pg.js' ) { var formatDir = __dirname + '/' + dir;
var format = require(folder + file); return fs.readdirSync(formatDir).map(function(formatFile) {
return formatDir + '/' + formatFile;
});
}
var formatFilesPaths = []
.concat(formatFilesWithPath('ogr'))
.concat(formatFilesWithPath('pg'));
formatFilesPaths.forEach(function(file) {
var format = require(file);
formats[format.prototype.id] = format; formats[format.prototype.id] = format;
}
}); });
module.exports = formats; module.exports = formats;

View File

@ -1,4 +1,4 @@
var ogr = require('./ogr'); var ogr = require('./../ogr');
function CsvFormat() {} function CsvFormat() {}

View File

@ -1,4 +1,4 @@
var ogr = require('./ogr'); var ogr = require('./../ogr');
function KmlFormat() {} function KmlFormat() {}

View File

@ -3,7 +3,7 @@ var fs = require('fs');
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var assert = require('assert'); var assert = require('assert');
var ogr = require('./ogr'); var ogr = require('./../ogr');
function ShpFormat() { function ShpFormat() {
} }

View File

@ -1,7 +1,7 @@
var _ = require('underscore'); var _ = require('underscore');
var pg = require('./pg'); var pg = require('./../pg');
var ArrayBufferSer = require("../bin_encoder"); var ArrayBufferSer = require("../../bin_encoder");
function BinaryFormat() {} function BinaryFormat() {}

View File

@ -1,6 +1,6 @@
var _ = require('underscore'); var _ = require('underscore');
var pg = require('./pg'); var pg = require('./../pg');
function GeoJsonFormat() { function GeoJsonFormat() {
this.buffer = ''; this.buffer = '';

View File

@ -1,7 +1,7 @@
var _ = require('underscore'); var _ = require('underscore');
var pg = require('./pg'); var pg = require('./../pg');
var PgErrorHandler = require('../../postgresql/error_handler'); var PgErrorHandler = require('../../../postgresql/error_handler');
function JsonFormat() { function JsonFormat() {
this.buffer = ''; this.buffer = '';

View File

@ -1,4 +1,4 @@
var pg = require('./pg'); var pg = require('./../pg');
var svg_width = 1024.0; var svg_width = 1024.0;
var svg_height = 768.0; var svg_height = 768.0;

View File

@ -1,4 +1,4 @@
var pg = require('./pg'); var pg = require('./../pg');
var _ = require('underscore'); var _ = require('underscore');
var geojson = require('./geojson'); var geojson = require('./geojson');
var TopoJSON = require('topojson'); var TopoJSON = require('topojson');