Permalink
Browse files

Move plugins and routes doc from read me back to the source

  • Loading branch information...
1 parent 777fd5f commit 8519ed3ee603e1c188bb193e693ceda01dc495bb @wdavidw wdavidw committed Mar 21, 2012
View
218 README.md
@@ -224,224 +224,6 @@ app.cmd('user :id([0-9]+)', function(req, res) {
});
```
-## History plugin
-
-Persistent command history over multiple sessions. Options passed during creation are:
-
-- `shell` , (required) A reference to your shell application.
-- `name` , Identify your project history file, default to the hash of the exectuted file
-- `dir` , Location of the history files, defaults to `"#{process.env['HOME']}/.node_shell"`
-
-## Completer plugin
-
-Provides tab completion. Options passed during creation are:
-
-- `shell` , (required) A reference to your shell application.
-
-## Help plugin
-
-Display help when the user types "help" or runs commands without arguments. Command help is only displayed if a description was provided during the command registration.
-
-Additionnaly, a new `shell.help()` function is made available. Options passed during creation are:
-
-- `shell` , (required) A reference to your shell application.
-- `introduction` , Print message 'Type "help" or press enter for a list of commands' if boolean `true`, or a custom message if a `string`
-
-## HTTP server
-
-Register two commands, `http start` and `http stop`. The start command will search for "./server.js" and "./app.js" (and additionnaly their CoffeeScript alternatives) to run by `node`.The following properties may be provided as settings:
-
-- `config` , Path to the configuration file. Required to launch redis.
-- `attach` , Wether the HTTP process should be attached to the current process. If not defined, default to `false` (the server run as a daemon).
-- `pidfile` , Path to the file storing the daemon process id. Defaults to `"/.node_shell/#{md5}.pid"`
-- `stdout` , Writable stream or file path to redirect the server stdout.
-- `stderr` , Writable stream or file path to redirect the server stderr.
-- `workspace`, Project directory used to resolve relative paths and search for "server" and "app" scripts.
-
-Example:
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
- app.use(shell.http({
- shell: app
- }));
- app.use(shell.help({
- shell: app,
- introduction: true
- }));
-});
-```
-
-## Redis plugin
-
-Register two commands, `redis start` and `redis stop`. The following properties may be provided as settings:
-
-- `config` , Path to the configuration file. Required to launch redis.
-- `attach` , Wether the Redis process should be attached to the current process. If not defined, default to `false` (the server run as a daemon).
-- `pidfile` Path to the file storing the daemon process id. Defaults to `"/.node_shell/#{md5}.pid"`
-- `stdout` , Writable stream or file path to redirect cloud9 stdout.
-- `stderr` , Writable stream or file path to redirect cloud9 stderr.
-
-Example:
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
- app.use(shell.redis({
- shell: app,
- config: __dirname+'/redis.conf')
- }));
- app.use(shell.help({
- shell: app,
- introduction: true
- }));
-});
-```
-
-## Cloud9 plugin
-
-Register two commands, `cloud9 start` and `cloud9 stop`. Unless provided, the Cloud9 workspace will be automatically discovered if your project root directory contains a "package.json" file or a "node_module" directory.
-
-Options:
-
-- `config` , Load the configuration from a config file. Overrides command-line options. Defaults to `null`.
-- `group` , Run child processes with a specific group.
-- `user` , Run child processes as a specific user.
-- `action` , Define an action to execute after the Cloud9 server is started. Defaults to `null`.
-- `ip` , IP address where Cloud9 will serve from. Defaults to `"127.0.0.1"`.
-- `port` , Port number where Cloud9 will serve from. Defaults to `3000`.
-- `workspace`, Path to the workspace that will be loaded in Cloud9, Defaults to `Shell.set('workspace')`.
-- `attach` , Wether the Cloud9 process should be attached to the current process. If not defined, default to `false` (the server run as a daemon).
-- `pidfile` Path to the file storing the daemon process id. Defaults to `"/.node_shell/#{md5}.pid"`
-- `stdout` , Writable stream or file path to redirect cloud9 stdout.
-- `stderr` , Writable stream or file path to redirect cloud9 stderr.
-
-Example:
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
- app.use(shell.cloud9({
- shell: app,
- ip: '0.0.0.0'
- }));
- app.use(shell.help({
- shell: app,
- introduction: true
- }));
-});
-```
-
-**Important:** If you encounter issue while installing cloud9, it might be because the npm module expect an older version of Node.
-
-Here's the procedure to use the latest version:
-
-```
-git clone https://github.com/ajaxorg/cloud9.git
-cd cloud9
-git submodule update --init --recursive
-npm link
-```
-
-## CoffeeScript plugin
-
-Start Coffee in `--watch` mode, so scripts are instantly compiled into Javascript.
-
-Options:
-
-- `src` , Directory where ".coffee" are stored. Each ".coffee" script will be compiled into a .js JavaScript file of the same name.
-- `output` Directory where compiled JavaScript files are written. Used in conjunction with "compile".
-- `lint` , If the `jsl` (JavaScript Lint) command is installed, use it to check the compilation of a CoffeeScript file.
-- `require` , Load a library before compiling or executing your script. Can be used to hook in to the compiler (to add Growl notifications, for example).
-- `attach` , Wether the Coffee process should be attached to the current process. If not defined, default to `false` (the server run as a daemon).
-- `pidfile` , Path to the file storing the daemon process id. Defaults to `"/.node_shell/#{md5}.pid"`
-- `stdout` , Writable stream or file path to redirect cloud9 stdout.
-- `stderr` , Writable stream or file path to redirect cloud9 stderr.
-- `workspace`, Project directory used to resolve relative paths.
-
-Example:
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
- app.use(shell.coffee({
- shell: app
- }));
- app.use(shell.help({
- shell: app,
- introduction: true
- }));
-});
-```
-
-## Prompt route
-
-The `prompt` route is a convenient function to stop command once a few routes are executed. You can simply pass the the `shell.routes.prompt` function or call it with a message argument.
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
-});
-app.cmd('install', [
- my_app.routes.download,
- my_app.routes.configure,
- shell.routes.prompt('Installation is finished')
-]);
-```
-
-## Confirm route
-
-The `confirm` route ask the user if he want to continue the process. If the answer is `true`, the following routes are executed. Otherwise, the process is stoped.
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
-});
-app.cmd('install', [
- shell.routes.confirm('Do you confirm?'),
- my_app.routes.download,
- my_app.routes.configure
-]);
-```
-
-## Timeout route
-
-The `timeout` route will wait for the provided period (in millisenconds) before executing the following route.
-
-```javascript
-var app = new shell();
-app.configure(function() {
- app.use(shell.router({
- shell: app
- }));
-});
-app.cmd('restart', [
- my_app.routes.stop,
- shell.routes.timeout(1000),
- my_app.routes.start
-]);
-```
-
-
Contributors
------------
View
@@ -1,6 +1,60 @@
start_stop = require '../start_stop'
+###
+
+Cloud9 plugin
+=============
+
+Register two commands, `cloud9 start` and `cloud9 stop`. Unless provided,
+the Cloud9 workspace will be automatically discovered if your project root
+directory contains a "package.json" file or a "node_module" directory.
+
+Options:
+
+- `config` , Load the configuration from a config file. Overrides command-line options. Defaults to `null`.
+- `group` , Run child processes with a specific group.
+- `user` , Run child processes as a specific user.
+- `action` , Define an action to execute after the Cloud9 server is started. Defaults to `null`.
+- `ip` , IP address where Cloud9 will serve from. Defaults to `"127.0.0.1"`.
+- `port` , Port number where Cloud9 will serve from. Defaults to `3000`.
+- `workspace`, Path to the workspace that will be loaded in Cloud9, Defaults to `Shell.set('workspace')`.
+- `attach` , Wether the Cloud9 process should be attached to the current process. If not defined, default to `false` (the server run as a daemon).
+- `pidfile` , Path to the file storing the daemon process id. Defaults to `"/.node_shell/#{md5}.pid"`
+- `stdout` , Writable stream or file path to redirect cloud9 stdout.
+- `stderr` , Writable stream or file path to redirect cloud9 stderr.
+
+Example:
+
+```javascript
+var app = new shell();
+app.configure(function() {
+ app.use(shell.router({
+ shell: app
+ }));
+ app.use(shell.cloud9({
+ shell: app,
+ ip: '0.0.0.0'
+ }));
+ app.use(shell.help({
+ shell: app,
+ introduction: true
+ }));
+});
+```
+
+**Important:** If you encounter issue while installing cloud9, it might be because the npm module expect an older version of Node.
+
+Here's the procedure to use the latest version:
+
+```
+git clone https://github.com/ajaxorg/cloud9.git
+cd cloud9
+git submodule update --init --recursive
+npm link
+```
+
+###
module.exports = (settings = {}) ->
cmd = () ->
args = []
View
@@ -14,16 +14,41 @@ enrichFiles = (files) ->
###
-Coffee plugin
--------------
-Start/stop a daemon to watch and convert coffee files to js.
+CoffeeScript plugin
+===================
-Options include:
-* `join` Before compiling, concatenate all scripts together in the order they were passed, and write them into the specified file. Useful for building large projects.
-* `lint` If the jsl (JavaScript Lint) command is installed, use it to check the compilation of a CoffeeScript file. (Handy in conjunction with --watch)
-* `require` Load a library before compiling or executing your script. Can be used to hook in to the compiler (to add Growl notifications, for example).
-* `output` Write out all compiled JavaScript files into the specified directory. Use in conjunction with --compile or --watch.
-* `compile` Compile a .coffee script into a .js JavaScript file of the same name.
+Start Coffee in `--watch` mode, so scripts are instantly compiled into Javascript.
+
+Options:
+
+- `src` , Directory where ".coffee" are stored. Each ".coffee" script will be compiled into a .js JavaScript file of the same name.
+- `join` , Before compiling, concatenate all scripts together in the order they were passed, and write them into the specified file. Useful for building large projects.
+- `output` , Directory where compiled JavaScript files are written. Used in conjunction with "compile".
+- `lint` , If the `jsl` (JavaScript Lint) command is installed, use it to check the compilation of a CoffeeScript file.
+- `require` , Load a library before compiling or executing your script. Can be used to hook in to the compiler (to add Growl notifications, for example).
+- `attach` , Wether the Coffee process should be attached to the current process. If not defined, default to `false` (the server run as a daemon).
+- `pidfile` , Path to the file storing the daemon process id. Defaults to `"/.node_shell/#{md5}.pid"`
+- `stdout` , Writable stream or file path to redirect cloud9 stdout.
+- `stderr` , Writable stream or file path to redirect cloud9 stderr.
+- `workspace`, Project directory used to resolve relative paths.
+
+Example:
+
+```javascript
+var app = new shell();
+app.configure(function() {
+ app.use(shell.router({
+ shell: app
+ }));
+ app.use(shell.coffee({
+ shell: app
+ }));
+ app.use(shell.help({
+ shell: app,
+ introduction: true
+ }));
+});
+```
###
module.exports = (settings = {}) ->
@@ -1,4 +1,14 @@
+###
+
+Completer plugin
+================
+
+Provides tab completion. Options passed during creation are:
+
+- `shell` , (required) A reference to your shell application.
+
+###
module.exports = (settings) ->
# Validation
throw new Error 'No shell provided' if not settings.shell
View
@@ -1,6 +1,30 @@
pad = require 'pad'
+###
+
+Help Plugin
+-----------
+
+Display help when the user types "help" or runs commands without arguments.
+Command help is only displayed if a description was provided during the
+command registration. Additionnaly, a new `shell.help()` function is made available.
+
+Options passed during creation are:
+
+- `shell` , (required) A reference to your shell application.
+- `introduction` , Print message 'Type "help" or press enter for a list of commands' if boolean `true`, or a custom message if a `string`
+
+Usage
+
+ app = shell()
+ app.configure ->
+ app.use shell.router shell: app
+ app.use shell.help
+ shell: app
+ introduction: true
+
+###
module.exports = (settings) ->
# Validation
throw new Error 'No shell provided' if not settings.shell
Oops, something went wrong.

0 comments on commit 8519ed3

Please sign in to comment.