Fix for expand-less copies with multiple files
Introduces a new test that uses a cwd- and expand-less target with
multiple input files being copied to a single destination directory. In
the task itself, the loop that operates on the list of `src` paths no
longer persists the `dest` from loop-to-loop, allowing the `src`
filename to actually show up in the full `dest` for successive files.
Fixes #220.
Partially reverts a15feecc7763269e995235dcb4647b223d67f516.
Dave Shifflett
9 years ago
43 | 43 |
{expand: true, cwd: 'test/fixtures', src: ['*.js'], dest: 'tmp/copy_test_files/'},
|
44 | 44 |
{expand: true, cwd: 'test/fixtures', src: ['**', '!*.wav'], dest: 'tmp/copy_test_mix/'},
|
45 | 45 |
{expand: true, cwd: 'test/fixtures', src: ['<%= test_vars.match %>'], dest: 'tmp/copy_test_v<%= test_vars.version %>/'}
|
|
46 |
]
|
|
47 |
},
|
|
48 |
|
|
49 |
noexpandWild: {
|
|
50 |
files: [
|
|
51 |
{src: 'test/fixtures/*.js', dest: 'tmp/copy_test_noexpandWild/'}
|
46 | 52 |
]
|
47 | 53 |
},
|
48 | 54 |
|
40 | 40 |
};
|
41 | 41 |
|
42 | 42 |
this.files.forEach(function(filePair) {
|
43 | |
var dest = filePair.dest;
|
44 | 43 |
isExpandedPair = filePair.orig.expand || false;
|
45 | 44 |
|
46 | 45 |
filePair.src.forEach(function(src) {
|
47 | 46 |
src = unixifyPath(src);
|
48 | |
dest = unixifyPath(dest);
|
|
47 |
var dest = unixifyPath(filePair.dest);
|
49 | 48 |
|
50 | 49 |
if (detectDestType(dest) === 'directory') {
|
51 | 50 |
dest = (isExpandedPair) ? dest : path.join(dest, src);
|
17 | 17 |
actual = fs.readdirSync('tmp/copy_test_v0.1.0').sort();
|
18 | 18 |
expected = fs.readdirSync('test/expected/copy_test_v0.1.0').sort();
|
19 | 19 |
test.deepEqual(expected, actual, 'should parse both dest and src templates');
|
|
20 |
|
|
21 |
test.done();
|
|
22 |
},
|
|
23 |
|
|
24 |
noexpandWild: function(test) {
|
|
25 |
'use strict';
|
|
26 |
|
|
27 |
test.expect(3);
|
|
28 |
|
|
29 |
['/', '/test/', '/test/fixtures/'].forEach(function(subpath, i) {
|
|
30 |
var actual = fs.readdirSync('tmp/copy_test_noexpandWild' + subpath).sort();
|
|
31 |
var expected = fs.readdirSync('test/expected/copy_test_noexpandWild' + subpath).sort();
|
|
32 |
test.deepEqual(expected, actual, 'should copy file structure at level ' + i);
|
|
33 |
});
|
20 | 34 |
|
21 | 35 |
test.done();
|
22 | 36 |
},
|
|
0 |
$(document).ready(function(){});⏎
|