Basic tests now failing. That's a good thing.
This commit is contained in:
parent
92680574f3
commit
41239a0b4c
|
@ -2,7 +2,5 @@
|
||||||
.#*
|
.#*
|
||||||
*~
|
*~
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
.grunt.js
|
|
||||||
node_modules/*
|
node_modules/*
|
||||||
build/
|
lib/
|
||||||
public/
|
|
||||||
|
|
34
Makefile
34
Makefile
|
@ -1,38 +1,18 @@
|
||||||
.PHONY: app libs test
|
.PHONY: lib test
|
||||||
|
|
||||||
|
lib_sources:= $(wildcard src/*.coffee)
|
||||||
app_sources:= $(wildcard src/*/*.coffee)
|
lib_objects:= $(subst src/, lib/, $(lib_sources:%.coffee=%.js))
|
||||||
app_objects:= $(subst src/, app/, $(app_sources:%.coffee=%.js))
|
|
||||||
|
|
||||||
libs= $(shell cd src && find . -type f -name '*.js')
|
|
||||||
|
|
||||||
home_sources = src/index.haml
|
|
||||||
home_objects = app/index.html
|
|
||||||
|
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
build: app bootstrap $(app_objects) $(home_objects) libs
|
build: $(lib_objects)
|
||||||
|
|
||||||
app:
|
$(lib_objects): lib/%.js: src/%.coffee
|
||||||
mkdir -p $@
|
@mkdir -p $(@D)
|
||||||
|
|
||||||
$(app_objects): app/%.js: src/%.coffee
|
|
||||||
coffee -o $(@D) -c $<
|
coffee -o $(@D) -c $<
|
||||||
|
|
||||||
libs:
|
|
||||||
cd src && tar cf - $(libs) | ( cd ../app; tar xvf - )
|
|
||||||
|
|
||||||
$(home_objects): app/%.html: src/%.haml
|
|
||||||
haml --unix-newlines --no-escape-attrs --double-quote-attributes $< > $@
|
|
||||||
|
|
||||||
bootstrap: app
|
|
||||||
cp bootstrap-extras/variables.less vendor/bootstrap/less
|
|
||||||
cd vendor/bootstrap && make build
|
|
||||||
cd vendor/bootstrap/bootstrap && tar cf - .| (cd ../../../app && tar xvf - )
|
|
||||||
|
|
||||||
test: test/[0-9]*_mocha.coffee
|
test: test/[0-9]*_mocha.coffee
|
||||||
./node_modules/.bin/mocha -C --compilers coffee:coffee-script -u tdd $<
|
./node_modules/.bin/mocha -C --compilers coffee:coffee-script -u tdd $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -fr app
|
rm -fr lib
|
||||||
cd vendor/bootstrap && git reset --hard HEAD
|
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
"url": "http://elfsternberg.com/home/elfsternberg/repos/Tumble/LICENSE"
|
"url": "http://elfsternberg.com/home/elfsternberg/repos/Tumble/LICENSE"
|
||||||
}],
|
}],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"coffee-script": "1.x.x"
|
"coffee-script": "1.x.x",
|
||||||
|
"reparse-coffeescript": "git://github.com/elfsternberg/reparse-coffeescript#master"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"docco": "0.3.x",
|
"docco": "0.3.x",
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# _ _ _ _ _____ _ _
|
||||||
|
# /_\ | |__ __| |_ _ _ __ _ __| ||_ _| _ _ __ | |__| |_ _
|
||||||
|
# / _ \| '_ (_-< _| '_/ _` / _| _|| || || | ' \| '_ \ | '_|
|
||||||
|
# /_/ \_\_.__/__/\__|_| \__,_\__|\__||_| \_,_|_|_|_|_.__/_|_|
|
||||||
|
#
|
||||||
|
|
||||||
|
# Built on top of the basic parser-combinator for Coffeescript, this
|
||||||
|
# defines a parser for the Tumblr engine, assuming the following:
|
||||||
|
|
||||||
|
ReParse = require('reparse-coffeescript/lib/reparse').ReParse
|
||||||
|
|
||||||
|
class AbstractTumbler extends ReParse
|
||||||
|
|
||||||
|
module.exports = class extends AbstractTumbler
|
|
@ -3,7 +3,9 @@ assert = chai.assert
|
||||||
expect = chai.expect
|
expect = chai.expect
|
||||||
should = chai.should()
|
should = chai.should()
|
||||||
|
|
||||||
tumbl = require 'lib/tumble'
|
Tumbler = require('../lib/tumble')
|
||||||
|
|
||||||
|
tumbl = new Tumbler()
|
||||||
|
|
||||||
test_data = [
|
test_data = [
|
||||||
{
|
{
|
||||||
|
@ -26,15 +28,14 @@ test_data = [
|
||||||
'data': {'name': 'Elf Sternberg', 'title': 'Mr.'}
|
'data': {'name': 'Elf Sternberg', 'title': 'Mr.'}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
'input': '<ul>{block:Stories}{Title}{/block:Stories}'
|
||||||
|
'output': '<ul>AAABBB</ul>'
|
||||||
|
'data': {'stories': [{'title': 'AAA'}, {'title': 'BBB'}]}
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
describe "Foobar", ->
|
describe "Basic Functionality", ->
|
||||||
describe "#sayHello()", ->
|
for data in test_data
|
||||||
it "should work with assert", ->
|
it "should work with #{data.description}", ->
|
||||||
assert.equal foobar.sayHello(), "funky chicken!"
|
tumbl.parse(data.input)(data.data).should.equal data.output
|
||||||
|
|
||||||
it "should work with expect", ->
|
|
||||||
expect(foobar.sayHello()).to.equal "funky chicken!"
|
|
||||||
|
|
||||||
it "should work with should", ->
|
|
||||||
foobar.sayHello().should.equal "funky chicken!"
|
|
||||||
|
|
Loading…
Reference in New Issue