Skip to content

Commit 1d5b619

Browse files
author
it-schaedler
committed
new functionality with plovr
1 parent c748c09 commit 1d5b619

File tree

4 files changed

+44
-28
lines changed

4 files changed

+44
-28
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ grunt.initConfig({
9797
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
9898

9999
## Release History
100+
2.0.0 Plovr v4.1.1 add sourcemap path and naming other functionality for create_source_map
100101
1.0.1 Plovr v4.1.1

bin/plovr.jar

100644100755
-1.18 MB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "grunt-plovr-ext",
33
"description": "Grunt plugin wrapper for google closure tool plovr - includes all Features without the need of an external config File for Plovr",
4-
"version": "1.0.2",
4+
"version": "2.0.0",
55
"homepage": "https://github.com/software-engineering/grunt-plovr-ext",
66
"author": {
77
"name": "it-schaedler",

tasks/plovr_extended.js

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88

99
'use strict';
1010

11-
module.exports = function (grunt) {
11+
module.exports = function(grunt) {
1212

1313
var shell = require('shelljs'),
1414
path = require('path');
1515

16-
grunt.registerMultiTask('plovr_extended', 'Grunt plugin wrapper for google closure tool plovr - includes all Features without the need of an external config File for Plovr', function () {
16+
grunt.registerMultiTask('plovr_extended', 'Grunt plugin wrapper for google closure tool plovr - includes all Features without the need of an external config File for Plovr', function() {
1717

1818
// config filename - check if file already exists - if yes: delete them first
1919
var configfilename = 'plovr.config.js';
2020

21-
if (grunt.file.exists(configfilename)) {
21+
if (grunt.file.exists(configfilename))
22+
{
2223
grunt.file.delete(configfilename);
2324
}
2425

@@ -54,10 +55,14 @@ module.exports = function (grunt) {
5455
case "property-map-output-file":
5556
case "module-source-map-name":
5657
case "test-template":
57-
if ((typeof options[key] == "string") && (options[key] !== null)) {
58+
case "source-map-base-url":
59+
if( (typeof options[key] == "string") && (options[key] !== null) )
60+
{
5861
configFileContent += seperator + '"' + switchkey + '": "' + options[key] + '"';
59-
} else {
60-
grunt.fail.warn('Option "' + switchkey + '" is not type of string!');
62+
}
63+
else
64+
{
65+
grunt.fail.warn('Option "' + switchkey + '" is not type of string!' );
6166
}
6267
break;
6368
// boolean Input Values
@@ -72,22 +77,26 @@ module.exports = function (grunt) {
7277
case "ambiguate-properties":
7378
case "disambiguate-properties":
7479
case "add-sourcemap-url":
75-
if ((typeof options[key] == "boolean") && (options[key] !== null)) {
80+
if( (typeof options[key] == "boolean") && (options[key] !== null) )
81+
{
7682
configFileContent += seperator + '"' + switchkey + '": ' + options[key];
7783
}
78-
else {
79-
grunt.fail.warn('Option "' + switchkey + '" is not type of boolean!');
84+
else
85+
{
86+
grunt.fail.warn('Option "' + switchkey + '" is not type of boolean!' );
8087
}
8188
break;
8289
// object Input Values
8390
case "define":
8491
case "checks":
8592
case "experimental-compiler-options":
86-
if ((typeof options[key] == "object") && (options[key] !== null)) {
87-
configFileContent += seperator + '"' + switchkey + '": ' + JSON.stringify(options[key], null, " ");
93+
if( (typeof options[key] == "object") && (options[key] !== null) )
94+
{
95+
configFileContent += seperator + '"' + switchkey + '": ' + JSON.stringify(options[key],null," ");
8896
}
89-
else {
90-
grunt.fail.warn('Option "' + switchkey + '" is not type of object!');
97+
else
98+
{
99+
grunt.fail.warn('Option "' + switchkey + '" is not type of object!' );
91100
}
92101
break;
93102
case "paths":
@@ -99,12 +108,17 @@ module.exports = function (grunt) {
99108
case "id-generators":
100109
case "soy-function-plugins":
101110
case "test-excludes":
102-
if ((typeof options[key] == "string") && (options[key] !== null)) {
111+
if( (typeof options[key] == "string") && (options[key] !== null) )
112+
{
103113
configFileContent += seperator + '"' + switchkey + '": ' + options[key];
104-
} else if ((typeof options[key] == "object") && (options[key] !== null)) {
105-
configFileContent += seperator + '"' + switchkey + '": ' + JSON.stringify(options[key], null, " ");
106-
} else {
107-
grunt.fail.warn('Option "' + switchkey + '" is not type of string or array - is type:' + typeof options[key]);
114+
}
115+
else if( (typeof options[key] == "object") && (options[key] !== null) )
116+
{
117+
configFileContent += seperator + '"' + switchkey + '": ' + JSON.stringify(options[key],null," ");
118+
}
119+
else
120+
{
121+
grunt.fail.warn('Option "' + switchkey + '" is not type of string or array - is type:' + typeof options[key] );
108122
}
109123
break;
110124
default:
@@ -115,9 +129,9 @@ module.exports = function (grunt) {
115129
}
116130

117131
// Iterate over all specified file groups.
118-
this.files.forEach(function (f) {
132+
this.files.forEach(function(f) {
119133

120-
var files = f.src.filter(function (filepath) {
134+
var files = f.src.filter(function(filepath) {
121135
if (!grunt.file.exists(filepath)) {
122136
grunt.fail.warn('File ' + filepath + ' does not exist!');
123137
return false;
@@ -131,31 +145,33 @@ module.exports = function (grunt) {
131145
}
132146
});
133147

134-
if (files.length > 0) {
148+
if (files.length > 0)
149+
{
135150
configFileContent += seperator + '"inputs": [\n';
136151
for (var i = 0; i < files.length; i++) {
137-
configFileContent += (i > 0 ? ',\n' : '') + ' "' + files[i] + '"';
152+
configFileContent += (i>0?',\n':'') + ' "' + files[i] + '"';
138153
}
139154
configFileContent += '\n ]';
140155
}
141156

142-
if ((typeof f.dest == "string") && (f.dest !== null)) {
157+
if ( (typeof f.dest == "string") && (f.dest !== null) )
158+
{
143159
configFileContent += seperator + '"output-file": "' + f.dest + '"';
144160
}
145161
});
146162

147163
configFileContent += '\n}';
148-
if (this.data.cwd) {
164+
if(this.data.cwd) {
149165
cwd = this.data.cwd;
150166
cd_cwd = 'cd ' + cwd + ' &&';
151167
configfilename = path.join(cwd, configfilename);
152168
};
153169

154170
// Write configFileContent
155-
grunt.file.write(configfilename, configFileContent);
171+
grunt.file.write(configfilename,configFileContent);
156172

157173
// do the plovr job
158-
var cmd = cd_cwd + ' java -jar ' + path.join(__dirname, '..', 'bin', '/') + 'plovr.jar build ' + configfilename + options_;
174+
var cmd = cd_cwd + ' java -jar ' + path.join(__dirname, '..', 'bin', '/') +'plovr.jar build ' + configfilename + options_;
159175
console.log(cmd);
160176
var prog = shell.exec(cmd);
161177
// delete temporary configfile
@@ -167,4 +183,3 @@ module.exports = function (grunt) {
167183
});
168184

169185
};
170-

0 commit comments

Comments
 (0)