Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add opener dep

  • Loading branch information...
commit 70df4aa74898c14cd1eaf160eeab266418f1578c 1 parent 0fc2c2d
@isaacs isaacs authored
View
12 LICENSE
@@ -51,15 +51,15 @@ this license.
used with permission.
"Gubblebum Blocky" font
-Copyright (c) 2007 by Tjarda Koster, http://jelloween.deviantart.com
+Copyright (c) by Tjarda Koster, http://jelloween.deviantart.com
included for use in the npm website and documentation,
used with permission.
-This program uses "node-uuid", Copyright (c) 2010 Robert Kieffer,
-according to the terms of the MIT license.
-
-This program uses "request", Copyright (c) 2011 Mikeal Rogers,
+This program uses "request", Copyright (c) Mikeal Rogers,
according to the terms of the Apache license.
-This program uses "mkdirp", Copyright (c) 2010 James Halliday,
+This program uses "mkdirp", Copyright (c) James Halliday,
according to the terms of the MIT/X11 license.
+
+This program uses "opener", Copyright (c) Domenic Denicola,
+according to the terms of the DWTFPL2 license.
View
14 node_modules/opener/LICENSE.txt
@@ -0,0 +1,14 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2012 Domenic Denicola <domenic@domenicdenicola.com>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
+
View
44 node_modules/opener/README.md
@@ -0,0 +1,44 @@
+# It Opens Stuff
+
+That is, in your desktop environment. This will make *actual windows pop up*, with stuff in them:
+
+```bash
+npm install opener -g
+
+opener http://google.com
+opener ./my-file.txt
+opener firefox
+opener npm run lint
+```
+
+Also if you want to use it programmatically you can do that too:
+
+```js
+var opener = require("opener");
+
+opener("http://google.com");
+opener("./my-file.txt");
+opener("firefox");
+opener("npm run lint");
+```
+
+## Use It for Good
+
+Like opening the user's browser with a test harness in your package's test script:
+
+```json
+{
+ "scripts": {
+ "test": "opener ./test/runner.html"
+ },
+ "devDependencies": {
+ "opener": "*"
+ }
+}
+```
+
+## Why
+
+Because Windows has `start`, Macs have `open`, and *nix has `xdg-open`. At least
+[according to some guy on StackOverflow](http://stackoverflow.com/q/1480971/3191). And I like things that work on all
+three. Like Node.js. And Opener.
View
55 node_modules/opener/opener.js
@@ -0,0 +1,55 @@
+#!/usr/bin/env node
+
+"use strict";
+
+var childProcess = require("child_process");
+
+function opener(args, options, callback) {
+ // http://stackoverflow.com/q/1480971/3191, but see below for Windows.
+ var command = process.platform === "win32" ? "cmd" :
+ process.platform === "darwin" ? "open" :
+ "xdg-open";
+
+ if (typeof args === "string") {
+ args = [args];
+ }
+
+ if (typeof options === "function") {
+ callback = options;
+ options = {};
+ }
+
+ if (options && typeof options === "object" && options.command) {
+ if (process.platform === "win32") {
+ // *always* use cmd on windows
+ args = [options.command].concat(args);
+ } else {
+ cmd = options.command;
@domenic Collaborator
domenic added a note

So due to this typo you'll want to update to the latest opener (see domenic/opener@5041021).

@isaacs Owner
isaacs added a note

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
+ }
+
+ if (process.platform === "win32") {
+ // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and
+ // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the
+ // responsibility to "cmd /c", which has that logic built in.
+ //
+ // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title,
+ // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
+ args = ["/c", "start", '""'].concat(args);
+ }
+
+ childProcess.execFile(command, args, options, callback);
+}
+
+// Export `opener` for programmatic access.
+// You might use this to e.g. open a website: `opener("http://google.com")`
+module.exports = opener;
+
+// If we're being called from the command line, just execute, using the command-line arguments.
+if (require.main && require.main.id === module.id) {
+ opener(process.argv.slice(2), function (error) {
+ if (error) {
+ throw error;
+ }
+ });
+}
View
34 node_modules/opener/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "opener",
+ "description": "Opens stuff, like webpages and files and executables, cross-platform",
+ "version": "1.2.0",
+ "author": {
+ "name": "Domenic Denicola",
+ "email": "domenic@domenicdenicola.com",
+ "url": "http://domenicdenicola.com"
+ },
+ "license": "WTFPL",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/domenic/opener.git"
+ },
+ "bugs": {
+ "url": "http://github.com/domenic/opener/issues"
+ },
+ "main": "opener.js",
+ "bin": {
+ "opener": "opener.js"
+ },
+ "scripts": {
+ "lint": "jshint opener.js --show-non-errors"
+ },
+ "devDependencies": {
+ "jshint": ">= 0.7.3"
+ },
+ "readme": "# It Opens Stuff\n\nThat is, in your desktop environment. This will make *actual windows pop up*, with stuff in them:\n\n```bash\nnpm install opener -g\n\nopener http://google.com\nopener ./my-file.txt\nopener firefox\nopener npm run lint\n```\n\nAlso if you want to use it programmatically you can do that too:\n\n```js\nvar opener = require(\"opener\");\n\nopener(\"http://google.com\");\nopener(\"./my-file.txt\");\nopener(\"firefox\");\nopener(\"npm run lint\");\n```\n\n## Use It for Good\n\nLike opening the user's browser with a test harness in your package's test script:\n\n```json\n{\n \"scripts\": {\n \"test\": \"opener ./test/runner.html\"\n },\n \"devDependencies\": {\n \"opener\": \"*\"\n }\n}\n```\n\n## Why\n\nBecause Windows has `start`, Macs have `open`, and *nix has `xdg-open`. At least\n[according to some guy on StackOverflow](http://stackoverflow.com/q/1480971/3191). And I like things that work on all\nthree. Like Node.js. And Opener.\n",
+ "_id": "opener@1.2.0",
+ "dist": {
+ "shasum": "cf70d00a43375f86d8789933fa2c99c3190212bd"
+ },
+ "_from": "git://github.com/isaacs/opener"
+}
View
6 package.json
@@ -68,7 +68,8 @@
"retry": "~0.6.0",
"couch-login": "~0.1.9",
"once": "~1.1.1",
- "npmconf": "0"
+ "npmconf": "0",
+ "opener": "git://github.com/isaacs/opener"
},
"bundleDependencies": [
"semver",
@@ -105,7 +106,8 @@
"retry",
"couch-login",
"once",
- "npmconf"
+ "npmconf",
+ "opener"
],
"devDependencies": {
"ronn": "~0.3.6",
@domenic

So due to this typo you'll want to update to the latest opener (see domenic/opener@5041021).

Please sign in to comment.
Something went wrong with that request. Please try again.