Permalink
Browse files

First NPM release.

Started working on documentation site.

Added cake setup to get you up and running with development
dependencies.

Remove Vows as runtime dependency.  Use whichever framework you
like.  Moved sizzle.js from dep to vendor.  Moved scripts used
during tests to spec/.scripts.
  • Loading branch information...
1 parent 4c15009 commit 2f9b7ee68706f1bb57396f90f396f16ec35a13ca @assaf committed Dec 21, 2010
View
@@ -1,2 +1,3 @@
.npm
+node_modules
html
View
@@ -1,3 +1,19 @@
+Version 0.6.2 2010-12-21
+
+ First NPM release.
+
+ Started working on documentation site.
+
+ Added cake setup to get you up and running with development dependencies.
+
+ Remove Vows as runtime dependency. Use whichever framework you like. Moved
+ sizzle.js from dep to vendor. Moved scripts used during tests to
+ spec/.scripts.
+
+ 178 tests.
+ 1.8 sec to complete.
+
+
Version 0.6.1 2010-12-20
Changed browser.cookies from getter to function that accepts cookie domain
View
@@ -1,6 +1,7 @@
fs = require("fs")
path = require("path")
{spawn, exec} = require("child_process")
+markdown = require("node-markdown").Markdown
# ANSI Terminal Colors.
bold = "\033[0;1m"
@@ -12,27 +13,90 @@ reset = "\033[0m"
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
-task "doc:source", "Builds source documentation", ->
- log "Documenting source files", green
- exec "docco lib/**/*.coffee && mv -f docs/* html/ && rm -rf docs", (err) -> throw err if err
+task "clean", "Remove temporary files and such", ->
+ exec "rm -rf html"
+
+
+# Setup
+# -----
+
+# Setup development dependencies, not part of runtime dependencies.
+task "setup", "Install development dependencies", ->
+ log "Need Vows and Express to run test suite, installing ...", green
+ exec "npm install \"vows@>=0.\"5"
+ exec "npm install \"express@>=1.0\""
+ log "Need Ronn and Docco to generate documentation, installing ...", green
+ exec "npm install \"ronn@>=0.3\""
+ exec "npm install \"docco@>=0.3\""
+ log "Need runtime dependencies, installing ...", green
+ fs.readFile "package.json", "utf8", (err, package)->
+ for name, version of JSON.parse(package).dependencies
+ exec "npm install \"#{name}@#{version}\""
-task "doc:readme", "Build README file", ->
- markdown = require("node-markdown").Markdown
+
+# Documentation
+# -------------
+
+# Markdown to HTML.
+toHTML = (source, callback)->
+ target = "html/#{path.basename(source, ".md").toLowerCase()}.html"
+ title = path.basename(source, ".md").replace("_", " ")
fs.mkdir "html", 0777, ->
- fs.readFile "README.md", "utf8", (err, text)->
- log "Creating html/index.html", green
- exec "ronn --html README.md", (err, stdout, stderr)->
+ fs.readFile "doc/_layout.html", "utf8", (err, layout)->
+ fs.readFile source, "utf8", (err, text)->
throw err if err
- fs.writeFile "html/index.html", stdout, "utf8"
+ log "Creating #{target} ...", green
+ exec "ronn --html #{source}", (err, stdout, stderr)->
+ throw err if err
+ title = stdout.match(/<h1>(.*)<\/h1>/)[1]
+ html = layout.replace("{{body}}", stdout).replace(/{{title}}/g, title).replace(/<h1>.*<\/h1>/, "")
+ fs.writeFile target, html, "utf8"
+ callback target if callback
+
+task "doc:source", ->
+ log "Documenting source files ...", green
+ exec "docco lib/**/*.coffee", (err) ->
+ throw err if err
+ log "Copying to html/source ...", green
+ exec "mkdir -p html && cp -rf docs/ html/source && rm -rf docs"
+
+task "doc:pages", ->
+ toHTML "README.md", ->
+ exec "mv html/readme.html html/index.html"
+ "index.html"
+ toHTML "TODO.md"
+ exec "cp -f doc/*.css html/"
task "doc", "Generate documentation", ->
- invoke "doc:readme"
+ invoke "doc:pages"
invoke "doc:source"
+
+# Testing
+# -------
+
task "test", "Run all tests", ->
exec "vows --spec", (err, stdout, stderr)->
- console.log stdout
- console.error stderr
+ log stdout, green
+ log stderr, red
-task "clean", "Remove temporary files and such", ->
- exec "rm -rf html"
+
+# Publishing
+# ----------
+
+task "doc:publish", ->
+ log "Uploading documentation ...", green
+ exec "rsync -cr --del --progress html/ labnotes.org:/var/www/zombie/"
+
+task "publish", "Publish new version (Git, NPM, site)", ->
+ fs.readFile "package.json", "utf8", (err, package)->
+ version = JSON.parse(package).version
+ log "Tagging v#{version} ...", green
+ exec "git tag v#{version}", ->
+ exec "git push"
+
+ log "Publishing in NPM ...", green
+ invoke "clean" # Need to rid of all the crap, or it gets included
+ invoke "npm publish"
+
+ invoke "doc:publish"
View
@@ -20,44 +20,88 @@ Using
Coming.
+See the documentation for [Sizzle.js](https://github.com/jeresig/sizzle/wiki).
-Feeding
--------
+[Source code/API Documentation](source/browser.html)
-See the documentation for [Sizzle.js](https://github.com/jeresig/sizzle/wiki).
+Guts
+----
+
+Zombie.js is written in
+[CoffeeScript](http://jashkenas.github.com/coffee-script/), a language
+that mixes the best parts of Python and Ruby and compiles one-to-one
+into JavaScript.
+
+To get started hacking on Zombie.js you'll need Node.js, NPM and
+CoffeeScript:
+
+ $ brew install node npm
+ $ npm install coffee-script
+
+Next, install all other development and runtime dependencies:
+
+ $ cake setup
-Bleeding Edge
--------------
+The DOM implementation is [JSDOM](http://jsdom.org/), which provides
+pretty decent emulation of DOM Level 3. There are some issues and some
+features Zombie.js needs but JSDOM doesn't care for (e.g default event
+handlers). Those are patched onto JSDOM in
+`lib/zombie/jsdom_patches.coffee` and `lib/zombie/forms.coffee`.
-For a full list of runtime dependencies, see [package.json](https://github.com/assaf/zombie/blob/master/package.json).
+DOM selectors are provided by [Sizzle.js](http://sizzlejs.com/), and
+vendored in the `vendor` directory.
-The test suite requires [Vows 0.5.x](http://vowsjs.org/) and [Express 1.0.x](http://expressjs.com/):
+Zombie.js is tested using [Vows](http://vowsjs.org/). Since we're
+testing a Web browser, we also need a Web server, so it spins up an
+instance of [Express](http://expressjs.com/). Spinning up Express and
+making sure it doesn't power down before all tests are done (Vows is
+asynchronous, like everything in Node) is the responsibility of
+`spec/helper.coffee`.
- $ npm install vows
- $ npm install express
- $ cake test
+To run the test suite:
-For documentation you'll need [Ronn 0.3.x](https://github.com/kapouer/ronnjs) and [Docco 0.3](http://jashkenas.github.com/docco/):
+ $ vows
- $ npm install ronn
- $ npm install docco
+To stress Zombie.js, we have test cases that use Sammy.js and jQuery.
+The scripts themselves are contained in the `spec/.scripts` directory.
+The dot is necessary to hide these JS files from Vows.
+Zombie.js documentation is written in
+[Markdown](http://daringfireball.net/projects/markdown/syntax#code).
+
+Everything you need to know to get started is covered by `README.md`, so
+it shows up when you visit the [Github
+page](http://github.com/assaf/zombie).
+
+Additional documentation lives in the `doc` directory. Annotated source
+code generated using [Docco](http://jashkenas.github.com/docco/).
+
+To generate the documentation
+
+ $ cake doc
+ $ open html/index.html
+
+
+Feeding
+-------
-Contributing
-------------
+* Find [assaf/zombie on Github](http://github.com/assaf/zombie)
+* Fork the project
+* Add tests
+* Make your changes
+* Send a pull request
-* Fork the project.
-* Add tests.
-* Make your changes.
-* Send me a pull request.
+Check out the outstanding [to-dos](todo.html).
Brains
------
Zombie.js is copyright of [Assaf Arkin](http://labnotes.org), released under the MIT License.
-Zombie.js is written in [CoffeeScript](http://jashkenas.github.com/coffee-script/).
+Zombie.js is written in
+[CoffeeScript](http://jashkenas.github.com/coffee-script/) for
+[Node.js](http://nodejs.org/).
[Sizzle.js](http://sizzlejs.com/) is copyright of John Resig, released under the MIT, BSD and GPL.
View
32 TODO.md
@@ -1,4 +1,7 @@
-- Use HTML5 parser (see https://github.com/aredridel/html5)
+TODO
+====
+
+* Use HTML5 parser (see https://github.com/aredridel/html5)
HTML5 parser can deal with many more documents (e.g. missing html/body
elements) than html-parser, and obviously new HTML5 elements.
@@ -7,14 +10,19 @@
content; JSDOM listens to the DOMNodeInsertedIntoDocument event, which is
fired on empty script element.
-- brower.location set should evaluate javascript: links
-- Browser open should create new window
-- Browser close should close existing window
-- Send unload event when loading new page
-- Browser.clock should be set from current time
-- Date should use browser clock
-- Allow setting of timezone in browser
-- Allow setting of user agent in browser
-- Browser sends user agent on download/XHR
-- Handle confirm/alert
-- Mock resources
+* Navigation: Browser.open/close should work as a pair; look into supporting
+ window.open; fire unload event when navigating away from page.
+
+* Send unload event when navigating away from page.
+
+* Time and timezone: within window context, new Date() should use browser clock
+ and timezone; allow changing browser timezone and default to system's.
+
+* User agent: allow setting of user agent; brower sends user agent in all
+ requests (pages, forms and XHR).
+
+* Prompts: handle window.confirm and window.alert.
+
+* Enhance DOM with find/filter/html/text methods on elements and node lists.
+
+* Documentation.
View
@@ -1,9 +0,0 @@
-Sammy("body", function(app) {
- app.get("#/", function(context) {
- context.swap("The Living");
- });
- app.get("#/dead", function(context) {
- context.swap("The Living Dead");
- });
-});
-$(function() { Sammy("body").run("#/") });
View
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>{{title}}</title>
+ <link href="screen.css" media="screen,projection" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+ <div class="title"><a href="/">Zombie.js</a></div>
+ <h1>{{title}}</h1>
+ <div id="content">{{body}}</div>
+ </body>
+</html>
View
@@ -0,0 +1,28 @@
+body {
+ font-family: Baskerville, Palatino, "Palatino Linotype", Georgia, serif;
+ font-size: 14pt;
+ width: 40em;
+ margin: 1em auto;
+}
+h1, h2, h3, h4 {
+ font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
+ color: #660000;
+}
+h1 { font-size: 22pt; }
+h2 { font-size: 20pt; }
+h3 { font-size: 18pt; }
+h4 { font-size: 16pt; }
+
+.title {
+ text-align: right;
+ font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
+ font-weight: bolder;
+ font-size: 24pt;
+}
+.title a {
+ text-decoration: none;
+ color: #660000;
+}
+
+#content {
+}
View
@@ -1,7 +1,7 @@
# Select document elements using Sizzle.js.
fs = require("fs")
vm = process.binding("evals")
-sizzle = new vm.Script(fs.readFileSync(__dirname + "/../../dep/sizzle.js", "utf8"), "sizzle.js")
+sizzle = new vm.Script(fs.readFileSync(__dirname + "/../../vendor/sizzle.js", "utf8"), "sizzle.js")
core = require("jsdom").dom.level3.core
close = core.HTMLDocument.prototype.close
View
@@ -1,8 +1,8 @@
{
"name": "zombie",
- "version": "0.6.1",
+ "version": "0.6.2",
"description": "Superfast headless full stack testing framework using node.js",
- "homepage": "https://github.com/assaf/zombie",
+ "homepage": "https://zombie.labnotes.org/",
"author": "Assaf Arkin <assaf@labnotes.org> (http://labnotes.org/)",
"keywords": [
"test",
@@ -26,8 +26,7 @@
"dependencies": {
"coffee-script": ">= 0.9.6",
"htmlparser": ">= 1.7.3",
- "jsdom": ">= 0.1.21",
- "vows": ">= 0.5.2"
+ "jsdom": ">= 0.1.21"
},
"repository": {
"type": "git",
File renamed without changes.
File renamed without changes.
View
@@ -40,9 +40,9 @@ require("http").ServerResponse.prototype.cookie = (name, val, options)->
brains.get "/", (req, res)->
res.send "<html><title>Tap, Tap</title></html>"
brains.get "/jquery.js", (req, res)->
- fs.readFile "#{__dirname}/../data/jquery.js", (err, data)-> res.send data
+ fs.readFile "#{__dirname}/.scripts/jquery.js", (err, data)-> res.send data
brains.get "/sammy.js", (req, res)->
- fs.readFile "#{__dirname}/../data/sammy.js", (err, data)->
+ fs.readFile "#{__dirname}/.scripts/sammy.js", (err, data)->
# Prevent sammy from polluting the output. Comment this if you need its
# messages for debugging.
data = "console.log = function() { };" + data
File renamed without changes.
File renamed without changes.

0 comments on commit 2f9b7ee

Please sign in to comment.