Cleanup build files and add build/util.js.

Former-commit-id: 67e5564a17ec4a438e3d0768e8963a1384d4ce98
This commit is contained in:
John-David Dalton
2013-04-09 12:58:17 -07:00
parent 76aae8ce42
commit a8b6fa413e
5 changed files with 125 additions and 80 deletions

View File

@@ -3,24 +3,20 @@
'use strict';
/** Load Node.js modules */
var fs = require('fs'),
https = require('https'),
path = require('path'),
var https = require('https'),
spawn = require('child_process').spawn,
zlib = require('zlib');
/** Load other modules */
var _ = require('../lodash.js'),
mkdirpSync = require('./mkdirp-sync.js'),
preprocess = require('./pre-compile.js'),
postprocess = require('./post-compile.js'),
tar = require('../vendor/tar/tar.js');
tar = require('../vendor/tar/tar.js'),
util = require('./util.js');
/** Add `fs.existsSync` for older versions of Node.js */
fs.existsSync || (fs.existsSync = path.existsSync);
/** Add `path.sep` for older versions of Node.js */
path.sep || (path.sep = process.platform == 'win32' ? '\\' : '/');
/** Module shortcuts */
var fs = util.fs,
path = util.path;
/** The Git object ID of `closure-compiler.tar.gz` */
var closureId = 'a95a8007892aa824ce90c6aa3d3abb0489bf0fff';
@@ -47,7 +43,7 @@
var mediaType = 'application/vnd.github.v3.raw';
/** Used to detect the Node.js executable in command-line arguments */
var reNode = RegExp('(?:^|' + path.sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')node(?:\\.exe)?$');
var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$');
/** Used to reference parts of the blob href */
var location = (function() {
@@ -146,7 +142,7 @@
if (/-o|--output/.test(value)) {
result = options[index + 1];
var dirname = path.dirname(result);
mkdirpSync(dirname);
fs.mkdirpSync(dirname);
result = path.join(fs.realpathSync(dirname), path.basename(result));
}
return result;