Permalink
Browse files

Merge pull request #143 from danzel/master

Add -n/--nolocalizing option to skip calling millstone when you don't want to
  • Loading branch information...
tmcw committed Jun 21, 2012
2 parents 42784dc + c2919a9 commit f00c048b199698a1248271cb44bc2db5e9c3065a
Showing with 16 additions and 12 deletions.
  1. +16 −12 bin/carto
View
@@ -6,7 +6,7 @@ var path = require('path'),
carto = require('carto');
var args = process.argv.slice(1);
-var options = {};
+var options = { nosymlink:false };
args = args.filter(function (arg) {
var match;
@@ -24,12 +24,17 @@ args = args.filter(function (arg) {
case 'benchmark':
options.benchmark = true;
break;
+ case 'n':
+ case 'nosymlink':
+ options.nosymlink = true;
+ break;
default:
sys.puts("Usage: carto <source MML file>");
sys.puts("Options:");
sys.puts(" -v --version Parse JSON map manifest");
sys.puts(" -b --benchmark Outputs total compile time");
+ sys.puts(" -n --nosymlink Use absolute paths instead of symlinking files");
process.exit(0);
break;
}
@@ -68,19 +73,18 @@ var millstone = undefined;
try {
require.resolve('millstone');
millstone = require('millstone');
-} catch (err) {}
-
-if (!millstone) {
- console.warn('carto: Millstone not found. Externals will not be resolved.');
- return compile(null, data);
-} else {
- millstone.resolve({
- mml: data,
- base: path.dirname(input),
- cache: path.join(path.dirname(input), 'cache')
- }, compile);
+} catch (err) {
+ sys.puts('carto: Millstone not found. ' + err.message.replace(/^[A-Z]+, /, ''));
+ process.exit(1);
}
+millstone.resolve({
+ mml: data,
+ base: path.dirname(input),
+ cache: path.join(path.dirname(input), 'cache'),
+ nosymlink: options.nosymlink
+}, compile);
+
function compile(err, data) {
if (err) throw err;
try {

0 comments on commit f00c048

Please sign in to comment.