98e725cf by Adam Heath

Allow for the 'src' directory to be changed to a different location.

1 parent 26c3aea6
......@@ -135,6 +135,9 @@ module.exports = function (grunt) {
});
function createConfig(mpConfig) {
mpConfig = _.extend({
base: 'src',
}, mpConfig);
var featureFlags = {};
var holyGrailTmp = '.grunt/holygrail';
......@@ -157,7 +160,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
dot: true,
cwd: 'src',
cwd: mpConfig.base,
dest: 'dist/build',
src: [
'WEB-INF/{,*/}*.*',
......@@ -226,7 +229,7 @@ module.exports = function (grunt) {
}),
files: {
src: [
'src/scripts/*.js',
mpConfig.base + '/scripts/*.js',
],
},
},
......@@ -239,7 +242,7 @@ module.exports = function (grunt) {
}),
files: {
src: [
'src/scripts/model/**/*.js',
mpConfig.base + '/scripts/model/**/*.js',
],
},
},
......@@ -252,15 +255,15 @@ module.exports = function (grunt) {
}),
files: {
src: [
'src/scripts/view/**/*.js',
mpConfig.base + '/scripts/view/**/*.js',
],
},
},
};
jshintAddExtra(mpConfig.jshint.all, initConfig.jshint, 'all');
jshintAddExtra(mpConfig.jshint.main, initConfig.jshint.main.files, 'src');
jshintAddExtra(mpConfig.jshint.model, initConfig.jshint.model.files, 'src');
jshintAddExtra(mpConfig.jshint.view, initConfig.jshint.view.files, 'src');
jshintAddExtra(mpConfig.jshint.main, initConfig.jshint.main.files, mpConfig.base);
jshintAddExtra(mpConfig.jshint.model, initConfig.jshint.model.files, mpConfig.base);
jshintAddExtra(mpConfig.jshint.view, initConfig.jshint.view.files, mpConfig.base);
checkList.push('jshint');
}
......@@ -305,8 +308,8 @@ module.exports = function (grunt) {
initConfig.punch = {
options: {
'template_dir': 'src/punch/templates',
'content_dir': 'src/punch/contents',
'template_dir': mpConfig.base + '/punch/templates',
'content_dir': mpConfig.base + '/punch/contents',
plugins: {
parsers: {
'.html': 'punch-html-fragment-content-parser',
......@@ -329,7 +332,7 @@ module.exports = function (grunt) {
]
});
} else {
htmlSourceDir = 'src';
htmlSourceDir = mpConfig.base;
}
if (mpConfig.uglify) {
......@@ -381,7 +384,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
dot: true,
cwd: 'src',
cwd: mpConfig.base,
dest: '.grunt/usemin-css/',
src: _.map(mpConfig.css.options.dirs, function (value) {
return value + '/{,**/}*.css';
......@@ -409,7 +412,7 @@ module.exports = function (grunt) {
files: _.map(mpConfig.images.options.dirs, function (value) {
return {
expand: true,
cwd: 'src/' + value,
cwd: mpConfig.base + '/' + value,
src: '{,**/}*.{gif,jpeg,jpg,png}',
dest: 'dist/build/' + value,
};
......@@ -421,7 +424,7 @@ module.exports = function (grunt) {
files: _.map(mpConfig.images.options.dirs, function (value) {
return {
expand: true,
cwd: 'src/' + value,
cwd: mpConfig.base + '/' + value,
src: '{,**/}*.svg',
dest: 'dist/build/' + value,
};
......@@ -432,7 +435,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
dot: true,
cwd: 'src',
cwd: mpConfig.base,
dest: 'dist/build',
src: _.map(mpConfig.images.options.dirs, function (value) {
return value + '/{,**/}*.*';
......@@ -456,7 +459,7 @@ module.exports = function (grunt) {
});
initConfig.bower = {
options: {
directory: 'src/' + mpConfig.bower.directory,
directory: mpConfig.base + '/' + mpConfig.bower.directory,
},
install: {},
update: {},
......@@ -496,9 +499,9 @@ module.exports = function (grunt) {
files: [{
dest: 'dist/build/' + mpConfig.bower.directory + '/requirejs/require.js',
src: [
'src/scripts/config.js',
mpConfig.base + '/scripts/config.js',
'.grunt/holygrail/scripts/requirejs-config.js',
'src/' + mpConfig.bower.directory + '/requirejs/require.js',
mpConfig.base + '/' + mpConfig.bower.directory + '/requirejs/require.js',
],
}],
};
......@@ -513,9 +516,9 @@ module.exports = function (grunt) {
grunt.config('requireModules.' + target + '.' + grunt.config.escape(data.name), data.included);
},
baseUrl: 'src/scripts',
baseUrl: mpConfig.base + '/scripts',
mainConfigFile: [
'src/scripts/config.js',
mpConfig.base + '/scripts/config.js',
],
wrapShim: true,
......