Skip to content
Browse files

Grunt notifications and linting

  • Loading branch information...
1 parent b9909bd commit 7c81b671cd60876dc549d4e03e52989457574a25 @craveytrain committed Aug 8, 2013
Showing with 35 additions and 15 deletions.
  1. +24 −6 Gruntfile.js
  2. +3 −1 package.json
  3. +8 −8 src/azucar.js
View
30 Gruntfile.js
@@ -1,3 +1,4 @@
+/*jshint maxstatements:99 */
module.exports = function(grunt) {
'use strict';
@@ -13,39 +14,56 @@ module.exports = function(grunt) {
},
build: 'Gruntfile.js',
+ src: 'src/**/*.js',
test: 'tests/**/*.js'
},
watch: {
+ options: {
+ livereload: true
+ },
test: {
files: ['test/**/*.js'],
- tasks: ['test']
+ tasks: ['jshint:test']
+ },
+ src: {
+ files: ['src/**/*.js'],
+ tasks: ['jshint:src']
}
},
intern: {
- client: {
+ runner: {
options: {
+ runType: 'runner',
config: 'tests/intern'
}
}
},
connect: {
server: {}
+ },
+
+ open: {
+ intern: {
+ path: 'http://localhost:8000/node_modules/intern/client.html?config=tests/intern&reporters=webdriver'
+ }
}
})
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-connect')
+ grunt.loadNpmTasks('grunt-open')
+ grunt.loadNpmTasks('grunt-notify')
grunt.loadNpmTasks('intern')
- grunt.registerTask('test', ['intern:client'])
- grunt.registerTask('build', ['jshint', 'test'])
- grunt.registerTask('preview', ['connect', 'watch'])
+ grunt.registerTask('test', ['intern'])
+ grunt.registerTask('qc', ['jshint'])
+ grunt.registerTask('preview', ['qc', 'connect', 'open', 'watch'])
// Default task(s).
- grunt.registerTask('default', ['build', 'watch'])
+ // grunt.registerTask('default', ['build', 'watch'])
};
View
4 package.json
@@ -13,6 +13,8 @@
"grunt-contrib-jshint": "~0.6.2",
"grunt-contrib-watch": "~0.5.1",
"intern": "~1.2.0",
- "grunt-contrib-connect": "~0.3.0"
+ "grunt-contrib-connect": "~0.3.0",
+ "grunt-open": "~0.2.1",
+ "grunt-notify": "~0.2.7"
}
}
View
16 src/azucar.js
@@ -1,6 +1,6 @@
'use strict';
-
-var $ = function (doc, _ElemProto, domNode, _ArrayProto) {
+/*jshint unused: false */
+var $ = (function (doc, _ElemProto, domNode) {
var $ = doc.querySelectorAll.bind(doc);
// Setup single node sugar
@@ -27,15 +27,15 @@ var $ = function (doc, _ElemProto, domNode, _ArrayProto) {
function addSugar(array) {
if (typeof _ElemProto.on === 'function') {
array.on = function(event, callback) {
- this.forEach(function(item, index) {
+ this.forEach(function(item) {
item.on(event, callback);
});
};
}
if (typeof _ElemProto.trigger === 'function') {
array.trigger = function(event, callback) {
- this.forEach(function(item, index) {
+ this.forEach(function(item) {
item.trigger(event, callback);
});
};
@@ -44,17 +44,17 @@ var $ = function (doc, _ElemProto, domNode, _ArrayProto) {
if (typeof domNode.classList === 'object') {
array.classList = {
add: function addClass(className) {
- array.forEach(function(item, index) {
+ array.forEach(function(item) {
item.classList.add(className);
}, array);
},
remove: function removeClass(className) {
- array.forEach(function(item, index) {
+ array.forEach(function(item) {
item.classList.remove(className);
}, array);
},
contains: function containsClass(className) {
- return array.some(function(item, index) {
+ return array.some(function(item) {
return item.classList.contains(className);
}, array);
}
@@ -74,4 +74,4 @@ var $ = function (doc, _ElemProto, domNode, _ArrayProto) {
return createArray(collection, length);
}
};
-}(document, Element.prototype, document.createElement('p'), Array.prototype);
+}(document, Element.prototype, document.createElement('p')));

0 comments on commit 7c81b67

Please sign in to comment.
Something went wrong with that request. Please try again.