Skip to content

Commit

Permalink
Merge pull request #1126 from adaptlearning/issue/#1053
Browse files Browse the repository at this point in the history
Add grunt languages option
  • Loading branch information
lc-thomasberger authored Jul 13, 2016
2 parents 7f9a305 + e58aee0 commit 9a659bc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions grunt/config/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function (grunt, options) {
files: [
{
expand: true,
src: ['**/*', '!**/*.json'],
src: ['<%=languages%>/**/*', '!**/*.json'],
cwd: '<%= sourcedir %>course/',
dest: '<%= outputdir %>course/'
}
Expand All @@ -25,7 +25,7 @@ module.exports = function (grunt, options) {
files: [
{
expand: true,
src: ['**/*.json'],
src: ['<%=languages%>/*.json'],
cwd: '<%= sourcedir %>course/',
dest: '<%= outputdir %>course/'
}
Expand Down
2 changes: 1 addition & 1 deletion grunt/config/jsonlint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
src: [ '<%= sourcedir %>course/**/*.json' ]
src: [ '<%= sourcedir %>course/<%=languages%>/*.json' ]
}
2 changes: 1 addition & 1 deletion grunt/config/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
tasks : ['jsonlint', 'check-json', 'copy:courseJson', 'schema-defaults']
},
courseAssets: {
files: ['<%= sourcedir %>course/**/*', '!<%= sourcedir %>course/**/*.json'],
files: ['<%= sourcedir %>course/<%=languages%>/*', '!<%= sourcedir %>course/<%=languages%>/*.json'],
tasks : ['copy:courseAssets']
},
js: {
Expand Down
11 changes: 11 additions & 0 deletions grunt/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = function(grunt) {
grunt.log.ok('Building to "' + grunt.config('outputdir') + '"');
if (grunt.config('theme') !== '**') grunt.log.ok('Using theme "' + grunt.config('theme') + '"');
if (grunt.config('menu') !== '**') grunt.log.ok('Using menu "' + grunt.config('menu') + '"');
if (grunt.config('languages') !== '**') grunt.log.ok('The following languages will be included in the build "' + grunt.config('languages') + '"');
});

// privates
Expand Down Expand Up @@ -77,6 +78,7 @@ module.exports = function(grunt) {
outputdir: process.cwd() + path.sep + 'build' + path.sep,
theme: '**',
menu: '**',
languages: '**',
includes: [

],
Expand Down Expand Up @@ -113,12 +115,21 @@ module.exports = function(grunt) {
};

exports.generateConfigData = function() {

var languageFolders = "";
if (grunt.option('languages') && grunt.option('languages').split(',').length > 1) {
languageFolders = "{" + grunt.option('languages') + "}";
} else {
languageFolders = grunt.option('languages');
}

var data = {
root: __dirname.split(path.sep).slice(0,-1).join(path.sep),
sourcedir: appendSlash(grunt.option('sourcedir')) || exports.defaults.sourcedir,
outputdir: appendSlash(grunt.option('outputdir')) || exports.defaults.outputdir,
theme: grunt.option('theme') || exports.defaults.theme,
menu: grunt.option('menu') || exports.defaults.menu,
languages: languageFolders || exports.defaults.languages
};

// Selectively load the course.json ('outputdir' passed by server-build)
Expand Down

0 comments on commit 9a659bc

Please sign in to comment.