Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
Added some examples. use make examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Feb 26, 2010
1 parent 73b4aa1 commit 2bd9908
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ all: test
test:
@node spec/node.js

.PHONY: test
examples:
@node examples/run.js examples/list.yml
@node examples/run.js examples/list.nested.yml
@node examples/run.js examples/hash.yml
@node examples/run.js examples/config.yml

.PHONY: test examples
8 changes: 8 additions & 0 deletions examples/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
pid: '/home/www/pids/thin.pid'
wait: 30
port: 3000
timeout: 15
servers: 2
require: []

9 changes: 9 additions & 0 deletions examples/hash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
users:
tj:
name: 'tj'
age: 23
email: 'tj@vision-media.ca'
bob:
name: 'bob'
age: 27
8 changes: 8 additions & 0 deletions examples/list.nested.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
-
- 1
- 2
-
- 3
-
- 4
4 changes: 4 additions & 0 deletions examples/list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- 'milk'
- 'cookies'
- 'something'
13 changes: 13 additions & 0 deletions examples/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

var path = process.argv[2],
fs = require('fs'),
sys = require('sys'),
yaml = require('../lib/yaml')

if (!path)
throw new Error('provide path to yaml file')

sys.puts('\n')
sys.puts(fs.readFileSync(path))
sys.puts('\noutputs:\n')
sys.p(yaml.eval(fs.readFileSync(path)))

0 comments on commit 2bd9908

Please sign in to comment.