Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adamclerk/5117263 to your computer and use it in GitHub Desktop.
Save adamclerk/5117263 to your computer and use it in GitHub Desktop.
Modified From http://www.adomokos.com/2012/01/javascript-testing-with-mocha.html to make kata creation eaiser.
#!/bin/bash
function create_dir {
if [ ! -d $1 ];
then
mkdir $1
fi
}
echo "create sublime project..."
echo '{
"folders":
[
{
"path": "./"
}
]
}' > kata.sublime-project
echo "create the readme.md..."
echo "README" > README.md
echo "create makefile..."
echo "
all:
@./node_modules/.bin/mocha -R spec
" > makefile
echo "create the src directory..."
create_dir src
echo "create the test directory..."
create_dir test
echo "write the package.json file..."
echo '{
"name": "new-kata",
"version": "0.0.1",
"engines": {
"node": "0.8.*"
},
"scripts": {"test": "./node_modules/mocha/bin/mocha"},
"dependencies":{
"mocha": "latest",
"should": "latest"
}
}' > package.json
echo "install npm packages..."
npm install
echo "create a sample spec file..."
echo "var should = require('should');
describe('KATA', function() {
it('should be fun');
});" > test/kata_spec.js
echo "create a src file..."
echo "global.theApp = {};" > src/kata.js
echo "run the spec with list reporter..."
node_modules/mocha/bin/mocha -R spec
subl --project kata.sublime-project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment