Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed redundand functions from runit exporter

  • Loading branch information...
commit d111536417bea20104326b7d8c5b7710d4cba96e 1 parent 5bd47ca
Wong Liang Zan authored
Showing with 9 additions and 36 deletions.
  1. +9 −36 lib/export/runit.js
45 lib/export/runit.js
View
@@ -36,7 +36,7 @@ runit.writeTemplates = function(processes, cmdOptions, callback) {
var concurrentCountArray = _.range(concurrentCount);
var buildTemplate = function(index, buildTemplateCallback) {
- var processDir, processEnvDir, processLogDir, processRunPath, viewOpt;
+ var processDir, processEnvDir, processLogDir, processRunPath;
processDir = location + '/' + cmdOptions.app + '-' + procName + '-' + index;
processRunPath = processDir + '/run';
processEnvDir = processDir + '/env';
@@ -138,7 +138,7 @@ function buildLogRunTemplate(opts, callback) {
user: opts.cmdOptions.user
};
- renderLogRunTemplate(templateFilePath('log_run', opts.templateOpt), viewOpt, function(err, renderedOutput) {
+ renderTemplate(templateFilePath('log_run', opts.templateOpt), viewOpt, function(err, renderedOutput) {
if (err) {
return callback(err.message);
} else {
@@ -203,7 +203,7 @@ function buildRunTemplate(opts, callback) {
processEnvDir: opts.processEnvDir
};
- renderRunTemplate(templateFilePath('run', opts.templateOpt), viewOpt, function(err, renderedOutput) {
+ renderTemplate(templateFilePath('run', opts.templateOpt), viewOpt, function(err, renderedOutput) {
if (err) {
return callback(err.message);
} else {
@@ -251,31 +251,14 @@ function makeDirectories(dirs, callback) {
}
/*
- * renders the run template
+ * renders the template
*
- * @param {string} path to run template
+ * @param {string} path to template
* @param {obj} object of options
* @callback {err} err, {string} rendered template
*/
-function renderRunTemplate(runTemplatePath, viewOpts, callback) {
- runTemplateContent(runTemplatePath, function(err, content) {
- if (err) {
- return callback(err, null);
- } else {
- return callback(null, Mustache.to_html(content, viewOpts));
- }
- });
-}
-
-/*
- * renders the log run template
- *
- * @param {string} path to log run template
- * @param {obj} object of options
- * @callback {err} err, {string} rendered template
- */
-function renderLogRunTemplate(logRunTemplatePath, viewOpts, callback) {
- logRunTemplateContent(logRunTemplatePath, function(err, content) {
+function renderTemplate(templatePath, viewOpts, callback) {
+ templateContent(templatePath, function(err, content) {
if (err) {
return callback(err, null);
} else {
@@ -291,16 +274,6 @@ function renderLogRunTemplate(logRunTemplatePath, viewOpts, callback) {
* @param {string} path to run template
* @callback {err} err, (string) mustache template
*/
-function runTemplateContent(runTemplatePath, callback) {
- fs.readFile(runTemplatePath, 'utf8', callback);
-}
-
-/*
- * reads the mustache template from file
- *
- * @param {string} path to log run template
- * @callback {err} err, (string) mustache template
- */
-function logRunTemplateContent(logRunTemplatePath, callback) {
- fs.readFile(logRunTemplatePath, 'utf8', callback);
+function templateContent(templatePath, callback) {
+ fs.readFile(templatePath, 'utf8', callback);
}
Please sign in to comment.
Something went wrong with that request. Please try again.