Change --nolocalizing to --nosymlink. Turns out Millstone actually does a bunch of other smart stuff. Now millstone is required always (as it was before, it just acted like it could work without it).

This commit is contained in:
danzel 2012-06-12 14:59:15 +12:00
parent d07a7c813b
commit c2919a9177

View File

@ -6,7 +6,7 @@ var path = require('path'),
carto = require('carto'); carto = require('carto');
var args = process.argv.slice(1); var args = process.argv.slice(1);
var options = {}; var options = { nosymlink:false };
args = args.filter(function (arg) { args = args.filter(function (arg) {
var match; var match;
@ -25,8 +25,8 @@ args = args.filter(function (arg) {
options.benchmark = true; options.benchmark = true;
break; break;
case 'n': case 'n':
case 'nolocalizing': case 'nosymlink':
options.nolocalizing = true; options.nosymlink = true;
break; break;
default: default:
@ -34,7 +34,7 @@ args = args.filter(function (arg) {
sys.puts("Options:"); sys.puts("Options:");
sys.puts(" -v --version Parse JSON map manifest"); sys.puts(" -v --version Parse JSON map manifest");
sys.puts(" -b --benchmark Outputs total compile time"); sys.puts(" -b --benchmark Outputs total compile time");
sys.puts(" -n --nolocalizing Don't invoke millstone to localize data files"); sys.puts(" -n --nosymlink Use absolute paths instead of symlinking files");
process.exit(0); process.exit(0);
break; break;
} }
@ -73,25 +73,18 @@ var millstone = undefined;
try { try {
require.resolve('millstone'); require.resolve('millstone');
millstone = require('millstone'); millstone = require('millstone');
} catch (err) {} } catch (err) {
sys.puts('carto: Millstone not found. ' + err.message.replace(/^[A-Z]+, /, ''));
if (options.nolocalizing || !millstone) { process.exit(1);
if (!options.nolocalizing)
console.warn('carto: Millstone not found. Externals will not be resolved.');
data.Stylesheet = data.Stylesheet.map(function(x) {
return { id: x, data: fs.readFileSync(path.join(path.dirname(input), x), 'utf8') }
});
return compile(null, data);
} else if (!millstone) {
return compile(null, data);
} else {
millstone.resolve({
mml: data,
base: path.dirname(input),
cache: path.join(path.dirname(input), 'cache')
}, compile);
} }
millstone.resolve({
mml: data,
base: path.dirname(input),
cache: path.join(path.dirname(input), 'cache'),
nosymlink: options.nosymlink
}, compile);
function compile(err, data) { function compile(err, data) {
if (err) throw err; if (err) throw err;
try { try {