Skip to content

Commit

Permalink
Merge pull request #401 from Schoonology/master
Browse files Browse the repository at this point in the history
Resolve destinationRoot in prepCopy.
  • Loading branch information
SBoudrias committed Nov 14, 2013
2 parents 97a7fbf + d8f76b2 commit 41ffd6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/actions/actions.js
Expand Up @@ -43,6 +43,7 @@ function prepCopy(source, destination, process) {
}

source = this.isPathAbsolute(source) ? source : path.join(this.sourceRoot(), source);
destination = this.isPathAbsolute(destination) ? destination : path.join(this.destinationRoot(), destination);

var encoding = null;
var binary = isBinaryFile(source);
Expand Down
9 changes: 9 additions & 0 deletions test/actions.js
Expand Up @@ -77,13 +77,22 @@ describe('yeoman.generators.Base', function () {

return contents;
});

var oldDestRoot = this.dummy.destinationRoot();
this.dummy.destinationRoot('write/to');
this.dummy.copy('foo.js', 'foo-destRoot.js');
this.dummy.destinationRoot(oldDestRoot);
this.dummy.conflicter.resolve(done);
});

it('should copy source files relative to the "sourceRoot" value', function (done) {
fs.stat('write/to/foo.js', done);
});

it('should copy to destination files relative to the "destinationRoot" value', function (done) {
fs.stat('write/to/foo-destRoot.js', done);
});

it('should allow absolute path, and prevent the relative paths join', function (done) {
fs.stat('write/to/bar.js', done);
});
Expand Down

0 comments on commit 41ffd6f

Please sign in to comment.