Skip to content

Instantly share code, notes, and snippets.

@padwasabimasala
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save padwasabimasala/9935918 to your computer and use it in GitHub Desktop.
Save padwasabimasala/9935918 to your computer and use it in GitHub Desktop.
Quickly Bootstrap a Tiny Coffeescript App with Mocha and Should
#!/bin/bash
init() {
mkdir $name
cd $name
echo "{\"name\": \"$name\"}" > package.json
npm install --save coffee-script
}
setup_tests() {
mkdir test
npm install --save-dev mocha should
echo "--require should
--ui bdd
--compilers coffee:coffee-script/register
--recursive" > test/mocha.opts
}
stub_app() {
echo "thing =
name: '$name'
module.exports = thing" > $name.coffee
echo "thing = require '../$name'
describe 'thing', ->
it 'has the name $name', ->
thing.name.should.equal '$name'" > test/$name-test.coffee
}
main() {
init
setup_tests
stub_app
}
name=$1
if test $# -ne 1; then
echo "Usage: $(basename $0) app-name" >&2
exit 1
fi
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment