Permalink
Browse files

Added grunt build script (and fixed some lint errors to make it pass)

  • Loading branch information...
thedersen committed Jul 22, 2012
1 parent aaf9d43 commit 7fd9344fdb60bad987b86860055311aed589b51a

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -10,7 +10,7 @@ for (var i = 0; i < versions.length; i++) {
'lib/jquery-1.6.2.js',
'lib/underscore.js',
'lib/backbone-' + ver + '.js',
- 'backbone.validation.js'
+ 'dist/backbone-validation.js'
],
tests: [
'tests/**/*.js'
View
@@ -10,7 +10,7 @@ for (var i = 0; i < versions.length; i++) {
'lib/jquery-1.6.2.js',
'lib/underscore.js',
'lib/backbone-' + ver + '.js',
- 'backbone.validation.min.js'
+ 'dist/backbone-validation-min.js'
],
tests: [
'tests/**/*.js'

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,12 +1,13 @@
// Backbone.Validation v0.6.0
//
-// Copyright (C)2011-2012 Thomas Pedersen
+// Copyright (c) 2011-2012 Thomas Pedersen
// Distributed under MIT License
//
// Documentation and full license available at:
// http://thedersen.com/projects/backbone-validation
(function(Backbone, _){
+ 'use strict';
// Default options
// ---------------
@@ -262,7 +263,7 @@
// with validation
mixin: mixin(null, defaultOptions)
};
- })();
+ }());
// Callbacks
@@ -399,7 +400,7 @@
var args = Array.prototype.slice.call(arguments);
var text = args.shift();
return text.replace(/\{(\d+)\}/g, function(match, number) {
- return typeof args[number] != 'undefined' ? args[number] : match;
+ return typeof args[number] !== 'undefined' ? args[number] : match;
});
};
@@ -510,6 +511,6 @@
}
}
};
- })();
+ }());
-})(Backbone, _);
+}(Backbone, _));
View
@@ -0,0 +1,65 @@
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ pkg: '<json:package.json>',
+ meta: {
+ banner: '// <%= pkg.title || pkg.name %> v<%= pkg.version %>\n' +
+ '//\n' +
+ '// Copyright (c) 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
+ '// Distributed under MIT License\n' +
+ '//\n' +
+ '// Documentation and full license available at:\n' +
+ '// <%= pkg.homepage ? pkg.homepage : "" %>'
+ },
+ concat: {
+ browser: {
+ src: ['<banner:meta.banner>', '<file_strip_banner:src/<%= pkg.name %>.js>'],
+ dest: 'dist/<%= pkg.name %>.js'
+ }
+ },
+ min: {
+ browser: {
+ src: ['<banner:meta.banner>', '<config:concat.browser.dest>'],
+ dest: 'dist/<%= pkg.name %>-min.js'
+ }
+ },
+ watch: {
+ files: '<config:lint.files>',
+ tasks: 'lint'
+ },
+ lint: {
+ files: ['grunt.js', 'src/**/*.js', 'tests/**/*.js']
+ },
+ jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true,
+ browser: true,
+ node: true
+ },
+ globals: {
+ Backbone: true,
+ _: true,
+ jQuery: true,
+ $: true,
+ buster: true,
+ assert: true,
+ refute: true
+ }
+ },
+ uglify: {}
+ });
+
+ // Default task.
+ grunt.registerTask('default', 'concat lint min');
+
+};
View
@@ -1,18 +1,36 @@
-l{
- "author": "Thomas Pedersen (http://thedersen.com/)",
- "name": "backbone-validation",
- "version": "0.6.0",
- "url": "http://thedersen.github.com/backbone.validation",
- "repository": "git://github.com/thedersen/backbone.validation.git",
- "scripts": {
- "test": "buster test"
- },
- "engines": {
- "node": ">=0.6.3"
- },
- "dependencies": {},
- "devDependencies": {
- "buster": "0.4.3",
- "uglify-js": "1.2.5"
- }
-}
+{
+ "name": "backbone-validation",
+ "title": "Backbone.Validation",
+ "version": "0.6.0",
+ "author": {
+ "name": "Thomas Pedersen",
+ "url": "http://thedersen.com/"
+ },
+ "homepage": "http://thedersen.com/projects/backbone-validation",
+ "licenses": [{
+ "type": "MIT",
+ "url": "http://thedersen.mit-license.org/"
+ }],
+ "bugs": {
+ "url": "http://github.com/thedersen/backbone.validation/issues"
+ },
+ "directories": {
+ "lib": "./dist"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/thedersen/backbone.validation.git"
+ },
+ "scripts": {
+ "test": "buster test",
+ "prepublish": "grunt"
+ },
+ "main": "./dest/backbone-validation-amd.js",
+ "dependencies": {
+ "backbone": ">=0.9.1",
+ "underscore": ">=1.3.1"
+ },
+ "devDependencies": {
+ "buster": ">=0.6.2"
+ }
+}
Oops, something went wrong.

0 comments on commit 7fd9344

Please sign in to comment.