Skip to content

Commit

Permalink
Merge pull request #478 from anatoliychakkaev/master
Browse files Browse the repository at this point in the history
Man
  • Loading branch information
1602 committed Mar 20, 2013
2 parents f883f99 + 6045827 commit afb1495
Show file tree
Hide file tree
Showing 9 changed files with 548 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@ log/test.log
analyse-ab.r
log
tags.sh
man
53 changes: 47 additions & 6 deletions Makefile
@@ -1,14 +1,55 @@
# TESTS

TESTER = ./node_modules/.bin/mocha
OPTS = --require ./test/init.js
TESTS = test/*.test.js

test:
@./node_modules/.bin/mocha --require ./test/init.js test/*.test.js
$(TESTER) $(OPTS) $(TESTS)
test-verbose:
@./node_modules/.bin/mocha --reporter spec --require ./test/init.js test/*.test.js
$(TESTER) $(OPTS) --reporter spec $(TESTS)
testing:
./node_modules/.bin/mocha --watch --reporter min --require ./test/init.js --require should test/*.test.js
$(TESTER) $(OPTS) --watch $(TESTS)

# MAN DOCS

CLI_MAN = $(shell find docs/cli -name '*.md' \
|sed 's|.md|.1|g' \
|sed 's|docs/cli/|man/|g' )

API_MAN = $(shell find docs/api -name '*.md' \
|sed 's|.md|.3|g' \
|sed 's|docs/api/|man/|g' )

API_WEB = $(shell find docs/api -name '*.md' \
|sed 's|.md|.html|g' \
|sed 's|docs/api/|man/html/|g' )

man/%.1: docs/cli/%.md scripts/doc.sh
@[ -d man ] || mkdir man
scripts/doc.sh $< $@

man/%.3: docs/api/%.md scripts/doc.sh
@[ -d man ] || mkdir man
scripts/doc.sh $< $@

man/html/%.html: docs/api/%.md scripts/doc.sh
@[ -d man/html ] || mkdir -p man/html
scripts/doc.sh $< $@

MAN = $(API_MAN) $(CLI_MAN)

build: all

all: $(MAN) $(API_WEB)

man: $(MAN)

# WEBSITE DOCS

docs:
node docs/sources/build
apidocs:
makedoc lib/*.js lib/*/*.js -t "RailwayJS API docs" -g "1602/express-on-railway" --assets

.PHONY: test
.PHONY: doc
.PHONY: docs
.PHONY: test doc docs
19 changes: 18 additions & 1 deletion bin/compound.js
Expand Up @@ -46,12 +46,17 @@ process.nextTick(function () {
break;
}
}
var topic = args.shift();
if (topic) {
showMan(topic);
return;
}
var help = [
'Usage: compound command [argument(s)]\n',
'Commands:'
];
var commands = [
['h', 'help', 'Display usage information'],
['h', 'help [topic]', 'Display compound man page'],
['i', 'init', 'Initialize compound app'],
['g', 'generate [smth]', 'Generate something awesome']
];
Expand Down Expand Up @@ -102,4 +107,16 @@ process.nextTick(function () {

});

function showMan(topic) {
var manDir = require('path').resolve(__dirname + '/../man/man3');
require('child_process').spawn(
'man', [manDir + '/' + topic + '.3'],
{
customFds: [0, 1, 2],
env: process.env,
cwd: process.cwd()
}
);
}

/*vim ft:javascript*/
74 changes: 74 additions & 0 deletions docs/api/helpers.md
@@ -0,0 +1,74 @@
compound-helpers(3) - view helpers
==================================

## DESCRIPTION

Helpers produce html code. [Built-in][BUILT-IN HELPERS] helpers available in any
view. Custom helpers available in specific controller, see [CUSTOM HELPERS][]
section.

## BUILT-IN HELPERS

### stylesheetLinkTag(file1[, file2[, ...[, fileN]]])

Generates `<link rel="stylesheets" href="..." />` tag.
Following ejs:

<%- stylesheetLinkTag('reset', 'style', 'mobile') %>

will produce in develompent env:

<link rel="stylesheet" type="text/css" href="/stylesheets/reset.css" />
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css" />
<link rel="stylesheet" type="text/css" href="/stylesheets/mobile.css" />

and in production env:

<link rel="stylesheet" type="text/css" href="/stylesheets/cache/somehash.css" />

depending on `app.set('merge stylesheets');` option.

### javascriptIncludeTag
### linkTo
### contentFor
### anchor
### matcher
### icon
### imageTag
### csrfTag
### csrfMetaTag
### metaTag
### formFor
### fieldsFor
### errorMessagesFor
### formTag
### formTagBegin
### formTagEnd
### labelTag
### submitTag
### buttonTag
### selectTag
### optionTag

## FORM HELPERS

### begin
### end
### label
### select
### input
### file
### textarea
### checkbox
### submit

## CUSTOM HELPERS

There are two kind of custom helpers: application-wide and local. To define
custom helpers create *./app/helpers/application_helper.js* file. Local helpers
available only for specific controller, and should be located in
*./app/helpers/controllerName_helper.js* file.

## SEE ALSO

routing(3)
2 changes: 2 additions & 0 deletions docs/api/index.txt
@@ -0,0 +1,2 @@
# manuals
routing(3) routing

0 comments on commit afb1495

Please sign in to comment.