Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

[WIP] Adapt to upcoming tilelive-bridge #1504

Merged
merged 5 commits into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"mapnik-reference": "~8.5.1",
"carto": "0.15.3",
"tilelive": "~5.9.0",
"tilelive-bridge": "~2.1.0",
"tilelive-bridge": "~2.2.1",
"tilelive-vector": "~3.5.0",
"mapnik-omnivore": "~6.3.0",
"gdal": "0.7.0",
"mapnik-omnivore": "~6.3.2",
"gdal": "~0.7.2",
"abaculus": "1.2.1",
"mapbox-machine-styles": "2.3.1",
"mapbox-studio-pro-fonts": "https://mapbox-npm.s3.amazonaws.com/package/mapbox-studio-pro-fonts-1.0.0-9870a90b713f307b9391829602f4d5857e419615.tgz",
Expand Down
26 changes: 23 additions & 3 deletions test/source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var assert = require('assert');
var upload = require('mapbox-upload');
var tm = require('../lib/tm');
var source = require('../lib/source');
var mkdirp = require('mkdirp');
var tilelive = require('tilelive');
var testutil = require('./util');
var mockOauth = require('../lib/mapbox-mock')(require('express')());
Expand Down Expand Up @@ -352,14 +353,33 @@ test('local: saves source to disk', function(t) {
});

test('local: save as tmp => perm', function(t) {
var tmpid = 'tmpsource://' + tm.join(__dirname, '/fixtures-local source');
var source_dir = tm.join(__dirname, '/fixtures-local source');
var tmpid = 'tmpsource://' + source_dir;
source.info(tmpid, function(err, data) {
t.ifError(err);
var permid = path.join(tmp, 'source-saveas-' + Math.random().toString(36).split('.').pop());
mkdirp.sync(permid);
[
'10m-900913-bounding-box.dbf',
'10m-900913-bounding-box.shx',
'10m-900913-bounding-box.index',
'10m-900913-bounding-box.shp',
'10m_lakes_historic.dbf',
'10m_lakes_historic.shx',
'10m_lakes_historic.index',
'10m_lakes_historic.shp'
].forEach(function(f) {
fs.writeFileSync(path.join(permid,f),fs.readFileSync(path.join(source_dir,f)));
});
source.save(_({_tmp:tmpid, id:permid}).defaults(data), function(err, source) {
t.ifError(err);
t.ok(source);
t.equal(source.data._tmp, false);
if (source) {
t.ok(source.data);
if (source.data) {
t.equal(source.data._tmp, false);
}
}
var tmpdir = tm.parse(permid).dirname;
t.ok(fs.existsSync(tm.join(tmpdir,'data.yml')));
t.ok(fs.existsSync(tm.join(tmpdir,'data.xml')));
Expand Down Expand Up @@ -463,7 +483,7 @@ test('source.mbtilesExport: verify export', function(t) {
src._db.get('select count(1) as count, sum(length(tile_data)) as size from tiles;', function(err, row) {
t.ifError(err);
t.equal(row.count, 5461);
t.equal(row.size, 377696);
t.equal(row.size, 377704);
check([
[0,0,0],
[1,0,0],
Expand Down