diff options
author | Robert Kowalski <rok@kowalski.gd> | 2014-06-09 00:15:49 +0400 |
---|---|---|
committer | Robert Kowalski <rok@kowalski.gd> | 2014-06-09 00:15:49 +0400 |
commit | 48ac5e370eb1486eff8f69dcab592addfd5b3316 (patch) | |
tree | 3f13f5d607fddc64cc8c74185f550c0047799b60 /node_modules/osenv | |
parent | af57760260e0fa9e3d0eae6b80c816e6a8e71fae (diff) |
Update osenv@0.1.0 which removes ~/tmp as possible tmp-folder
Closes #3470
Diffstat (limited to 'node_modules/osenv')
-rw-r--r-- | node_modules/osenv/LICENSE | 22 | ||||
-rw-r--r-- | node_modules/osenv/osenv.js | 11 | ||||
-rw-r--r-- | node_modules/osenv/package.json | 14 | ||||
-rw-r--r-- | node_modules/osenv/test/unix.js | 5 | ||||
-rw-r--r-- | node_modules/osenv/test/windows.js | 11 |
5 files changed, 26 insertions, 37 deletions
diff --git a/node_modules/osenv/LICENSE b/node_modules/osenv/LICENSE index 74489e2e2..0c44ae716 100644 --- a/node_modules/osenv/LICENSE +++ b/node_modules/osenv/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) Isaac Z. Schlueter +Copyright (c) Isaac Z. Schlueter ("Author") All rights reserved. The BSD License @@ -6,20 +6,22 @@ The BSD License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/osenv/osenv.js b/node_modules/osenv/osenv.js index e3367a774..7836fafcc 100644 --- a/node_modules/osenv/osenv.js +++ b/node_modules/osenv/osenv.js @@ -1,7 +1,7 @@ var isWindows = process.platform === 'win32' -var windir = isWindows ? process.env.windir || 'C:\\Windows' : null var path = require('path') var exec = require('child_process').exec +var os = require('os') // looking up envs is a bit costly. // Also, sometimes we want to have a fallback @@ -46,14 +46,7 @@ memo('hostname', function () { }, 'hostname') memo('tmpdir', function () { - var t = isWindows ? 'temp' : 'tmp' - return process.env.TMPDIR || - process.env.TMP || - process.env.TEMP || - ( exports.home() ? path.resolve(exports.home(), t) - : isWindows ? path.resolve(windir, t) - : '/tmp' - ) + return os.tmpDir() }) memo('home', function () { diff --git a/node_modules/osenv/package.json b/node_modules/osenv/package.json index 0c01cc815..b66ce8df2 100644 --- a/node_modules/osenv/package.json +++ b/node_modules/osenv/package.json @@ -1,13 +1,13 @@ { "name": "osenv", - "version": "0.0.3", + "version": "0.1.0", "main": "osenv.js", "directories": { "test": "test" }, "dependencies": {}, "devDependencies": { - "tap": "~0.2.5" + "tap": "~0.4.9" }, "scripts": { "test": "tap test/*.js" @@ -33,6 +33,12 @@ "license": "BSD", "description": "Look up environment settings specific to different operating systems", "readme": "# osenv\n\nLook up environment settings specific to different operating systems.\n\n## Usage\n\n```javascript\nvar osenv = require('osenv')\nvar path = osenv.path()\nvar user = osenv.user()\n// etc.\n\n// Some things are not reliably in the env, and have a fallback command:\nvar h = osenv.hostname(function (er, hostname) {\n h = hostname\n})\n// This will still cause it to be memoized, so calling osenv.hostname()\n// is now an immediate operation.\n\n// You can always send a cb, which will get called in the nextTick\n// if it's been memoized, or wait for the fallback data if it wasn't\n// found in the environment.\nosenv.hostname(function (er, hostname) {\n if (er) console.error('error looking up hostname')\n else console.log('this machine calls itself %s', hostname)\n})\n```\n\n## osenv.hostname()\n\nThe machine name. Calls `hostname` if not found.\n\n## osenv.user()\n\nThe currently logged-in user. Calls `whoami` if not found.\n\n## osenv.prompt()\n\nEither PS1 on unix, or PROMPT on Windows.\n\n## osenv.tmpdir()\n\nThe place where temporary files should be created.\n\n## osenv.home()\n\nNo place like it.\n\n## osenv.path()\n\nAn array of the places that the operating system will search for\nexecutables.\n\n## osenv.editor() \n\nReturn the executable name of the editor program. This uses the EDITOR\nand VISUAL environment variables, and falls back to `vi` on Unix, or\n`notepad.exe` on Windows.\n\n## osenv.shell()\n\nThe SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'\nor 'cmd'.\n", - "_id": "osenv@0.0.3", - "_from": "osenv@latest" + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/isaacs/osenv/issues" + }, + "homepage": "https://github.com/isaacs/osenv", + "_id": "osenv@0.1.0", + "_shasum": "61668121eec584955030b9f470b1d2309504bfcb", + "_from": "osenv@~0.1.0" } diff --git a/node_modules/osenv/test/unix.js b/node_modules/osenv/test/unix.js index b72eb0b3f..f87cbfb32 100644 --- a/node_modules/osenv/test/unix.js +++ b/node_modules/osenv/test/unix.js @@ -23,7 +23,6 @@ process.env.EDITOR = 'edit' process.env.VISUAL = 'visualedit' process.env.SHELL = 'zsh' - tap.test('basic unix sanity test', function (t) { var osenv = require('../osenv.js') @@ -48,10 +47,6 @@ tap.test('basic unix sanity test', function (t) { process.env.TEMP = '' delete require.cache[require.resolve('../osenv.js')] var osenv = require('../osenv.js') - t.equal(osenv.tmpdir(), '/home/sirUser/tmp') - - delete require.cache[require.resolve('../osenv.js')] - var osenv = require('../osenv.js') osenv.home = function () { return null } t.equal(osenv.tmpdir(), '/tmp') diff --git a/node_modules/osenv/test/windows.js b/node_modules/osenv/test/windows.js index dd3fe8070..63ca45321 100644 --- a/node_modules/osenv/test/windows.js +++ b/node_modules/osenv/test/windows.js @@ -12,7 +12,7 @@ if (process.platform !== 'win32') { // load this before clubbing the platform name. var tap = require('tap') -process.env.windir = 'C:\\windows' +process.env.windir = 'c:\\windows' process.env.USERDOMAIN = 'some-domain' process.env.USERNAME = 'sirUser' process.env.USERPROFILE = 'C:\\Users\\sirUser' @@ -29,8 +29,6 @@ process.env.ComSpec = 'some-com' tap.test('basic windows sanity test', function (t) { var osenv = require('../osenv.js') - var osenv = require('../osenv.js') - t.equal(osenv.user(), process.env.USERDOMAIN + '\\' + process.env.USERNAME) t.equal(osenv.home(), process.env.USERPROFILE) @@ -53,13 +51,8 @@ tap.test('basic windows sanity test', function (t) { process.env.TEMP = '' delete require.cache[require.resolve('../osenv.js')] var osenv = require('../osenv.js') - t.equal(osenv.tmpdir(), 'C:\\Users\\sirUser\\temp') - - process.env.TEMP = '' - delete require.cache[require.resolve('../osenv.js')] - var osenv = require('../osenv.js') osenv.home = function () { return null } - t.equal(osenv.tmpdir(), 'C:\\windows\\temp') + t.equal(osenv.tmpdir(), 'c:\\windows\\temp') t.equal(osenv.editor(), 'edit') process.env.EDITOR = '' |