Moved functions to outer scope
This commit is contained in:
parent
6035cf89b7
commit
0ca03cae60
1 changed files with 34 additions and 34 deletions
26
gruntfile.js
26
gruntfile.js
|
@ -2,20 +2,18 @@ var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var ini = require('ini');
|
var ini = require('ini');
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
var phpCheckStyleConfigPath = path.join(path.resolve(), 'phpcheckstyle.cfg');
|
||||||
|
var phpSourcesDir = path.join(path.resolve(), 'src');
|
||||||
|
var jsSourcesDir = path.join(path.resolve(), 'public_html/js');
|
||||||
|
var cssSourcesDir = path.join(path.resolve(), 'public_html/css');
|
||||||
|
var templatesDir = path.join(path.resolve(), 'public_html/templates');
|
||||||
|
|
||||||
var phpCheckStyleConfigPath = path.join(path.resolve(), 'phpcheckstyle.cfg');
|
var config = readConfig([
|
||||||
var phpSourcesDir = path.join(path.resolve(), 'src');
|
|
||||||
var jsSourcesDir = path.join(path.resolve(), 'public_html/js');
|
|
||||||
var cssSourcesDir = path.join(path.resolve(), 'public_html/css');
|
|
||||||
var templatesDir = path.join(path.resolve(), 'public_html/templates');
|
|
||||||
|
|
||||||
var config = readConfig([
|
|
||||||
path.join(path.resolve(), 'data/config.ini'),
|
path.join(path.resolve(), 'data/config.ini'),
|
||||||
path.join(path.resolve(), 'data/local.ini')
|
path.join(path.resolve(), 'data/local.ini')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function readConfig(configPaths) {
|
function readConfig(configPaths) {
|
||||||
var iniContent = '';
|
var iniContent = '';
|
||||||
for (var i = 0; i < configPaths.length; i ++) {
|
for (var i = 0; i < configPaths.length; i ++) {
|
||||||
var configPath = configPaths[i];
|
var configPath = configPaths[i];
|
||||||
|
@ -25,9 +23,9 @@ module.exports = function(grunt) {
|
||||||
}
|
}
|
||||||
var config = ini.parse(iniContent);
|
var config = ini.parse(iniContent);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
function readTemplates() {
|
function readTemplates(grunt) {
|
||||||
var templatePaths = grunt.file.expand(templatesDir + '/**/*.tpl');
|
var templatePaths = grunt.file.expand(templatesDir + '/**/*.tpl');
|
||||||
var templates = {};
|
var templates = {};
|
||||||
for (var i = 0; i < templatePaths.length; i ++) {
|
for (var i = 0; i < templatePaths.length; i ++) {
|
||||||
|
@ -35,7 +33,9 @@ module.exports = function(grunt) {
|
||||||
templates[path.basename(templatePath)] = fs.readFileSync(templatePath);
|
templates[path.basename(templatePath)] = fs.readFileSync(templatePath);
|
||||||
}
|
}
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
@ -113,7 +113,7 @@ module.exports = function(grunt) {
|
||||||
options: {
|
options: {
|
||||||
data: {
|
data: {
|
||||||
serviceName: config.basic.serviceName,
|
serviceName: config.basic.serviceName,
|
||||||
templates: readTemplates(),
|
templates: readTemplates(grunt),
|
||||||
timestamp: grunt.template.today('isoDateTime'),
|
timestamp: grunt.template.today('isoDateTime'),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue