Skip to content

Commit

Permalink
Initial stab at build/test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ksperling committed Feb 11, 2013
1 parent bac5073 commit d66a791
Show file tree
Hide file tree
Showing 13 changed files with 31,980 additions and 585 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2013 Foxtrot Media Ltd, http://foxtrotmedia.co.nz/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular-extras
==============

Experimental extensions for Angular JS (http://angularjs.org)
Experimental extensions for Angular JS (http://angularjs.org), part of the Angular UI router effort: https://github.com/angular-ui/router/

Sample in action: http://filedrop.plukmobile.net/angular-states/sample/index.html
2 changes: 0 additions & 2 deletions dev-server.js

This file was deleted.

74 changes: 74 additions & 0 deletions grunt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var testacular = require('testacular');

/*global module:false*/
module.exports = function (grunt) {

// Project configuration.
grunt.initConfig({
builddir: 'build',
pkg: '<json:package.json>',
meta: {
banner: '/**\n' + ' * <%= pkg.description %>\n' +
' * @version v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license MIT License, http://www.opensource.org/licenses/MIT\n' + ' */',
prefix: '(function (window, angular, undefined) {',
suffix: '})(window, window.angular);',
},
concat: {
build: {
src: ['<banner:meta.banner>', '<banner:meta.prefix>', 'src/*.js', '<banner:meta.suffix>' ],
dest: '<%= builddir %>/<%= pkg.name %>.js'
},
},
min: {
build: {
src: ['<banner:meta.banner>', '<config:concat.build.dest>'],
dest: '<%= builddir %>/<%= pkg.name %>.min.js'
},
},
lint: {
files: ['grunt.js', 'src/*.js']
},
watch: {
files: ['src/*.js'],
tasks: 'build test'
}
});

// Default task.
grunt.registerTask('default', 'build test');
grunt.registerTask('build', 'concat min');

grunt.registerTask('dist', 'Change dist location', function() {
var dir = this.args[0];
if (dir) { grunt.config('builddir', dir); }
});

grunt.registerTask('test-server', 'Start testacular server', function () {
//Mark the task as async but never call done, so the server stays up
var done = this.async();
testacular.server.start({ configFile: 'test/test-config.js'});
});

grunt.registerTask('test', 'Run tests (make sure test-server task is run first)', function () {
var done = this.async();
grunt.utils.spawn({
cmd: process.platform === 'win32' ? 'testacular.cmd' : 'testacular',
args: process.env.TRAVIS ? ['start', 'test/test-config.js', '--single-run', '--no-auto-watch', '--reporter=dots', '--browsers=Firefox'] : ['run']
}, function (error, result, code) {
if (error) {
grunt.warn("Make sure the testacular server is online: run `grunt test-server`.\n" +
"Also make sure you have a browser open to http://localhost:8080/.\n" +
error.stdout + error.stderr);
//the testacular runner somehow modifies the files if it errors(??).
//this causes grunt's watch task to re-fire itself constantly,
//unless we wait for a sec
setTimeout(done, 1000);
} else {
grunt.log.write(result.stdout);
done();
}
});
});
};
Loading

0 comments on commit d66a791

Please sign in to comment.