0.7.3 • Published 11 years ago

listen-spawn v0.7.3

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

listen-spawn Donate on Gittip

Start a server to run commands when touched.

It was designed to allow for execution of semi-frequent commands but not on every save.

This is accomplished by being a generic HTTP server with the ability to write text editor specific plugins to ping the server.

Sublime Text 2 terminal

Sublime Text 2

Getting Started

Install the module globally with: npm install -g listen-spawn

# Navigate to your working directory
cd my_project

# Set up listen-spawn to run `npm test`
listen-spawn -- npm test # Listening at http://localhost:3000/ [...]

# In a separate process, curl the server to run `npm test` again
curl http://localhost:3000/ # > my_project@0.1.0 test [...]

Integrating with Sublime Text 2

I am still looking for a silent yet plugin-free solution. If really want a one-off plugin, please open a GitHub issue.

For the time being, the following shortcut invokes a curl request to http://localhost:3000/ when alt+x is pressed.

// Add the following to your "Key Bindings - User" inside the []
{ "keys": ["alt+x"], "command": "exec", "args": {"cmd": ["curl", "http://localhost:3000/"]} }

For the Windows users, please install MinGW (should be installed with msysgit) and add it to your PATH.

Documentation

listen-spawn installs a CLI endpoint via npm. It is good practice to always use -- to separate options from command as this can lead to unintended parsing.

$ listen-spawn
Usage: listen-spawn [options] -- command [args...]
Starts server and invokes command with arguments whenever touched.

Options:
  --port  Port to start server on  [default: 3000]

Examples

Run a specific test

$ listen-spawn -- mocha test/assert.js
20 Jun 04:17:58 - [listen-spawn] Listening at http://localhost:3000/
20 Jun 04:17:58 - [listen-spawn] Starting new process -- mocha test/assert.js

  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․

  42 tests complete (16 ms)

20 Jun 04:17:58 - [listen-spawn] App exited cleanly

Script testing a browser launcher

$ listen-spawn -- node example/launch.js
20 Jun 04:20:25 - [listen-spawn] Listening at http://localhost:3000/
20 Jun 04:20:25 - [listen-spawn] Starting new process -- node example/launch.js
Starting browser
[...]

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test.

License

Copyright (c) 2013 Todd Wolfson

Licensed under the MIT license.

0.7.3

11 years ago

0.7.2

11 years ago

0.7.1

11 years ago

0.7.0

11 years ago

0.6.1

11 years ago

0.6.0

11 years ago

0.5.0

11 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.0

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago