Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobie Langel committed Mar 29, 2012
0 parents commit f906014
Show file tree
Hide file tree
Showing 21 changed files with 2,802 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
node_modules
6 changes: 6 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Matt Kelly <mk@fb.com>
Tobie Langel <tobie@fb.com>
Adam Sontag <adam@bocoup.com>
Ben Alman <ben@bocoup.com>
Boaz Sender <boaz@bocoup.com>
Rick Waldron <rick@bocoup.com>
42 changes: 42 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env node

var fs = require('fs'),
path = require('path'),
colors = require('colors'),
_ = require('underscore');

function getFileContent() {
var p = path.join.apply(path, arguments);
try {
return fs.readFileSync(p).toString();
} catch (e) {
return '';
}
}

if (process.argv.length < 3) {
console.log( 'Please specify a test "spec" to build.' );
process.exit();
}

var spec = process.argv[2].trim(),
p = path.join('tests', spec),
template,
content;

if (path.existsSync(p)) {
template = fs.readFileSync('./suite/default_template.html').toString();

content = _.template(template, {
tests: getFileContent(p, 'test.js'),
js: getFileContent(p, 'fixture.js'),
html: getFileContent(p, 'fixture.html'),
css: getFileContent(p, 'fixture.css')
});

fs.writeFileSync(path.join(p, 'index.html'), content);

console.log('Built!'.green);
} else {
console.log( ('Spec "' + spec + '" doesn\'t exist.').red );
}
75 changes: 75 additions & 0 deletions grunt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
if ( global.grunt ) {
fail.fatal( 'YOU MUST UPGRADE GRUNT TO 0.3.0 OR NEWER' );
}

/*global config:true, task:true, module:true */
module.exports = function(grunt) {

var task = grunt.task;
var file = grunt.file;
var utils = grunt.utils;
var log = grunt.log;
var verbose = grunt.verbose;
var fail = grunt.fail;
var option = grunt.option;
var config = grunt.config;
var template = grunt.template;

grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: ''
},
lint: {
files: ['tests/!(boilerplate)**/*.js']
},
watch: {
files: ['<config:lint.files>'],
tasks: 'default'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: false,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
evil: true,
browser: true,
trailing: true,
maxerr: 10,
loopfunc: true
},
globals: {
self: true,
Node: true,
global: true,
exports: true,
require: true,
file: true,
log: true,
console: true,
importScripts: true,

// Test API
Hat: true,
H: true,
test: true,
asyncTest: true,

// Assertions
assert: true,
ok: true
}
},
uglify: {}
});

// Default task.
task.registerTask('default', 'lint');
};
50 changes: 50 additions & 0 deletions new
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env node

var fs = require("fs"),
colors = require("colors"),
cp = require("child_process"),
_ = require("underscore"),
exec = cp.exec,

args = process.argv.slice(2),
spec, path;


if ( !args.length ) {
console.log( "Please specify a new test 'spec' to create." );
process.exit();
}

spec = (args[ 0 ]).trim();
path = "tests/" + spec;

fs.readdir( path, function( err, files ) {

if ( err !== null && !/No such file/.test(err) ) {
exec( "cp -r tests/boilerplate/ " + path, function( err, stdout, stderr ) {

if ( err === null ) {

console.log( "Copied!".green );

fs.readdir( path, function( err, files ) {
files.forEach(function( file ) {
var target = path + "/" + file,
source = fs.readFileSync( target ).toString(),
out = fs.openSync( target, "w+" ),
title = spec.split("-").map(function(val) {
return val[0].toUpperCase() + val.slice(1);
}).join(" ");

spec
fs.writeSync( out, _.template( source, { spec: spec, title: title }) );
});

console.log( "Configured!".green );
});
}
});
} else {
console.log( ("Directory: " + path + " already exists").red );
}
});
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "coremob-tests",
"description": "Core Mobile Community Group Tests",
"version": "0.1.0",
"homepage": "https://github.com/?/coremob-tests",
"repository": {
"type": "git",
"url": "git://github.com/?/coremob-tests.git"
},
"bugs": {
"url": "https://github.com/?/coremob-tests/issues"
},
"licenses": [
{
"type": "W3C 3-clause BSD License",
"url": "http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"
},
{
"type": "W3C Test Suite License",
"url": "http://www.w3.org/Consortium/Legal/2008/04-testsuite-license"
}
],
"dependencies": {
},
"devDependencies": {
"grunt": "~0.2.6",
"js-yaml": "*",
"colors": "~0.6.0",
"underscore": "~1.2.4"
},
"keywords": [],
"engines": {
"node": ">= 0.6.0"
},
"contributors": [
"Matt Kelly <mk@fb.com> (url)",
"Tobie Langel <tobie@fb.com> (url)",
"Adam Sontag <adam@bocoup.com> (url)",
"Boaz Sender <boaz@bocoup.com> (url)",
"Rick Waldron <rick@bocoup.com> (url)"
],
"author": "Facebook"
}
Loading

0 comments on commit f906014

Please sign in to comment.