Template Upload
This commit is contained in:
13
node_modules/osenv/.npmignore
generated
vendored
Normal file
13
node_modules/osenv/.npmignore
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
*.swp
|
||||
.*.swp
|
||||
|
||||
.DS_Store
|
||||
*~
|
||||
.project
|
||||
.settings
|
||||
npm-debug.log
|
||||
coverage.html
|
||||
.idea
|
||||
lib-cov
|
||||
|
||||
node_modules
|
9
node_modules/osenv/.travis.yml
generated
vendored
Normal file
9
node_modules/osenv/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
language: node_js
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.8'
|
||||
- '0.10'
|
||||
- '0.12'
|
||||
- 'iojs'
|
||||
before_install:
|
||||
- npm install -g npm@latest
|
15
node_modules/osenv/LICENSE
generated
vendored
Normal file
15
node_modules/osenv/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
63
node_modules/osenv/README.md
generated
vendored
Normal file
63
node_modules/osenv/README.md
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
# osenv
|
||||
|
||||
Look up environment settings specific to different operating systems.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var osenv = require('osenv')
|
||||
var path = osenv.path()
|
||||
var user = osenv.user()
|
||||
// etc.
|
||||
|
||||
// Some things are not reliably in the env, and have a fallback command:
|
||||
var h = osenv.hostname(function (er, hostname) {
|
||||
h = hostname
|
||||
})
|
||||
// This will still cause it to be memoized, so calling osenv.hostname()
|
||||
// is now an immediate operation.
|
||||
|
||||
// You can always send a cb, which will get called in the nextTick
|
||||
// if it's been memoized, or wait for the fallback data if it wasn't
|
||||
// found in the environment.
|
||||
osenv.hostname(function (er, hostname) {
|
||||
if (er) console.error('error looking up hostname')
|
||||
else console.log('this machine calls itself %s', hostname)
|
||||
})
|
||||
```
|
||||
|
||||
## osenv.hostname()
|
||||
|
||||
The machine name. Calls `hostname` if not found.
|
||||
|
||||
## osenv.user()
|
||||
|
||||
The currently logged-in user. Calls `whoami` if not found.
|
||||
|
||||
## osenv.prompt()
|
||||
|
||||
Either PS1 on unix, or PROMPT on Windows.
|
||||
|
||||
## osenv.tmpdir()
|
||||
|
||||
The place where temporary files should be created.
|
||||
|
||||
## osenv.home()
|
||||
|
||||
No place like it.
|
||||
|
||||
## osenv.path()
|
||||
|
||||
An array of the places that the operating system will search for
|
||||
executables.
|
||||
|
||||
## osenv.editor()
|
||||
|
||||
Return the executable name of the editor program. This uses the EDITOR
|
||||
and VISUAL environment variables, and falls back to `vi` on Unix, or
|
||||
`notepad.exe` on Windows.
|
||||
|
||||
## osenv.shell()
|
||||
|
||||
The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'
|
||||
or 'cmd'.
|
72
node_modules/osenv/osenv.js
generated
vendored
Normal file
72
node_modules/osenv/osenv.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
var isWindows = process.platform === 'win32'
|
||||
var path = require('path')
|
||||
var exec = require('child_process').exec
|
||||
var osTmpdir = require('os-tmpdir')
|
||||
var osHomedir = require('os-homedir')
|
||||
|
||||
// looking up envs is a bit costly.
|
||||
// Also, sometimes we want to have a fallback
|
||||
// Pass in a callback to wait for the fallback on failures
|
||||
// After the first lookup, always returns the same thing.
|
||||
function memo (key, lookup, fallback) {
|
||||
var fell = false
|
||||
var falling = false
|
||||
exports[key] = function (cb) {
|
||||
var val = lookup()
|
||||
if (!val && !fell && !falling && fallback) {
|
||||
fell = true
|
||||
falling = true
|
||||
exec(fallback, function (er, output, stderr) {
|
||||
falling = false
|
||||
if (er) return // oh well, we tried
|
||||
val = output.trim()
|
||||
})
|
||||
}
|
||||
exports[key] = function (cb) {
|
||||
if (cb) process.nextTick(cb.bind(null, null, val))
|
||||
return val
|
||||
}
|
||||
if (cb && !falling) process.nextTick(cb.bind(null, null, val))
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
memo('user', function () {
|
||||
return ( isWindows
|
||||
? process.env.USERDOMAIN + '\\' + process.env.USERNAME
|
||||
: process.env.USER
|
||||
)
|
||||
}, 'whoami')
|
||||
|
||||
memo('prompt', function () {
|
||||
return isWindows ? process.env.PROMPT : process.env.PS1
|
||||
})
|
||||
|
||||
memo('hostname', function () {
|
||||
return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME
|
||||
}, 'hostname')
|
||||
|
||||
memo('tmpdir', function () {
|
||||
return osTmpdir()
|
||||
})
|
||||
|
||||
memo('home', function () {
|
||||
return osHomedir()
|
||||
})
|
||||
|
||||
memo('path', function () {
|
||||
return (process.env.PATH ||
|
||||
process.env.Path ||
|
||||
process.env.path).split(isWindows ? ';' : ':')
|
||||
})
|
||||
|
||||
memo('editor', function () {
|
||||
return process.env.EDITOR ||
|
||||
process.env.VISUAL ||
|
||||
(isWindows ? 'notepad.exe' : 'vi')
|
||||
})
|
||||
|
||||
memo('shell', function () {
|
||||
return isWindows ? process.env.ComSpec || 'cmd'
|
||||
: process.env.SHELL || 'bash'
|
||||
})
|
104
node_modules/osenv/package.json
generated
vendored
Normal file
104
node_modules/osenv/package.json
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"osenv@^0.1.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\configstore"
|
||||
]
|
||||
],
|
||||
"_from": "osenv@>=0.1.0-0 <0.2.0-0",
|
||||
"_id": "osenv@0.1.4",
|
||||
"_inCache": true,
|
||||
"_location": "/osenv",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/osenv-0.1.4.tgz_1481655889868_0.3980878754518926"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "i@izs.me",
|
||||
"name": "isaacs"
|
||||
},
|
||||
"_npmVersion": "3.10.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "osenv",
|
||||
"raw": "osenv@^0.1.0",
|
||||
"rawSpec": "^0.1.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.1.0-0 <0.2.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/configstore"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz",
|
||||
"_shasum": "42fe6d5953df06c8064be6f176c3d05aaaa34644",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "osenv@^0.1.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\configstore",
|
||||
"author": {
|
||||
"email": "i@izs.me",
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/osenv/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"os-homedir": "^1.0.0",
|
||||
"os-tmpdir": "^1.0.0"
|
||||
},
|
||||
"description": "Look up environment settings specific to different operating systems",
|
||||
"devDependencies": {
|
||||
"tap": "^8.0.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "42fe6d5953df06c8064be6f176c3d05aaaa34644",
|
||||
"tarball": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz"
|
||||
},
|
||||
"gitHead": "ef718f0d20e38d45ec452b7faeefc692d3cd1062",
|
||||
"homepage": "https://github.com/npm/osenv#readme",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"environment",
|
||||
"home",
|
||||
"path",
|
||||
"prompt",
|
||||
"ps1",
|
||||
"tmpdir",
|
||||
"variable"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "osenv.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
{
|
||||
"name": "robertkowalski",
|
||||
"email": "rok@kowalski.gd"
|
||||
},
|
||||
{
|
||||
"name": "othiym23",
|
||||
"email": "ogd@aoaioxxysz.net"
|
||||
},
|
||||
{
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
}
|
||||
],
|
||||
"name": "osenv",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/osenv.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.1.4"
|
||||
}
|
71
node_modules/osenv/test/unix.js
generated
vendored
Normal file
71
node_modules/osenv/test/unix.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
// only run this test on windows
|
||||
// pretending to be another platform is too hacky, since it breaks
|
||||
// how the underlying system looks up module paths and runs
|
||||
// child processes, and all that stuff is cached.
|
||||
var tap = require('tap')
|
||||
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
tap.plan(0, 'Skip unix tests, this is not unix')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
// like unix, but funny
|
||||
process.env.USER = 'sirUser'
|
||||
process.env.HOME = '/home/sirUser'
|
||||
process.env.HOSTNAME = 'my-machine'
|
||||
process.env.TMPDIR = '/tmpdir'
|
||||
process.env.TMP = '/tmp'
|
||||
process.env.TEMP = '/temp'
|
||||
process.env.PATH = '/opt/local/bin:/usr/local/bin:/usr/bin/:bin'
|
||||
process.env.PS1 = '(o_o) $ '
|
||||
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')
|
||||
|
||||
t.equal(osenv.user(), process.env.USER)
|
||||
t.equal(osenv.home(), process.env.HOME)
|
||||
t.equal(osenv.hostname(), process.env.HOSTNAME)
|
||||
t.same(osenv.path(), process.env.PATH.split(':'))
|
||||
t.equal(osenv.prompt(), process.env.PS1)
|
||||
t.equal(osenv.tmpdir(), process.env.TMPDIR)
|
||||
|
||||
// mildly evil, but it's for a test.
|
||||
process.env.TMPDIR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.TMP)
|
||||
|
||||
process.env.TMP = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.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(), '/tmp')
|
||||
|
||||
t.equal(osenv.editor(), 'edit')
|
||||
process.env.EDITOR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'visualedit')
|
||||
|
||||
process.env.VISUAL = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'vi')
|
||||
|
||||
t.equal(osenv.shell(), 'zsh')
|
||||
process.env.SHELL = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.shell(), 'bash')
|
||||
|
||||
t.end()
|
||||
})
|
74
node_modules/osenv/test/windows.js
generated
vendored
Normal file
74
node_modules/osenv/test/windows.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
// only run this test on windows
|
||||
// pretending to be another platform is too hacky, since it breaks
|
||||
// how the underlying system looks up module paths and runs
|
||||
// child processes, and all that stuff is cached.
|
||||
if (process.platform !== 'win32') {
|
||||
console.log('TAP version 13\n' +
|
||||
'1..0 # Skip windows tests, this is not windows\n')
|
||||
return
|
||||
}
|
||||
|
||||
// load this before clubbing the platform name.
|
||||
var tap = require('tap')
|
||||
|
||||
process.env.windir = 'c:\\windows'
|
||||
process.env.USERDOMAIN = 'some-domain'
|
||||
process.env.USERNAME = 'sirUser'
|
||||
process.env.USERPROFILE = 'C:\\Users\\sirUser'
|
||||
process.env.COMPUTERNAME = 'my-machine'
|
||||
process.env.TMPDIR = 'C:\\tmpdir'
|
||||
process.env.TMP = 'C:\\tmp'
|
||||
process.env.TEMP = 'C:\\temp'
|
||||
process.env.Path = 'C:\\Program Files\\;C:\\Binary Stuff\\bin'
|
||||
process.env.PROMPT = '(o_o) $ '
|
||||
process.env.EDITOR = 'edit'
|
||||
process.env.VISUAL = 'visualedit'
|
||||
process.env.ComSpec = 'some-com'
|
||||
|
||||
tap.test('basic windows sanity test', function (t) {
|
||||
var osenv = require('../osenv.js')
|
||||
|
||||
t.equal(osenv.user(),
|
||||
process.env.USERDOMAIN + '\\' + process.env.USERNAME)
|
||||
t.equal(osenv.home(), process.env.USERPROFILE)
|
||||
t.equal(osenv.hostname(), process.env.COMPUTERNAME)
|
||||
t.same(osenv.path(), process.env.Path.split(';'))
|
||||
t.equal(osenv.prompt(), process.env.PROMPT)
|
||||
t.equal(osenv.tmpdir(), process.env.TMPDIR)
|
||||
|
||||
// mildly evil, but it's for a test.
|
||||
process.env.TMPDIR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.TMP)
|
||||
|
||||
process.env.TMP = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.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.editor(), 'edit')
|
||||
process.env.EDITOR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'visualedit')
|
||||
|
||||
process.env.VISUAL = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'notepad.exe')
|
||||
|
||||
t.equal(osenv.shell(), 'some-com')
|
||||
process.env.ComSpec = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.shell(), 'cmd')
|
||||
|
||||
t.end()
|
||||
})
|
39
node_modules/osenv/x.tap
generated
vendored
Normal file
39
node_modules/osenv/x.tap
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
TAP version 13
|
||||
# Subtest: test/unix.js
|
||||
TAP version 13
|
||||
# Subtest: basic unix sanity test
|
||||
ok 1 - should be equal
|
||||
ok 2 - should be equal
|
||||
ok 3 - should be equal
|
||||
ok 4 - should be equivalent
|
||||
ok 5 - should be equal
|
||||
ok 6 - should be equal
|
||||
ok 7 - should be equal
|
||||
ok 8 - should be equal
|
||||
ok 9 - should be equal
|
||||
ok 10 - should be equal
|
||||
ok 11 - should be equal
|
||||
ok 12 - should be equal
|
||||
ok 13 - should be equal
|
||||
ok 14 - should be equal
|
||||
1..14
|
||||
ok 1 - basic unix sanity test # time=10.712ms
|
||||
|
||||
1..1
|
||||
# time=18.422ms
|
||||
ok 1 - test/unix.js # time=169.827ms
|
||||
|
||||
# Subtest: test/windows.js
|
||||
TAP version 13
|
||||
1..0 # Skip windows tests, this is not windows
|
||||
|
||||
ok 2 - test/windows.js # SKIP Skip windows tests, this is not windows
|
||||
|
||||
# Subtest: test/nada.js
|
||||
TAP version 13
|
||||
1..0
|
||||
|
||||
ok 2 - test/nada.js
|
||||
|
||||
1..3
|
||||
# time=274.247ms
|
Reference in New Issue
Block a user