You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1014 B
45 lines
1014 B
// Generated by CoffeeScript 1.6.3
|
|
var DocPad, action, docpadConfig, getArgument;
|
|
|
|
DocPad = require('../lib/docpad');
|
|
|
|
getArgument = function(name, value, defaultValue) {
|
|
var argumentIndex, result;
|
|
if (value == null) {
|
|
value = null;
|
|
}
|
|
if (defaultValue == null) {
|
|
defaultValue = null;
|
|
}
|
|
result = defaultValue;
|
|
argumentIndex = process.argv.indexOf("--" + name);
|
|
if (argumentIndex !== -1) {
|
|
result = value != null ? value : process.argv[argumentIndex + 1];
|
|
}
|
|
return result;
|
|
};
|
|
|
|
action = getArgument('action', null, 'server generate');
|
|
|
|
docpadConfig = {};
|
|
|
|
docpadConfig.port = (function() {
|
|
var port;
|
|
port = getArgument('port');
|
|
if (port && isNaN(port) === false) {
|
|
port = parseInt(port, 10);
|
|
}
|
|
return port;
|
|
})();
|
|
|
|
DocPad.createInstance(docpadConfig, function(err, docpad) {
|
|
if (err) {
|
|
return console.log(err.stack);
|
|
}
|
|
return docpad.action(action, function(err) {
|
|
if (err) {
|
|
return console.log(err.stack);
|
|
}
|
|
return console.log('OK');
|
|
});
|
|
});
|