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
|
||||
.grunt.js
|
||||
node_modules/*
|
||||
build/
|
||||
public/
|
||||
lib/
|
||||
|
|
34
Makefile
34
Makefile
|
@ -1,38 +1,18 @@
|
|||
.PHONY: app libs test
|
||||
.PHONY: lib test
|
||||
|
||||
|
||||
app_sources:= $(wildcard src/*/*.coffee)
|
||||
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
|
||||
lib_sources:= $(wildcard src/*.coffee)
|
||||
lib_objects:= $(subst src/, lib/, $(lib_sources:%.coffee=%.js))
|
||||
|
||||
default: build
|
||||
|
||||
build: app bootstrap $(app_objects) $(home_objects) libs
|
||||
build: $(lib_objects)
|
||||
|
||||
app:
|
||||
mkdir -p $@
|
||||
|
||||
$(app_objects): app/%.js: src/%.coffee
|
||||
$(lib_objects): lib/%.js: src/%.coffee
|
||||
@mkdir -p $(@D)
|
||||
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
|
||||
./node_modules/.bin/mocha -C --compilers coffee:coffee-script -u tdd $<
|
||||
|
||||
clean:
|
||||
rm -fr app
|
||||
cd vendor/bootstrap && git reset --hard HEAD
|
||||
rm -fr lib
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
"url": "http://elfsternberg.com/home/elfsternberg/repos/Tumble/LICENSE"
|
||||
}],
|
||||
"dependencies": {
|
||||
"coffee-script": "1.x.x"
|
||||
"coffee-script": "1.x.x",
|
||||
"reparse-coffeescript": "git://github.com/elfsternberg/reparse-coffeescript#master"
|
||||
},
|
||||
"devDependencies": {
|
||||
"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,38 +3,39 @@ assert = chai.assert
|
|||
expect = chai.expect
|
||||
should = chai.should()
|
||||
|
||||
tumbl = require 'lib/tumble'
|
||||
Tumbler = require('../lib/tumble')
|
||||
|
||||
tumbl = new Tumbler()
|
||||
|
||||
test_data = [
|
||||
{
|
||||
'input': '',
|
||||
'output': ''
|
||||
}
|
||||
{
|
||||
'input': '<html>',
|
||||
'output': '<html>',
|
||||
}
|
||||
{
|
||||
'input': '<h1>{name}</h1>'
|
||||
'output': '<h1>Elf Sternberg</h1>'
|
||||
'data': {'name': 'Elf Sternberg'}
|
||||
}
|
||||
{
|
||||
'input': '',
|
||||
'output': ''
|
||||
}
|
||||
{
|
||||
'input': '<html>',
|
||||
'output': '<html>',
|
||||
}
|
||||
{
|
||||
'input': '<h1>{name}</h1>'
|
||||
'output': '<h1>Elf Sternberg</h1>'
|
||||
'data': {'name': 'Elf Sternberg'}
|
||||
}
|
||||
|
||||
{
|
||||
'input': '<h1>{title} {name}</h1>'
|
||||
'output': '<h1>Mr. Elf Sternberg</h1>'
|
||||
'data': {'name': 'Elf Sternberg', 'title': 'Mr.'}
|
||||
}
|
||||
{
|
||||
'input': '<h1>{title} {name}</h1>'
|
||||
'output': '<h1>Mr. Elf Sternberg</h1>'
|
||||
'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 "#sayHello()", ->
|
||||
it "should work with assert", ->
|
||||
assert.equal foobar.sayHello(), "funky chicken!"
|
||||
|
||||
it "should work with expect", ->
|
||||
expect(foobar.sayHello()).to.equal "funky chicken!"
|
||||
|
||||
it "should work with should", ->
|
||||
foobar.sayHello().should.equal "funky chicken!"
|
||||
describe "Basic Functionality", ->
|
||||
for data in test_data
|
||||
it "should work with #{data.description}", ->
|
||||
tumbl.parse(data.input)(data.data).should.equal data.output
|
||||
|
|
Loading…
Reference in New Issue