gulp-angular-modules
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -8,2 +8,3 @@ | ||
var path = require("path"); | ||
var stripComments = require("strip-comments"); | ||
@@ -48,2 +49,4 @@ // consts | ||
var contents = stripComments(contents); | ||
var re = new RegExp(/\.module\((["'])([a-zA-Z0-9_.-]*)/); | ||
@@ -50,0 +53,0 @@ |
{ | ||
"name": "gulp-angular-modules", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Detects when you are adding a new `Angular.js` module into your working directory to automatically load the file and include the module into your project", | ||
@@ -29,2 +29,3 @@ "main": "index.js", | ||
"gulp-util": "^3.0.1", | ||
"strip-comments": "^0.3.2", | ||
"through2": "^0.6.1" | ||
@@ -31,0 +32,0 @@ }, |
@@ -60,3 +60,3 @@ ## gulp-angular-modules | ||
return gulp.src(["!app/src/templates/*", "app/src/**/*.js"]) | ||
return gulp.src(["app/src/**/*.js", "!app/src/templates/*"]) | ||
.pipe(angularModules("gulp-angular-modules.js", options)) // Name of the file generated | ||
@@ -63,0 +63,0 @@ .pipe(gulp.dest("app/src/init/")) // Destination folder |
@@ -6,2 +6,10 @@ var File = require('vinyl'); | ||
var response; | ||
beforeEach(function() { | ||
response = "(function (ng) {\n"; | ||
response += "'use strict';\n"; | ||
response += "ng.module('gulp-angular-modules', %s);\n"; | ||
response += "})(angular);"; | ||
}); | ||
it("should return an Angular.js module with all the dependencies", function(done) { | ||
@@ -24,13 +32,38 @@ | ||
myNgInject.on('data', function(file) { | ||
// make sure it came out the same way it went in | ||
expect(file.isBuffer()).toBeTruthy(); | ||
var result = response.replace('%s', "['module.name','module.name2']"); | ||
expect(file.contents.toString('utf8')).toEqual(result); | ||
done(); | ||
}); | ||
var result = "(function (ng) {\n"; | ||
result += "'use strict';\n"; | ||
result += "ng.module('gulp-angular-modules', ['module.name','module.name2']);\n"; | ||
result += "})(angular);"; | ||
// write the fake file to it | ||
myNgInject.write(fakeFile1); | ||
myNgInject.write(fakeFile2); | ||
myNgInject.end(); | ||
}); | ||
it('should not include commented lines', function(done) { | ||
// create the fake file | ||
var fakeFile1 = new File({ | ||
contents: new Buffer('//ng.module("module.name", []); ') | ||
}); | ||
var fakeFile2 = new File({ | ||
contents: new Buffer('ng.module("module.name2", []); ') | ||
}); | ||
// Create a plugin stream | ||
var myNgInject = angularModules("gulp-angular-modules.js", {name: "gulp-angular-modules"}); | ||
// wait for the file to come back out | ||
myNgInject.on('data', function(file) { | ||
// make sure it came out the same way it went in | ||
expect(file.isBuffer()).toBeTruthy(); | ||
var result = response.replace('%s', "['module.name2']"); | ||
expect(file.contents.toString('utf8')).toEqual(result); | ||
done(); | ||
@@ -37,0 +70,0 @@ |
Sorry, the diff of this file is not supported yet
173
54163
3
+ Addedstrip-comments@^0.3.2
+ Addedstrip-comments@0.3.4(transitive)