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

Commit

Permalink
Merge pull request #1504 from mapbox/tl-bridge-up
Browse files Browse the repository at this point in the history
[WIP] Adapt to upcoming tilelive-bridge
  • Loading branch information
Dane Springmeyer committed Nov 11, 2015
2 parents cd294ea + 81992b7 commit ceedcd5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
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

0 comments on commit ceedcd5

Please sign in to comment.