Update Jake Install, fs.existsSync

jake install[something/somewhere]

1) would give a warning that `path.existsSync` has been changed to
`fs.existsSync`. This has been updated.

2) would throw an error if there was no templates folder in the
extension being installed. Changed the condition on line 75 to check for
the existence of the correct item.
This commit is contained in:
Matthew Kastor 2012-10-19 21:39:26 -04:00
parent 818e26c5bc
commit f6c281a810

View File

@ -4,7 +4,8 @@
desc('Updating package.json revision.');
task('default', [], function(params) {
/*jshint evil: true */
var fs = require('fs'), sys = require('sys');
var fs = require('fs'),
sys = require('sys');
// import the Mustache template tool
eval(fs.readFileSync('Jake/lib/mustache.js', 'utf8'));
@ -31,20 +32,27 @@ task('default', [], function(params) {
desc('Installs a plugin/template.');
task('install', [], function(loc) {
var fs = require('fs'), util = require('util'), path = require('path'), wrench = require('wrench');
var fs = require('fs'),
util = require('util'),
path = require('path'),
wrench = require('wrench');
if(!loc) {
fail("You must specify the location of the plugin/template.");
}
if(!path.existsSync(loc)) {
if(!fs.existsSync(loc)) {
fail("plugin/template location [" + loc + "] is not valid.");
}
var pluginLoc = path.join(loc, "plugins"), templateLoc = path.join(loc, "templates"), jsdocLoc = process.cwd(), name, config;
var pluginLoc = path.join(loc, "plugins"),
templateLoc = path.join(loc, "templates"),
jsdocLoc = process.cwd(),
name,
config;
//First the plugin
if(path.existsSync(pluginLoc)) {
if(fs.existsSync(pluginLoc)) {
//copy it over
wrench.copyDirSyncRecursive(pluginLoc, path.join(jsdocLoc, "plugins"), {
preserve : true
@ -64,7 +72,7 @@ task('install', [], function(loc) {
}
//Then the template
if(path.existsSync(pluginLoc)) {
if(fs.existsSync(templateLoc)) {
wrench.copyDirSyncRecursive(templateLoc, path.join(jsdocLoc, "templates"), {
preserve : true
});