Skip to content

Commit

Permalink
Update tools
Browse files Browse the repository at this point in the history
Fix #34, update devDeps, add linter, modified build.
  • Loading branch information
TheSharpieOne committed Dec 17, 2015
1 parent ed023df commit 19923ab
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/**
bower_components/**
37 changes: 37 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"bitwise": true,
"immed": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"trailing": true,
"maxlen": 160,
"boss": true,
"eqnull": true,
"expr": true,
"laxbreak": true,
"loopfunc": true,
"sub": true,
"undef": true,
"indent": 2,
"esnext": true,
"node": true,
"browser": true,
"mocha": true,
"globals": {
"protractor": true,
"browser": true,
"by": true,
"element": true,
"it": true,
"describe": true,
"beforeEach": true,
"afterEach": true,
"expect": true,
"sinon": true,
"inject": true,
"module": true,
"angular": true
}
}
7 changes: 2 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-match",
"version": "1.6.0",
"version": "1.7.0",
"homepage": "https://github.com/TheSharpieOne/angular-validation-match",
"authors": [
"TheSharpieOne <evan@lostonia.com>"
Expand Down Expand Up @@ -33,9 +33,6 @@
"tests"
],
"dependencies": {
"angular": ">=1.2.0 <2.0.0"
},
"devDependencies": {
"angular-mocks": ">=1.2.0 <2.0.0"
"angular": ">=1.3.0 <2.0.0"
}
}
7 changes: 3 additions & 4 deletions dist/angular-validation-match.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* angular-validation-match
* Checks if one input matches another
* @version v1.6.0
* @version v1.7.0
* @link https://github.com/TheSharpieOne/angular-validation-match
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
Expand All @@ -17,9 +17,6 @@ function match ($parse) {
restrict: 'A',
link: function(scope, elem, attrs, ctrl) {
if(!ctrl) {
if(console && console.warn){
console.warn('Match validation requires ngModel to be on the element');
}
return;
}

Expand All @@ -41,7 +38,9 @@ function match ($parse) {
}else{
value = ctrl.$viewValue === match;
}
/*jslint bitwise: true */
value ^= notMatch;
/*jslint bitwise: false */
return !!value;
};

Expand Down
4 changes: 2 additions & 2 deletions dist/angular-validation-match.min.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*!
* angular-validation-match
* Checks if one input matches another
* @version v1.6.0
* @version v1.7.0
* @link https://github.com/TheSharpieOne/angular-validation-match
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
!function(a,b,c){"use strict";function d(a){return{require:"?ngModel",restrict:"A",link:function(c,d,e,f){function g(){var a=h(c);return b.isObject(a)&&a.hasOwnProperty("$viewValue")&&(a=a.$viewValue),a}if(!f)return void(console&&console.warn&&console.warn("Match validation requires ngModel to be on the element"));var h=a(e.match),i=a(e.matchCaseless),j=a(e.notMatch);c.$watch(g,function(){f.$$parseAndValidate()}),f.$validators.match=function(){var a,d=g(),e=j(c);return a=i(c)?b.lowercase(f.$viewValue)===b.lowercase(d):f.$viewValue===d,a^=e,!!a}}}}b.module("validation.match",[]),b.module("validation.match").directive("match",d),d.$inject=["$parse"]}(window,window.angular);
!function(e,a,t){"use strict";function i(e){return{require:"?ngModel",restrict:"A",link:function(t,i,n,r){function c(){var e=o(t);return a.isObject(e)&&e.hasOwnProperty("$viewValue")&&(e=e.$viewValue),e}if(r){var o=e(n.match),u=e(n.matchCaseless),l=e(n.notMatch);t.$watch(c,function(){r.$$parseAndValidate()}),r.$validators.match=function(){var e,i=c(),n=l(t);return e=u(t)?a.lowercase(r.$viewValue)===a.lowercase(i):r.$viewValue===i,e^=n,!!e}}}}}a.module("validation.match",[]),a.module("validation.match").directive("match",i),i.$inject=["$parse"]}(window,window.angular);
11 changes: 8 additions & 3 deletions files.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ var pkg = require('./package.json');

var pkgFiles = {
angular: [
'bower_components/angular/angular.js'
'node_modules/angular/angular.js'
],
karma: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js'
'node_modules/chai/chai.js',
'node_modules/sinon/pkg/sinon.js',
'node_modules/dirty-chai/lib/dirty-chai.js',
'node_modules/sinon-chai/lib/sinon-chai.js',
'node_modules/chai/chai.js',
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js'
],
'karma-build': [
'@karma',
Expand Down
11 changes: 6 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

var gulp = require('gulp');
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglifyjs');
var uglify = require('gulp-uglify');
var wrap = require('gulp-wrap');
var bump = require('gulp-bump');
var gulpKarma = require('gulp-karma');
var rename = require('gulp-rename');
var gulpSequence = require('gulp-sequence').use(gulp);
var pkg = require('./package.json');
var files = require('./files');
Expand All @@ -17,7 +18,7 @@ var banner = '/*!\n' +
' * <%= pkg.description %>\n' +
' * @version v<%= pkg.version %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
' * @license <%= pkg.license %> License, http://www.opensource.org/licenses/<%= pkg.license %>\n' +
' */\n';

gulp.task('bump', function(){
Expand All @@ -35,12 +36,12 @@ gulp.task('buildDev', function () {

gulp.task('minBuild', function () {
return gulp.src('./build/'+pkg.name+'.js')
.pipe(uglify(pkg.name+'.min.js', {
.pipe(uglify({
outSourceMap: false,
mangle: true,
preserveComments: 'some'
preserveComments: 'license'
}))
.pipe(wrap(banner+'<%= contents %>', {pkg: pkg}))
.pipe(rename(pkg.name+'.min.js'))
.pipe(gulp.dest('./build/'));
});

Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function (config) {
config.set({
basePath: './',

frameworks: ['mocha', 'chai-sinon'],
frameworks: ['mocha'],

exclude: [],

Expand Down
3 changes: 2 additions & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global Package*/
// package metadata file for Meteor.js
var packageName = 'silintzir:angular-validation-match';
var where = 'client';
Expand All @@ -21,4 +22,4 @@ Package.onUse(function(api) {
api.use('angular:angular@1.2.0', where); // Dependencies

api.addFiles('dist/angular-validation-match.js', where); // Files in use
});
});
46 changes: 24 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "angular-validation-match",
"version": "1.6.0",
"version": "1.7.0",
"homepage": "https://github.com/TheSharpieOne/angular-validation-match",
"description": "Checks if one input matches another",
"main": "./index.js",
"scripts": {
"test": "gulp test"
"test": "gulp test",
"build": "gulp build"
},
"repository": {
"type": "git",
Expand All @@ -28,28 +29,29 @@
"web": "https://github.com/TheSharpieOne"
}
],
"license": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"license": "MIT",
"dependencies":{
"angular": ">=1.3.0 <2.0.0"
},
"devDependencies": {
"chai": "^1.10.0",
"angular-mocks": ">=1.3.0 <2.0.0",
"chai": "^3.4.1",
"dirty-chai": "1.2.2",
"gulp": "^3.9.0",
"gulp-bump": "^0.1.13",
"gulp-karma": "0.0.4",
"gulp-ng-annotate": "^0.3.6",
"gulp-sequence": "^0.3.1",
"gulp-uglifyjs": "^0.4.4",
"gulp-wrap": "^0.3.0",
"karma": "^0.12.37",
"karma-chai-sinon": "^0.1.5",
"karma-chrome-launcher": "^0.1.12",
"karma-firefox-launcher": "~0.1.0",
"karma-mocha": "~0.1",
"karma-phantomjs-launcher": "^0.1.4",
"karma-script-launcher": "~0.1.0",
"gulp-bump": "^1.0.0",
"gulp-karma": "0.0.5",
"gulp-ng-annotate": "^1.1.0",
"gulp-rename": "^1.2.2",
"gulp-sequence": "^0.4.1",
"gulp-uglify": "^1.5.1",
"gulp-wrap": "^0.11.0",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.2",
"karma-firefox-launcher": "^0.1.0",
"karma-mocha": "^0.2.1",
"karma-phantomjs-launcher": "^0.2.1",
"mocha": "^2.3.4",
"phantomjs": "^1.9.19",
"sinon": "^1.16.1",
"sinon-chai": "^2.8.0"
}
Expand Down
5 changes: 2 additions & 3 deletions src/angular-validation-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ function match ($parse) {
restrict: 'A',
link: function(scope, elem, attrs, ctrl) {
if(!ctrl) {
if(console && console.warn){
console.warn('Match validation requires ngModel to be on the element');
}
return;
}

Expand All @@ -34,7 +31,9 @@ function match ($parse) {
}else{
value = ctrl.$viewValue === match;
}
/*jslint bitwise: true */
value ^= notMatch;
/*jslint bitwise: false */
return !!value;
};

Expand Down

0 comments on commit 19923ab

Please sign in to comment.