diff options
author | isaacs <i@izs.me> | 2012-08-17 02:26:44 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-08-17 02:26:44 +0400 |
commit | 6ad6260ea47397b96001f311489a08de64592f82 (patch) | |
tree | 82d3940d71c2d2d4f1e53a9e1c4b818b7685adbd | |
parent | 190adc23e9df328d22ccd02419a0e54c6f87fabe (diff) |
npmconf@0.0.7
So that saving the global config file doesn't break in a nave subshell
-rw-r--r-- | node_modules/npmconf/npmconf.js | 18 | ||||
-rw-r--r-- | node_modules/npmconf/package.json | 7 | ||||
-rw-r--r-- | node_modules/npmconf/test/fixtures/userconfig-with-gc | 21 |
3 files changed, 16 insertions, 30 deletions
diff --git a/node_modules/npmconf/npmconf.js b/node_modules/npmconf/npmconf.js index da4b42290..41ba25142 100644 --- a/node_modules/npmconf/npmconf.js +++ b/node_modules/npmconf/npmconf.js @@ -9,6 +9,7 @@ var path = require('path') var nopt = require('nopt') var ini = require('ini') var Octal = configDefs.Octal +var mkdirp = require('mkdirp') exports.load = load exports.Conf = Conf @@ -174,18 +175,23 @@ Conf.prototype.save = function (where, cb) { then = then.bind(this) done = done.bind(this) this._saving ++ + var mode = where === 'user' ? 0600 : 0666 if (!data.trim()) fs.unlink(target.path, done) else { - fs.writeFile(target.path, data, 'utf8', function (er) { + mkdirp(path.dirname(target.path), function (er) { if (er) return then(er) - if (where === 'user' && myUid && myGid) - fs.chown(target.path, +myUid, +myGid, then) - else - then() - }.bind(this)) + fs.writeFile(target.path, data, 'utf8', function (er) { + if (er) + return then(er) + if (where === 'user' && myUid && myGid) + fs.chown(target.path, +myUid, +myGid, then) + else + then() + }) + }) } function then (er) { diff --git a/node_modules/npmconf/package.json b/node_modules/npmconf/package.json index 3a50fe9a4..4c531dabf 100644 --- a/node_modules/npmconf/package.json +++ b/node_modules/npmconf/package.json @@ -1,6 +1,6 @@ { "name": "npmconf", - "version": "0.0.6", + "version": "0.0.7", "description": "The config thing npm uses", "main": "npmconf.js", "directories": { @@ -10,6 +10,7 @@ "config-chain": "~1.1.1", "inherits": "~1.0.0", "once": "~1.1.1", + "mkdirp": "~0.3.3", "nopt": "~2.0.0" }, "devDependencies": {}, @@ -37,6 +38,6 @@ "nopt": "~2.0.0" }, "readme": "# npmconf\n\nThe config thing npm uses\n\nIf you are interested in interacting with the config settings that npm\nuses, then use this module.\n\nHowever, if you are writing a new Node.js program, and want\nconfiguration functionality similar to what npm has, but for your\nown thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),\nwhich is probably what you want.\n\nIf I were to do it all over again, that's what I'd do for npm. But,\nalas, there are many systems depending on many of the particulars of\nnpm's configuration setup, so it's not worth the cost of changing.\n\n## USAGE\n\n```javascript\nvar npmconf = require('npmconf')\n\n// pass in the cli options that you read from the cli\n// or whatever top-level configs you want npm to use for now.\nnpmconf.load({some:'configs'}, function (er, conf) {\n // do stuff with conf\n conf.get('some', 'cli') // 'configs'\n conf.get('username') // 'joebobwhatevers'\n conf.set('foo', 'bar', 'user')\n conf.save('user', function (er) {\n // foo = bar is now saved to ~/.npmrc or wherever\n })\n})\n```\n", - "_id": "npmconf@0.0.6", - "_from": "npmconf@latest" + "_id": "npmconf@0.0.7", + "_from": "npmconf@~0.0.6" } diff --git a/node_modules/npmconf/test/fixtures/userconfig-with-gc b/node_modules/npmconf/test/fixtures/userconfig-with-gc deleted file mode 100644 index d32b2db11..000000000 --- a/node_modules/npmconf/test/fixtures/userconfig-with-gc +++ /dev/null @@ -1,21 +0,0 @@ -_auth = dXNlcm5hbWU6cGFzc3dvcmQ= -globalconfig = /Users/isaacs/dev/js/npm/node_modules/npmconf/test/fixtures/globalconfig -email = i@izs.me -env-thing = asdf -init.author.name = Isaac Z. Schlueter -init.author.email = i@izs.me -init.author.url = http://blog.izs.me/ -proprietary-attribs = false -npm:publishtest = true -_npmjs.org:couch = https://admin:password@localhost:5984/registry -npm-www:nocache = 1 -sign-git-tag = false -message = v%s -strict-ssl = false - -[_token] -AuthSession = yabba-dabba-doodle -version = 1 -expires = 1345001053415 -path = / -httponly = true |