Permalink
Browse files

Rebrand to LiterAPI

  • Loading branch information...
1 parent 0facba8 commit 558e8c2e369911ad1a19bfbcf7118dfa4753bbb7 @agnoster committed Aug 7, 2012
Showing with 48 additions and 40 deletions.
  1. +1 −1 LICENSE
  2. +22 −14 README.md
  3. +4 −4 bin/wunderapi
  4. +9 −9 lib/index.js
  5. +8 −8 package.json
  6. +1 −1 test/README.md
  7. +1 −1 test/server.js
  8. +2 −2 test/test.js
View
@@ -1,4 +1,4 @@
-Copyright (C) 2011 by 6 Wunderkinder GmbH
+Copyright (C) 2012 by Isaac Wolkerstorfer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
@@ -1,18 +1,18 @@
-# WunderAPI
+# LiterAPI
-WunderAPI is a tool for defining, documenting, and testing an API by simply writing example API calls in a markdown document. It is currently intended only for testing APIs that return JSON, and are described in a Markdown file.
+LiterAPI is a tool for defining, documenting, and testing an API by simply writing example API calls in a markdown document. It is currently intended only for testing APIs that return JSON, and are described in a Markdown file.
-In essence, you write a couple examples in your doc/spec and - *BAM* - WunderAPI turns those into executable tests.
+In essence, you write a couple examples in your doc/spec and - *BAM* - LiterAPI turns those into executable tests.
## Installation
- npm install -g wunderapi
+ npm install -g literapi
(If you don't have [npm], you really should.)
## Usage
- wunderapi [API root URI] [testfile1] [testfile2] ...
+ literapi [API root URI] [testfile1] [testfile2] ...
## Example
@@ -33,7 +33,7 @@ If you had the file `example.md`:
Executing it like this:
- wunderapi http://api.example.com/v1/ example.md
+ literapi http://api.example.com/v1/ example.md
Would give the output:
@@ -46,11 +46,11 @@ Would give the output:
## Goals
-* **Be readable** - WunderAPI should guide people to make specs that can be read easily by people unfamiliar with the project, so they quickly know how to use the API. Much like Markdown itself, a WunderAPI spec document should be readable without running it through anything else
+* **Be readable** - LiterAPI should guide people to make specs that can be read easily by people unfamiliar with the project, so they quickly know how to use the API. Much like Markdown itself, a LiterAPI spec document should be readable without running it through anything else
* **Be fast** - Running tests isn't the funnest thing. Making it fast - which means running tests asynchronously - is the best way to make it fun to use
-* **Be easy** - While of course documentation is essential, it should be easy to write WunderAPI specs without thinking too much about the syntax. To that end, it hews as close to standard HTTP and other conventions from programming as possible.
+* **Be easy** - While of course documentation is essential, it should be easy to write LiterAPI specs without thinking too much about the syntax. To that end, it hews as close to standard HTTP and other conventions from programming as possible.
## Format
@@ -84,11 +84,11 @@ Acceptance criteria:
## Advanced Format
-Sometimes, literally matching the response just isn't powerful enough. For this reason, there are some extra tools that WunderAPI gives you.
+Sometimes, literally matching the response just isn't powerful enough. For this reason, there are some extra tools that LiterAPI gives you.
### Variables
-Any uppercase text enclosed in square brackets (such as `[USER_ID]` or `[AUTH_TOKEN]`) is considered a *variable*. Since WunderAPI is declarative, all instances of a variable must match. Here's an example:
+Any uppercase text enclosed in square brackets (such as `[USER_ID]` or `[AUTH_TOKEN]`) is considered a *variable*. Since LiterAPI is declarative, all instances of a variable must match. Here's an example:
We post a new status update:
@@ -142,7 +142,7 @@ This last response brings us to our next topic: globs
### Globs
-WunderAPI supports two kinds of globs: `*`, which matches any JSON value, and `...`, which matches any set of key-value pairs.
+LiterAPI supports two kinds of globs: `*`, which matches any JSON value, and `...`, which matches any set of key-value pairs.
The `*` glob is useful if you care that a value is there, but not what it is. It can be thought of as a variable that does not capture any value. For example, you might write:
@@ -154,15 +154,23 @@ The `*` glob is useful if you care that a value is there, but not what it is. It
In this instance, the response value would be required to have an `id` of 1, a `text` of "This entry was inserted previously", and a `created_at` field - however, the `created_at` field could be any value at all: a string, a number, a boolean, even an array or an object. If any of those fields were missing, we would get an error - but we would *also* get an error if any fields were returned that were not shown here.
-The `...` glob is useful for just the case where we want to ensure certain fields are set, but there may be other fields we don't care to enumerate. Caution should, however, be exercised - part of the value of WunderAPI specs is that a reader can have a good impression of the full extent of the API, and thus, even if the testing of particular fields is not necessary, being strict will both ensure greater understandability of the markdown *and* additional protection from unforseen consequences if the API changes in any way.
+The `...` glob is useful for just the case where we want to ensure certain fields are set, but there may be other fields we don't care to enumerate. Caution should, however, be exercised - part of the value of LiterAPI specs is that a reader can have a good impression of the full extent of the API, and thus, even if the testing of particular fields is not necessary, being strict will both ensure greater understandability of the markdown *and* additional protection from unforseen consequences if the API changes in any way.
+
+Example usage:
+
+ { "id": [USER_ID], "name": "Joe Schmoe", ... }
+
+The `...` glob may also be used at the beginning or end of an array, such as:
+
+ { "stream": ["first post!!!1", "second post", ...] }
## Contributing
-WunderAPI is licensed under an MIT License. Contributions and bug reports are welcome, please use Github for those purposes.
+LiterAPI is licensed under an MIT License. Contributions and bug reports are welcome, please use Github for those purposes.
### License
-Copyright (C) 2011 by 6 Wunderkinder GmbH
+Copyright (C) 2012 by Isaac Wolkerstorfer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
@@ -1,13 +1,13 @@
#!/usr/bin/env node
-var WunderAPI = require('wunderapi')
+var LiterAPI = require('literapi')
, vows = require('vows')
var params = process.argv.slice(2)
var options = { serial: true }
var usageMessage =
- "\n wunderapi [-vah] http://api.server:port/root file1 [file2 [...]]" +
+ "\n literapi [-vah] http://api.server:port/root file1 [file2 [...]]" +
"\n -v Show version number" +
"\n -a Show all results, not just errors" +
"\n -d Delay 100ms between calls (additional -d will double the delay)" +
@@ -17,7 +17,7 @@ while (params[0] && params[0][0] && params[0][0] == '-') { // option flag
for (var opt = params.shift(); opt = opt.slice(1); ) {
switch (opt[0]) {
case 'v':
- console.log(WunderAPI.getVersion())
+ console.log(LiterAPI.getVersion())
break
case 'p':
options.serial = false
@@ -71,7 +71,7 @@ var results = {
};
function runNext() {
- var api = new WunderAPI(options)
+ var api = new LiterAPI(options)
if (params.length < 1) {
checkIfDone()
return
View
@@ -1,6 +1,6 @@
var fs = require('fs')
-var WunderAPI = function(options) {
+var LiterAPI = function(options) {
if ('string' == typeof options) options = { root: options }
if (!options.compiler) options.compiler = 'vows'
if (!options.parser) options.parser = 'markdown'
@@ -10,22 +10,22 @@ var WunderAPI = function(options) {
this.parser = new (require('./parsers/' + options.parser)) (options)
}
-WunderAPI.getVersion = function() {
+LiterAPI.getVersion = function() {
var packageFile = require('path').resolve(__filename, '../../package.json')
return JSON.parse(fs.readFileSync(packageFile)).version
}
-WunderAPI.prototype = {}
+LiterAPI.prototype = {}
-WunderAPI.prototype.parse = function(src) {
+LiterAPI.prototype.parse = function(src) {
return this.parser.parse(src)
}
-WunderAPI.prototype.compile = function(parsed) {
+LiterAPI.prototype.compile = function(parsed) {
return this.compiler.compile(parsed)
}
-WunderAPI.prototype.callback = function(name, cb) {
+LiterAPI.prototype.callback = function(name, cb) {
var self = this
return function(err, result) {
if (err) return cb(err)
@@ -38,12 +38,12 @@ WunderAPI.prototype.callback = function(name, cb) {
}
}
-WunderAPI.prototype.parseFile = function(filename, cb) {
+LiterAPI.prototype.parseFile = function(filename, cb) {
fs.readFile(filename, 'utf8', this.callback('parse', cb))
}
-WunderAPI.prototype.compileFile = function(filename, cb) {
+LiterAPI.prototype.compileFile = function(filename, cb) {
this.parseFile(filename, this.callback('compile', cb))
}
-module.exports = WunderAPI
+module.exports = LiterAPI
View
@@ -1,17 +1,17 @@
-{ "name": "wunderapi"
-, "version": "0.0.9"
-, "description": "Test your APIs with stories written in Markdown"
-, "keywords": ["testing", "api"]
-, "homepage": "https://github.com/6wunderkinder/wunderapi"
-, "author": "Isaac Wolkerstorfer <isaac@6wunderkinder.com>"
+{ "name": "literapi"
+, "version": "0.0.10"
+, "description": "Literate testing for HTTP APIs using markdown"
+, "keywords": ["testing", "api", "rest"]
+, "homepage": "https://github.com/agnoster/literapi"
+, "author": "Isaac Wolkerstorfer <agnoster@gmail.com>"
, "main": "./lib/index.js"
, "repository":
{ "type": "git"
- , "url": "git://github.com/6wunderkinder/wunderapi.git"
+ , "url": "git://github.com/agnoster/literapi.git"
}
, "dirs": [ "lib", "test" ]
, "files": [ "LICENSE", "CHANGELOG.md", "README.md", "package.json" ]
-, "bin": "./bin/wunderapi"
+, "bin": "./bin/literapi"
, "preferGlobal": true
, "scripts":
{ "test": "node test/test.js"
View
@@ -1,6 +1,6 @@
# Example Tasks API
-This is an example of how to use WunderAPI to document and test your server. Here we have an example server that serves up a simple webservice that represents a task list.
+This is an example of how to use LiterAPI to document and test your server. Here we have an example server that serves up a simple webservice that represents a task list.
## List tasks
View
@@ -62,7 +62,7 @@ router.put(/\/tasks\/(\w+)/).bind(function (req, res, id, task) {
res.send(tasks.set(id, task))
})
router.del(/\/tasks\/(\w+)/).bind(function (req, res, id) {
- tasks.remove(id)
+// tasks.remove(id)
res.send(204)
})
View
@@ -1,9 +1,9 @@
var server = require('./server')
- , WunderAPI = require('../lib')
+ , LiterAPI = require('../lib')
var port = 74123
-var api = new WunderAPI(
+var api = new LiterAPI(
{ root: "http://localhost:" + port
, compiler: "vows"
, parser: "markdown"

0 comments on commit 558e8c2

Please sign in to comment.