Permalink
Browse files

Updated installation instructions

  • Loading branch information...
1 parent d9bc31e commit 94af0e16712ec96367cf54802ff5ad0769274226 @assaf committed Dec 25, 2012
Showing with 167 additions and 82 deletions.
  1. +70 −0 doc/new/README.md
  2. +29 −26 package.json
  3. +3 −48 scripts/docs
  4. +59 −0 scripts/markdown.coffee
  5. +6 −8 scripts/{server.coffee → server}
View
@@ -1,6 +1,76 @@
# Zombie.js
+## The Bite
+
+If you're going to write an insanely fast, headless browser, how can you not
+call it Zombie? Zombie it is.
+
+Zombie.js is a lightweight framework for testing client-side JavaScript code in
+a simulated environment. No browser required.
+
+Let's try to sign up to a page and see what happens:
+
+```js
+var Browser = require("zombie");
+var assert = require("assert");
+
+// Load the page from localhost
+browser = Browser.create()
+browser.visit("http://localhost:3000/", function (error) {
+
+ // Fill email, password and submit form
+ browser.
+ fill("email", "zombie@underworld.dead").
+ fill("password", "eat-the-living").
+ pressButton("Sign Me Up!", function() {
+
+ // Form submitted, new page loaded.
+ browser.assert.success();
+ browser.assert.text("title", "Welcome To Brains Depot");
+
+ });
+
+});
+```
+
+Well, that was easy.
+
+
+## Installing
+
+To install Zombie.js you will need [Node.js](http://nodejs.org/) 0.8 or later,
+[NPM](https://npmjs.org/), a [C++ toolchain and
+Python](https://github.com/TooTallNate/node-gyp).
+
+One-click installers for Windows, OS X, Linux and SunOS are available directly
+from the [Node.js site](http://nodejs.org/download/).
+
+On OS X you can download the full XCode from the Apple Store, or install the
+[OSX GCC toolchain](https://github.com/kennethreitz/osx-gcc-installer) directly
+(smaller download).
+
+You can also install Node and NPM using the wonderful
+[Homebrew](http://mxcl.github.com/homebrew/) (if you're serious about developing
+on the Mac, you should be using Homebrew):
+
+```sh
+$ brew install node
+$ node --version
+v0.8.16
+$ npm --version
+1.1.69
+$ npm install zombie
+```
+
+On Windows you will need to install a recent version of Python and Visual
+Studio. See [node-gyp for specific installation
+instructions](https://github.com/TooTallNate/node-gyp) and
+[Chocolatey](http://chocolatey.org/) for easy package management.
+
+
+
+
## Browser
#### browser.assert
View
@@ -1,56 +1,59 @@
-{ "name": "zombie",
- "version": "2.0.0-alpha11",
- "description": "Insanely fast, full-stack, headless browser testing using Node.js",
- "homepage": "http://zombie.labnotes.org/",
- "author": "Assaf Arkin <assaf@labnotes.org> (http://labnotes.org/)",
+{ "name": "zombie",
+ "version": "2.0.0-alpha11",
+ "description": "Insanely fast, full-stack, headless browser testing using Node.js",
+ "homepage": "http://zombie.labnotes.org/",
+ "author": "Assaf Arkin <assaf@labnotes.org> (http://labnotes.org/)",
"contributors": [
"Bob Lail <bob.lailfamily@gmail.com> (http://boblail.tumblr.com/)",
"Brian McDaniel (https://github.com/brianmcd)",
"Damian Janowski",
"José Valim <jose.valim@plataformatec.com.br> (http://blog.plataformatec.com.br/)"
],
- "keywords": [ "test", "tests", "testing", "TDD", "spec", "specs", "BDD", "headless", "browser",
- "html", "html5", "dom", "css", "javascript", "integration", "ajax", "full-stack", "DSL" ],
- "main": "lib/zombie",
+ "keywords": [
+ "test", "tests", "testing", "TDD", "spec", "specs", "BDD", "headless", "browser",
+ "html", "html5", "dom", "css", "javascript", "integration", "ajax", "full-stack",
+ "DSL"
+ ],
+ "main": "lib/zombie",
"scripts": {
"prepublish": "./scripts/clean && ./scripts/build",
"postpublish": "./scripts/publish",
"test": "./node_modules/.bin/mocha"
},
"engines": {
- "node": ">= 0.8.0"
+ "node": ">= 0.8.0"
},
"dependencies": {
- "contextify": "~0.1.3",
- "eventsource": "~0.0.5",
- "html5": "~0.3.8",
- "jsdom": "~0.2.19",
- "mime": "~1.2.7",
- "ms": "~0.5.0",
- "q": "~0.8.10",
- "request": "~2.12.0",
- "tough-cookie": "~0.9.14",
- "ws": "~0.4.22"
+ "contextify": "~0.1.3",
+ "eventsource": "~0.0.5",
+ "html5": "~0.3.8",
+ "jsdom": "~0.2.19",
+ "mime": "~1.2.7",
+ "ms": "~0.5.0",
+ "q": "~0.8.11",
+ "request": "~2.12.0",
+ "tough-cookie": "~0.9.14",
+ "ws": "~0.4.25"
},
"devDependencies": {
"coffee-script": "~1.4.0",
- "express": "~3.0.3",
+ "express": "~3.0.5",
"node-syntaxhighlighter": "~0.8.1",
- "mocha": "~1.7.0",
+ "mocha": "~1.7.4",
"replay": "~1.6.0",
- "requirejs": "~2.1.1",
+ "requirejs": "~2.1.2",
"robotskirt": "~2.7.1"
},
"repository": {
- "type": "git",
- "url": "http://github.com/assaf/zombie"
+ "type": "git",
+ "url": "http://github.com/assaf/zombie"
},
"bugs": {
- "url": "http://github.com/assaf/zombie/issues"
+ "url": "http://github.com/assaf/zombie/issues"
},
"licenses": [
{ "type": "MIT",
- "url": "http://github.com/assaf/zombie/blob/master/MIT-LICENSE"
+ "url": "http://github.com/assaf/zombie/blob/master/MIT-LICENSE"
}
]
}
View
@@ -20,7 +20,7 @@
{ execFile, exec } = require("child_process")
File = require("fs")
Path = require("path")
-Robotskirt = require("robotskirt")
+render = require("./markdown")
DOC_DIR = Path.resolve("#{__dirname}/../doc/new")
@@ -37,55 +37,10 @@ prepareEmptyDirectory = (callback)->
# Generate the HTML file (Markdown, header IDs and layout)
generateHTML = (callback)->
console.log "Generating index.html ..."
-
- File.readFile "#{DOC_DIR}/layout.html", "utf8", (error, layout)->
+ render "#{DOC_DIR}/README.md", "#{DOC_DIR}/layout.html", (error, html)->
if error
callback(error)
- return
-
- File.readFile "#{DOC_DIR}/README.md", "utf8", (error, markdown)->
- if error
- callback(error)
- return
-
- NSH = require("node-syntaxhighlighter")
-
- NSH_OPTIONS =
- "auto-links": false
- "class-name": "code"
- "gutter": false
- "toolbar": false
-
- ROBOTSKIRT_OPTIONS = [
- Robotskirt.EXT_TABLES
- Robotskirt.EXT_AUTOLINK
- Robotskirt.EXT_FENCED_CODE
- ]
-
- # Render to HTML with syntax highlighting
- renderer = new Robotskirt.HtmlRenderer()
- renderer.blockcode = (code, language)->
- if language
- nshLanguage = NSH.getLanguage(language)
- if nshLanguage
- return NSH.highlight(code, nshLanguage, NSH_OPTIONS)
- else
- return "<pre>" + Robotskirt.houdini.escapeHTML(code) + "</pre>"
-
- # Parse Markdown with support for tables, autolinking and fenced code blocks
- parser = new Robotskirt.Markdown(renderer, ROBOTSKIRT_OPTIONS)
- content = parser.render(markdown)
-
- # http://daringfireball.net/projects/smartypants/
- content = Robotskirt.smartypantsHtml(content)
-
- # Add IDs for all headers so they can be references
- addIDToHeader = (match, level, textContent)->
- id = textContent.replace(/\s+/, "_").toLowerCase()
- return "<h#{level} id=\"#{id}\">#{textContent}</h#{level}>"
- content = content.replace(/<h([1-3])>(.*)<\/h[1-3]>/g, addIDToHeader)
-
- html = layout.replace("{content}", content)
+ else
File.writeFile("#{HTML_DIR}/index.html", html, callback)
View
@@ -0,0 +1,59 @@
+File = require("fs")
+NSH = require("node-syntaxhighlighter")
+Robotskirt = require("robotskirt")
+
+
+NSH_OPTIONS =
+ "auto-links": false
+ "class-name": "code"
+ "gutter": false
+ "toolbar": false
+
+ROBOTSKIRT_OPTIONS = [
+ Robotskirt.EXT_TABLES
+ Robotskirt.EXT_AUTOLINK
+ Robotskirt.EXT_FENCED_CODE
+]
+
+
+# Render the Markdown file using the given HTML layout file. Pass error or HTML
+# to callback.
+render = (markdownFilename, layoutFilename, callback)->
+ File.readFile markdownFilename, "utf8", (error, markdown)->
+ if error
+ callback(error)
+ return
+
+ File.readFile layoutFilename, "utf8", (error, layout)->
+ if error
+ callback(error)
+ return
+
+ # Render to HTML with syntax highlighting
+ renderer = new Robotskirt.HtmlRenderer()
+ renderer.blockcode = (code, language)->
+ if language
+ nshLanguage = NSH.getLanguage(language)
+ if nshLanguage
+ return NSH.highlight(code, nshLanguage, NSH_OPTIONS)
+ else
+ return "<pre>" + Robotskirt.houdini.escapeHTML(code) + "</pre>"
+
+ # Parse Markdown with support for tables, autolinking and fenced code blocks
+ parser = new Robotskirt.Markdown(renderer, ROBOTSKIRT_OPTIONS)
+ content = parser.render(markdown)
+
+ # http://daringfireball.net/projects/smartypants/
+ content = Robotskirt.smartypantsHtml(content)
+
+ # Add IDs for all headers so they can be references
+ addIDToHeader = (match, level, textContent)->
+ id = textContent.replace(/\s+/, "_").toLowerCase()
+ return "<h#{level} id=\"#{id}\">#{textContent}</h#{level}>"
+ content = content.replace(/<h([1-3])>(.*)<\/h[1-3]>/g, addIDToHeader)
+
+ html = layout.replace("{content}", content)
+ callback(null, html)
+
+
+module.exports = render
@@ -13,24 +13,22 @@
# the file system.
-Express = require("express")
-{ execFile } = require("child_process")
-File = require("fs")
-Path = require("path")
+Express = require("express")
+render = require("./markdown")
+File = require("fs")
+Path = require("path")
-DOC_DIR = Path.resolve("#{__dirname}/../doc/new")
+DOC_DIR = Path.resolve("#{__dirname}/../doc/new")
server = Express()
server.get "/", (req, res)->
- layout = File.readFileSync("#{DOC_DIR}/layout.html").toString()
- execFile "markdown", ["#{DOC_DIR}/README.md"], {}, (error, stdout, stderr)->
+ render "#{DOC_DIR}/README.md", "#{DOC_DIR}/layout.html", (error, html)->
if error
res.send(500, error.message)
else
- html = layout.replace("{content}", stdout)
res.send(html)
server.get "/*", (req, res)->

0 comments on commit 94af0e1

Please sign in to comment.