grunt-contrib-symlink
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -59,3 +59,3 @@ /* | ||
singleInNewDirectory:{ | ||
target: 'test/fixtures/single.js', | ||
target: '../test/fixtures/single.js', | ||
link:'tmp/single.js', | ||
@@ -84,3 +84,3 @@ options: { | ||
directoryInNewDirectory:{ | ||
target: 'test/fixtures/folder_one', | ||
target: '../../test/fixtures/folder_one', | ||
link:'tmp/test/folder_one', | ||
@@ -87,0 +87,0 @@ options: { |
{ | ||
"name": "grunt-contrib-symlink", | ||
"description": "Create a symlink between paths", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/mintbridge/grunt-contrib-symlink", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -25,3 +25,3 @@ /* | ||
force: false, | ||
type: null | ||
type: 'file' | ||
}); | ||
@@ -50,6 +50,5 @@ | ||
// does the src exist? | ||
if ( ! fs.existsSync(target)) { | ||
grunt.fail.warn('The target file/directory [' + target + '] does not exist.'); | ||
if (fs.existsSync(target)) { | ||
type = fs.statSync(target).isFile() ? 'file' : 'dir'; | ||
} | ||
type = options.type || fs.statSync(target).isFile() ? 'file' : 'dir'; | ||
@@ -81,10 +80,2 @@ // does the destination already exist? | ||
if(link[0] !== '/') { | ||
//prepend with dots to make it relative | ||
depth = link.match(/\//g); | ||
if (depth && depth.length > 0) { | ||
target = new Array(depth.length+1).join("../") + target; | ||
} | ||
} | ||
grunt.verbose.or.write('Creating symlink to ' + target.cyan + ' at ' + link.cyan + '...'); | ||
@@ -91,0 +82,0 @@ fs.symlinkSync(target, link, type); |
16
12956
222