Commits

Kazunori Ninomiya committed 38a3656 Merge

Merge branch 'release/0.1.1'

Comments (0)

Files changed (3)

 
 ## Release History
 
+* 2013-05-04 v0.1.1 Bug fix. Changed the file deployment method and pattern matching method.
 * 2013-04-23 v0.1.0 Support wildcard pattern and JavaScript object as root. Extension of the setting method.
 * 2013-04-05 v0.0.1 first version
 {
   "name": "grunt-ect",
   "description": "Static site compiler built around ect",
-  "version": "0.1.0",
+  "version": "0.1.1",
   "homepage": "https://bitbucket.org/2no/grunt-ect",
   "author": {
     "name": "2no",
 
   function getSrc(file, options)
   {
-    var re, length
-      , src  = file.src
-      , orig = file.orig
+    var src  = file.src
+      , orig = _.clone(file.orig)
       , root = options.root
       ;
 
     switch (grunt.util.kindOf(root)) {
       case 'object':
-        re = orig.src.map(function(v) {
-          return new RegExp(v.replace('*', '.*'));
-        });
-        length = re.length;
         src = Object.keys(root).filter(function(key) {
-          var i = length;
+          var i = orig.src.length;
           while (i--) {
-            if (re[i].test(key)) {
+            if (grunt.file.minimatch(key, orig.src[i])) {
               return true;
             }
           }
 
       case 'string':
         if (typeof file.cwd === 'undefined') {
-          file.cwd = root;
-          src = grunt.file.expandMapping(orig.src, null, {
-            cwd: file.cwd,
-            flatten: file.flatten,
-            ext: file.ext,
-          }).map(function(v) {
-            return v.src[0];
+          orig.cwd = root;
+          src = grunt.task.normalizeMultiTaskFiles(orig)[0].src;
+          src = src.map(function(v) {
+            return !grunt.file.doesPathContain(root, v) ?
+              path.join(root, path.sep, v) : v;
           });
         }
         /* falls through */