[Pkg-javascript-commits] [node-osenv] 01/07: Imported Upstream version 0.1.0

Jérémy Lal kapouer at moszumanska.debian.org
Tue Jul 29 01:13:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

kapouer pushed a commit to branch master
in repository node-osenv.

commit e7655d8a34f2da00aee90bf18da33cfe6fe22ad9
Author: Jérémy Lal <kapouer at melix.org>
Date:   Tue Jul 29 03:07:29 2014 +0200

    Imported Upstream version 0.1.0
---
 .gitignore      | 13 +++++++++++++
 LICENSE         | 22 ++++++++++++----------
 osenv.js        | 11 ++---------
 package.json    |  4 ++--
 test/unix.js    |  5 -----
 test/windows.js | 11 ++---------
 6 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8c23dee
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+*.swp
+.*.swp
+
+.DS_Store
+*~
+.project
+.settings
+npm-debug.log
+coverage.html
+.idea
+lib-cov
+
+node_modules
diff --git a/LICENSE b/LICENSE
index 74489e2..0c44ae7 100644
--- a/LICENSE
+++ b/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/osenv.js b/osenv.js
index e3367a7..7836faf 100644
--- a/osenv.js
+++ b/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/package.json b/package.json
index fb92ed8..4917e28 100644
--- a/package.json
+++ b/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"
diff --git a/test/unix.js b/test/unix.js
index b72eb0b..f87cbfb 100644
--- a/test/unix.js
+++ b/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/test/windows.js b/test/windows.js
index dd3fe80..63ca453 100644
--- a/test/windows.js
+++ b/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 = ''

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-osenv.git



More information about the Pkg-javascript-commits mailing list