Skip to content

Commit

Permalink
add support for videojs-grunt-languages
Browse files Browse the repository at this point in the history
updates to change build/lang to build/files/lang

update grunt languages references and version

remove build/lang reference

update languages plugin reference for array support
  • Loading branch information
tomjohnson916 authored and heff committed Sep 2, 2014
1 parent 1aabc44 commit 011861b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
44 changes: 19 additions & 25 deletions Gruntfile.js
Expand Up @@ -31,8 +31,12 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: pkg,
lang: {
src: 'lang/*.json'
vjslanguages: {
defaults: {
files: {
'build/files/lang': ['lang/*.json']
}
}
},
build: {
src: 'src/js/dependencies.js',
Expand Down Expand Up @@ -312,6 +316,7 @@ module.exports = function(grunt) {
}
});

grunt.loadNpmTasks('grunt-videojs-languages');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
Expand All @@ -333,11 +338,11 @@ module.exports = function(grunt) {
// grunt.loadTasks('./docs/tasks/');
// grunt.loadTasks('../videojs-doc-generator/tasks/');

grunt.registerTask('pretask', ['jshint', 'less', 'lang', 'build', 'minify', 'usebanner']);
grunt.registerTask('pretask', ['jshint', 'less', 'vjslanguages', 'build', 'minify', 'usebanner']);
// Default task.
grunt.registerTask('default', ['pretask', 'dist']);
// Development watch task
grunt.registerTask('dev', ['jshint', 'less', 'lang', 'build', 'qunit:source']);
grunt.registerTask('dev', ['jshint', 'less', 'vjslanguages', 'build', 'qunit:source']);
grunt.registerTask('test-qunit', ['pretask', 'qunit']);

// The test task will run `karma:saucelabs` when running in travis,
Expand Down Expand Up @@ -424,24 +429,7 @@ module.exports = function(grunt) {
}
});

var fs = require('fs'),
gzip = require('zlib').gzip;

grunt.registerMultiTask('lang', 'Building Language Support', function() {
var combined = '';

grunt.log.writeln('Building Language Support');

// Create a combined languages file
this.files.forEach(function(file) {
file.src.forEach(function(src){
var code = src.replace('lang/', '').replace('.json', '');
combined += 'videojs.options[\'languages\'][\''+code+'\'] = '+ grunt.file.read(src).trim() + ';\n';
});
});

grunt.file.write('build/files/combined.languages.js', combined);
});
var fs = require('fs');

grunt.registerMultiTask('build', 'Building Source', function(){

Expand All @@ -459,9 +447,6 @@ module.exports = function(grunt) {
// Replace CDN version ref in js. Use major/minor version.
combined = combined.replace(/GENERATED_CDN_VSN/g, version.majorMinor);

// Add Combined Langauges
// combined += grunt.file.read('build/files/combined.languages.js');

grunt.file.write('build/files/combined.video.js', combined);

// Copy over other files
Expand Down Expand Up @@ -561,6 +546,15 @@ module.exports = function(grunt) {
}
});

// Copy over language files
grunt.file.recurse('build/files/lang', function(absdir, rootdir, subdir, filename) {
// Block .DS_Store files
if ('filename'.substring(0,1) !== '.') {
grunt.file.copy(absdir, 'dist/cdn/lang/' + filename);
grunt.file.copy(absdir, 'dist/video-js/lang/' + filename);
}
});

// ds_store files sometime find their way in
if (grunt.file.exists('dist/video-js/.DS_Store')) {
grunt.file['delete']('dist/video-js/.DS_Store');
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -60,6 +60,7 @@
"semver": "~1.1.4",
"sinon": "~1.9.1",
"uglify-js": "~2.3.6",
"videojs-doc-generator": "0.0.1"
"videojs-doc-generator": "0.0.1",
"grunt-videojs-languages": "0.0.4"
}
}

0 comments on commit 011861b

Please sign in to comment.