Add modified gruntfile.js and tasks
This commit is contained in:
44
tasks/load-asv.js
Normal file
44
tasks/load-asv.js
Normal file
@@ -0,0 +1,44 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('load-asv', "Loads the ASV verses", function() {
|
||||
var done = this.async();
|
||||
var path = '../dbs/t_asv.json';
|
||||
var json = grunt.file.readJSON(path).resultset.row;
|
||||
var MongoClient = require('mongodb').MongoClient;
|
||||
|
||||
MongoClient.connect('mongodb://localhost/BibleDev', function(err, db) {
|
||||
if(err) throw err;
|
||||
|
||||
var versesColl = db.collection('verse');
|
||||
grunt.log.writeln('Got collection: ' + versesColl);
|
||||
grunt.log.writeln('Going to process ' + json.length + ' verses.');
|
||||
|
||||
for(var i = 0; i < json.length; i++) {
|
||||
var verse = {};
|
||||
for(var k = 0; k < json[i].field.length; k++) {
|
||||
var value = json[i].field[k]['_'];
|
||||
var key = json[i].field[k]['$']['name'];
|
||||
|
||||
if(key == 'c') key = 'chapter';
|
||||
else if (key == 'v') key = 'verse';
|
||||
else if (key == 'b') key = 'book';
|
||||
else if (key == 't') key = 'text';
|
||||
else if (key == 'id') key = 'reference';
|
||||
|
||||
verse[key] = value;
|
||||
verse['number'] = i;
|
||||
}
|
||||
|
||||
versesColl.insert(verse, function(err, results) {
|
||||
if(err) throw err;
|
||||
});
|
||||
}
|
||||
|
||||
versesColl.count(function(err, count) {
|
||||
if(err) throw err;
|
||||
grunt.log.writeln('Wrote ' + count + ' verse(s).');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
7
tasks/options/clean.js
Normal file
7
tasks/options/clean.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// clean
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dev: ['.tmp/public/**'],
|
||||
build: ['www']
|
||||
};
|
||||
};
|
||||
23
tasks/options/coffee.js
Normal file
23
tasks/options/coffee.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// coffee
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dev: {
|
||||
options: {
|
||||
bare: true
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'assets/js/',
|
||||
src: ['**/*.coffee'],
|
||||
dest: '.tmp/public/js/',
|
||||
ext: '.js'
|
||||
}, {
|
||||
expand: true,
|
||||
cwd: 'assets/linker/js/',
|
||||
src: ['**/*.coffee'],
|
||||
dest: '.tmp/public/linker/js/',
|
||||
ext: '.js'
|
||||
}]
|
||||
}
|
||||
};
|
||||
};
|
||||
13
tasks/options/concat.js
Normal file
13
tasks/options/concat.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// concat
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
js: {
|
||||
src: config.jsFilesToInject,
|
||||
dest: '.tmp/public/concat/production.js'
|
||||
},
|
||||
css: {
|
||||
src: config.cssFilesToInject,
|
||||
dest: '.tmp/public/concat/production.css'
|
||||
}
|
||||
};
|
||||
};
|
||||
21
tasks/options/copy.js
Normal file
21
tasks/options/copy.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// copy
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dev: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: './assets',
|
||||
src: ['**/*.!(coffee|jade)'],
|
||||
dest: '.tmp/public'
|
||||
}]
|
||||
},
|
||||
build: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: '.tmp/public',
|
||||
src: ['**/*'],
|
||||
dest: 'www'
|
||||
}]
|
||||
}
|
||||
};
|
||||
};
|
||||
9
tasks/options/cssmin.js
Normal file
9
tasks/options/cssmin.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// cssmin
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dist: {
|
||||
src: ['.tmp/public/concat/production.css'],
|
||||
dest: '.tmp/public/min/production.css'
|
||||
}
|
||||
};
|
||||
};
|
||||
14
tasks/options/jade.js
Normal file
14
tasks/options/jade.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// jade
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
templates: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: './assets/linker/templates/',
|
||||
src: ['*.jade'],
|
||||
dest: './assets/linker/templates/',
|
||||
ext: '.html'
|
||||
}]
|
||||
}
|
||||
};
|
||||
};
|
||||
17
tasks/options/jst.js
Normal file
17
tasks/options/jst.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// jst
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dev: {
|
||||
options: {
|
||||
namespace: 'App.Templates',
|
||||
templateSettings: {
|
||||
interpolate: /\{\{(.+?)\}\}/g
|
||||
}
|
||||
},
|
||||
|
||||
files: {
|
||||
'.tmp/public/templates.js': config.templateFilesToInject
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
20
tasks/options/less.js
Normal file
20
tasks/options/less.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// less
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dev: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'assets/styles/',
|
||||
src: ['*.less'],
|
||||
dest: '.tmp/public/styles/',
|
||||
ext: '.css'
|
||||
}, {
|
||||
expand: true,
|
||||
cwd: 'assets/linker/styles/',
|
||||
src: ['*.less'],
|
||||
dest: '.tmp/public/linker/styles/',
|
||||
ext: '.css'
|
||||
}]
|
||||
}
|
||||
};
|
||||
};
|
||||
141
tasks/options/sails-linker.js
Normal file
141
tasks/options/sails-linker.js
Normal file
@@ -0,0 +1,141 @@
|
||||
// sails-linker
|
||||
module.exports = function(config) { return {
|
||||
devJs: {
|
||||
options: {
|
||||
startTag: '<!--SCRIPTS-->',
|
||||
endTag: '<!--SCRIPTS END-->',
|
||||
fileTmpl: '<script src="%s"></script>',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'.tmp/public/**/*.html': config.jsFilesToInject,
|
||||
'views/**/*.html': config.jsFilesToInject,
|
||||
'views/**/*.ejs': config.jsFilesToInject
|
||||
}
|
||||
},
|
||||
|
||||
prodJs: {
|
||||
options: {
|
||||
startTag: '<!--SCRIPTS-->',
|
||||
endTag: '<!--SCRIPTS END-->',
|
||||
fileTmpl: '<script src="%s"></script>',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'.tmp/public/**/*.html': ['.tmp/public/min/production.js'],
|
||||
'views/**/*.html': ['.tmp/public/min/production.js'],
|
||||
'views/**/*.ejs': ['.tmp/public/min/production.js']
|
||||
}
|
||||
},
|
||||
|
||||
devStyles: {
|
||||
options: {
|
||||
startTag: '<!--STYLES-->',
|
||||
endTag: '<!--STYLES END-->',
|
||||
fileTmpl: '<link rel="stylesheet" href="%s">',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
|
||||
// config.cssFilesToInject defined up top
|
||||
files: {
|
||||
'.tmp/public/**/*.html': config.cssFilesToInject,
|
||||
'views/**/*.html': config.cssFilesToInject,
|
||||
'views/**/*.ejs': config.cssFilesToInject
|
||||
}
|
||||
},
|
||||
|
||||
prodStyles: {
|
||||
options: {
|
||||
startTag: '<!--STYLES-->',
|
||||
endTag: '<!--STYLES END-->',
|
||||
fileTmpl: '<link rel="stylesheet" href="%s">',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'.tmp/public/index.html': ['.tmp/public/min/production.css'],
|
||||
'views/**/*.html': ['.tmp/public/min/production.css'],
|
||||
'views/**/*.ejs': ['.tmp/public/min/production.css']
|
||||
}
|
||||
},
|
||||
|
||||
// Bring in JST template object
|
||||
devTpl: {
|
||||
options: {
|
||||
startTag: '<!--TEMPLATES-->',
|
||||
endTag: '<!--TEMPLATES END-->',
|
||||
fileTmpl: '<script type="text/javascript" src="%s"></script>',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'.tmp/public/index.html': ['.tmp/public/templates.js'],
|
||||
'views/**/*.html': ['.tmp/public/templates.js'],
|
||||
'views/**/*.ejs': ['.tmp/public/templates.js']
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*******************************************
|
||||
* Jade linkers (TODO: clean this up)
|
||||
*******************************************/
|
||||
|
||||
devJsJADE: {
|
||||
options: {
|
||||
startTag: '// SCRIPTS',
|
||||
endTag: '// SCRIPTS END',
|
||||
fileTmpl: 'script(type="text/javascript", src="%s")',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'views/**/*.jade': config.jsFilesToInject
|
||||
}
|
||||
},
|
||||
|
||||
prodJsJADE: {
|
||||
options: {
|
||||
startTag: '// SCRIPTS',
|
||||
endTag: '// SCRIPTS END',
|
||||
fileTmpl: 'script(type="text/javascript", src="%s")',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'views/**/*.jade': ['.tmp/public/min/production.js']
|
||||
}
|
||||
},
|
||||
|
||||
devStylesJADE: {
|
||||
options: {
|
||||
startTag: '// STYLES',
|
||||
endTag: '// STYLES END',
|
||||
fileTmpl: 'link(rel="stylesheet", href="%s")',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'views/**/*.jade': config.cssFilesToInject
|
||||
}
|
||||
},
|
||||
|
||||
prodStylesJADE: {
|
||||
options: {
|
||||
startTag: '// STYLES',
|
||||
endTag: '// STYLES END',
|
||||
fileTmpl: 'link(rel="stylesheet", href="%s")',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'views/**/*.jade': ['.tmp/public/min/production.css']
|
||||
}
|
||||
},
|
||||
|
||||
// Bring in JST template object
|
||||
devTplJADE: {
|
||||
options: {
|
||||
startTag: '// TEMPLATES',
|
||||
endTag: '// TEMPLATES END',
|
||||
fileTmpl: 'script(type="text/javascript", src="%s")',
|
||||
appRoot: '.tmp/public'
|
||||
},
|
||||
files: {
|
||||
'views/**/*.jade': ['.tmp/public/templates.js']
|
||||
}
|
||||
}
|
||||
};};
|
||||
9
tasks/options/uglify.js
Normal file
9
tasks/options/uglify.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// uglify
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dist: {
|
||||
src: ['.tmp/public/concat/production.js'],
|
||||
dest: '.tmp/public/min/production.js'
|
||||
}
|
||||
};
|
||||
};
|
||||
17
tasks/options/watch.js
Normal file
17
tasks/options/watch.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// watch
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
api: {
|
||||
// API files to watch:
|
||||
files: ['api/**/*']
|
||||
},
|
||||
assets: {
|
||||
|
||||
// Assets to watch:
|
||||
files: ['assets/**/*'],
|
||||
|
||||
// When assets are changed:
|
||||
tasks: ['compileAssets', 'linkAssets']
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user