Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "shelljs", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": "Artur Adib <aadib@mozilla.com>", | ||
@@ -5,0 +5,0 @@ "description": "Portable Unix shell commands for Node.js", |
@@ -511,2 +511,9 @@ # ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs) | ||
### tempdir() | ||
Examples: | ||
```javascript | ||
var tmp = tempdir(); // "/tmp" for most *nix platforms | ||
``` | ||
Searches and returns string containing a writeable, platform-dependent temporary directory. | ||
@@ -513,0 +520,0 @@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). |
@@ -39,2 +39,4 @@ var fs = require('fs'); | ||
fs.closeSync(fdw); | ||
fs.chmodSync(destFile, fs.statSync(srcFile).mode); | ||
} | ||
@@ -64,17 +66,19 @@ | ||
for(var i = 0; i < files.length; i++) { | ||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]); | ||
for (var i = 0; i < files.length; i++) { | ||
var srcFile = sourceDir + "/" + files[i]; | ||
var destFile = destDir + "/" + files[i]; | ||
var srcFileStat = fs.lstatSync(srcFile); | ||
if (currFile.isDirectory()) { | ||
if (srcFileStat.isDirectory()) { | ||
/* recursion this thing right on back. */ | ||
cpdirSyncRecursive(sourceDir + "/" + files[i], destDir + "/" + files[i], opts); | ||
} else if (currFile.isSymbolicLink()) { | ||
var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]); | ||
fs.symlinkSync(symlinkFull, destDir + "/" + files[i]); | ||
cpdirSyncRecursive(srcFile, destFile, opts); | ||
} else if (srcFileStat.isSymbolicLink()) { | ||
var symlinkFull = fs.readlinkSync(srcFile); | ||
fs.symlinkSync(symlinkFull, destFile); | ||
} else { | ||
/* At this point, we've hit a file actually worth copying... so copy it on over. */ | ||
if (fs.existsSync(destDir + "/" + files[i]) && !opts.force) { | ||
if (fs.existsSync(destFile) && !opts.force) { | ||
common.log('skipping existing file: ' + files[i]); | ||
} else { | ||
copyFileSync(sourceDir + "/" + files[i], destDir + "/" + files[i]); | ||
copyFileSync(srcFile, destFile); | ||
} | ||
@@ -81,0 +85,0 @@ } |
@@ -26,2 +26,9 @@ var common = require('./common'); | ||
//@ ### tempdir() | ||
//@ | ||
//@ Examples: | ||
//@ | ||
//@ ```javascript | ||
//@ var tmp = tempdir(); // "/tmp" for most *nix platforms | ||
//@ ``` | ||
//@ | ||
//@ Searches and returns string containing a writeable, platform-dependent temporary directory. | ||
@@ -28,0 +35,0 @@ //@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77467
1864
553