From 8baf94a5403fb69694174a89ddf97d17392a62da Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Fri, 1 Nov 2013 11:50:58 -0400 Subject: [PATCH] Implemented #2 --- .gitignore | 1 + Gruntfile.js | 48 +++++++-- package.json | 25 +++-- server/Thumbs.db | Bin 0 -> 10752 bytes server/grunt-i18n-spreadsheet.csv | 9 ++ ...8n_gspreadsheet.js => i18n_spreadsheet.js} | 93 ++++++++++++++---- test/i18n_gspreadsheet_test.js | 34 ------- test/i18n_spreadsheet_test.js | 40 ++++++++ 8 files changed, 180 insertions(+), 70 deletions(-) create mode 100644 server/Thumbs.db create mode 100644 server/grunt-i18n-spreadsheet.csv rename tasks/{i18n_gspreadsheet.js => i18n_spreadsheet.js} (62%) delete mode 100644 test/i18n_gspreadsheet_test.js create mode 100644 test/i18n_spreadsheet_test.js diff --git a/.gitignore b/.gitignore index 2992095..8aadcc5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules npm-debug.log tmp +tmp_* locales diff --git a/Gruntfile.js b/Gruntfile.js index 89136ec..05d5384 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,6 @@ /* - * grunt-i18n-gspreadsheet - * https://github.com/theoephraim/grunt-i18n-gspreadsheet + * grunt-i18n-spreadsheet + * https://github.com/theoephraim/grunt-i18n-spreadsheet * * Copyright (c) 2013 Theo Ephraim * Licensed under the MIT license. @@ -25,17 +25,46 @@ module.exports = function(grunt) { // Before generating any new files, remove any previously-created files. clean: { - tests: ['tmp'], + tests: ['tmp_*'], }, + connect: { + server: { + options: { + port: 8080, + base: "server" + } + } + }, + // Configuration to be run (and then tested). - i18n_gspreadsheet: { - test_config: { + i18n_spreadsheet: { + gdocs_test_config: { + options: { + key_column: 'key', + output_dir: 'tmp_gdocs', + google_docs: { + // this document key points to the test file -- see readme for more info + document_key: '0Araic6gTol6SdEtwb1Badl92c2tlek45OUxJZDlyN2c' + } + } + }, + http_test_config: { + options: { + key_column: 'key', + output_dir: 'tmp_http', + http: { + url: 'http://localhost:8080/grunt-i18n-spreadsheet.csv' + } + } + }, + local_test_config: { options: { key_column: 'key', - output_dir: 'tmp', - // this document key points to the test file -- see readme for more info - document_key: '0Araic6gTol6SdEtwb1Badl92c2tlek45OUxJZDlyN2c' + output_dir: 'tmp_local', + local: { + src: 'server/grunt-i18n-spreadsheet.csv' + } } } }, @@ -53,11 +82,12 @@ module.exports = function(grunt) { // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-nodeunit'); // Whenever the "test" task is run, first clean the "tmp" dir, then run this // plugin's task(s), then test the result. - grunt.registerTask('test', ['clean', 'i18n_gspreadsheet', 'nodeunit']); + grunt.registerTask('test', ['clean', 'connect', 'i18n_spreadsheet', 'nodeunit']); // By default, lint and run all tests. grunt.registerTask('default', ['jshint', 'test']); diff --git a/package.json b/package.json index 50e998a..9af95d6 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,23 @@ { - "name": "grunt-i18n-gspreadsheet", + "name": "grunt-i18n-spreadsheet", "description": "Grunt plugin to generate i18n locale files from a google spreadsheet", "version": "0.1.5", - "homepage": "https://github.com/theoephraim/grunt-i18n-gspreadsheet", + "homepage": "https://github.com/theoephraim/grunt-i18n-spreadsheet", "author": { "name": "Theo Ephraim", "email": "theo@busbud.com" }, "repository": { "type": "git", - "url": "git://github.com/theoephraim/grunt-i18n-gspreadsheet.git" + "url": "git://github.com/theoephraim/grunt-i18n-spreadsheet.git" }, "bugs": { - "url": "https://github.com/theoephraim/grunt-i18n-gspreadsheet/issues" + "url": "https://github.com/theoephraim/grunt-i18n-spreadsheet/issues" }, "licenses": [ { "type": "MIT", - "url": "https://github.com/theoephraim/grunt-i18n-gspreadsheet/blob/master/LICENSE-MIT" + "url": "https://github.com/theoephraim/grunt-i18n-spreadsheet/blob/master/LICENSE-MIT" } ], "main": "Gruntfile.js", @@ -31,18 +31,27 @@ "grunt-contrib-jshint": "~0.6.0", "grunt-contrib-clean": "~0.4.0", "grunt-contrib-nodeunit": "~0.2.0", - "grunt": "~0.4.1" + "grunt": "~0.4.1", + "grunt-contrib-connect": "~0.5.0" }, "peerDependencies": { "grunt": "~0.4.1" }, "keywords": [ - "gruntplugin", "grunt", "i18n", "google", "spreadsheet", "gdocs", "locale" + "gruntplugin", + "grunt", + "i18n", + "google", + "spreadsheet", + "gdocs", + "locale" ], "dependencies": { "google-spreadsheet": "~0.2.5", "step": "0.0.5", "underscore": "~1.5.2", - "mkdirp": "~0.3.5" + "mkdirp": "~0.3.5", + "request": "~2.27.0", + "csv": "~0.3.6" } } diff --git a/server/Thumbs.db b/server/Thumbs.db new file mode 100644 index 0000000000000000000000000000000000000000..7593909f975b0a686c1e899372409de388bfadb0 GIT binary patch literal 10752 zcmeHtcT`i|w(nL%L@6KAq)3z^N|h#^s0dO7q=t_48X{5>Y80h6=|Y5j2#828p@gQ= zL5R|Oqzf1z^qSmw&wb~8plv!T)LFZ!P^R{hwd~0{}+3e1L0! z8sJI!dY7{k7zu)Bn5u|8u?lzqS9F{{LF{ zU;6((3tXX0Cn^f&{$o98B%QoGcuxEs_WvdS3oP)D{7)Vu{{a5bQrA=m&Yby=z)qe7 zQ~_$LbLY-cQBx9XYU=YebQfqS!g%QtEgci%<;zTrOiavd-0aLOoUBYtSFT^-ym}P` z0x`4m^7HcWbMt_Bem8Q4QkCXB4a0>C3_L7MEIj{hA%6mxE&ypj8r2zI;4IS_DyB2! zHh?mP&rnlF`}YA;@@J{eQAT-z_TnYV1DHQ3y9E{1S<3h+1SofdDffYMOw^aJOWZrp ztZz%h>%}7ZA~ELz-~EcutOnmV`K9chh0%&CKl`9G#q9T;05VeEr}E|A3dT!onjWqoR|NQ&Q8?-(+OI%gxJwU+|&u zV`Wt}rlz*89{Z)Wt-YhOtGj1laA}NgGU)QDYW8>i6Sn11*BYwOr;qG3Rd(W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