Skip to content

Commit

Permalink
updated with grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
krispo committed Apr 30, 2014
1 parent 653a5b6 commit 9b1d4fb
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .jshintrc
@@ -0,0 +1,16 @@
{
"eqeqeq": true,
"esnext": true,
"immed": true,
"latedef": true,
"newcap": true,
"nonew": true,
"quotmark": "single",
"strict": true,
"trailing": true,
"undef": true,
"unused": "vars",
"globals": {
"angular": false
}
}
61 changes: 61 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,61 @@
/* global module */

module.exports = function(grunt){

'use strict';

grunt.initConfig({

pkg: grunt.file.readJSON('package.json'),

concat: {
options: {
banner:
'/**************************************************************************\n' +
'* <%= pkg.title || pkg.name %>, ' +
'v<%= pkg.version %>; ' +
'<%= pkg.license %>; ' +
'<%= grunt.template.today("mm/dd/yyyy HH:MM") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'**************************************************************************/\n',
stripBanners: true
},

dist: {
src: ['src/*.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},

uglify: {
options: {
mangle: false
},
min: {
files: {
'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js']
}
}
},

jshint: {
options: {
jshintrc: true
},
afterconcat: ['dist/<%= pkg.name %>.js'],
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
},

watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
}
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['concat', 'jshint', 'uglify']);
};
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2013 Konstantin Skipor
Copyright (c) 2014 Konstantin Skipor

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,
Expand Down
23 changes: 23 additions & 0 deletions dist/angular-nvd3.js
@@ -0,0 +1,23 @@
/**************************************************************************
* AngularJS-nvD3, v0.0.1; MIT; 04/30/2014 18:53
* http://krispo.github.io/angular-nvd3
**************************************************************************/
(function(){

'use strict';

angular.module('nvd3', [])

.directive('nvd3', [function(){
return {
restrict: 'AE',
scope: {
data: '=',
options: '='
},
link: function(scope, element, attrs){
/* Body */
}
};
}]);
})();
1 change: 1 addition & 0 deletions dist/angular-nvd3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
@@ -1,4 +1,5 @@
{
"title": "AngularJS-nvD3",
"name": "angular-nvd3",
"version": "0.0.1",
"description": "An AngularJS directive for NVD3.js reusable charting library",
Expand Down Expand Up @@ -26,11 +27,17 @@
"license": "MIT",
"author": "Konstantin Skipor",
"devDependencies": {
"grunt": "^0.4.4",
"grunt-cli": "^0.1.13",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"karma": "~0.10",
"karma-coverage": "^0.2.1"
},
"scripts": {
"test": "karma start test/karma.conf.js",
"test-single-run": "karma start test/karma.conf.js --single-run"
"test-single-run": "karma start test/karma.conf.js --single-run"
}
}
6 changes: 3 additions & 3 deletions src/angular-nvd3.js
Expand Up @@ -14,6 +14,6 @@
link: function(scope, element, attrs){
/* Body */
}
}
}])
})()
};
}]);
})();
13 changes: 7 additions & 6 deletions test/angular-nvd3Spec.js
@@ -1,8 +1,9 @@
'use strict';
/*global jasmine, beforeEach, afterEach, describe, it, inject, expect, module */

describe('angular-nvd3 directive', function() {
var $compile;
var $scope;
'use strict';

var $compile, $scope;

// Load the nvd3 module, which contains the directive
beforeEach(module('nvd3'));
Expand Down Expand Up @@ -31,7 +32,7 @@ describe('angular-nvd3 directive', function() {
$scope.$digest();

return $element;
};
}

it('should load test', function() {
expect(1).toBe(1);
Expand All @@ -47,7 +48,7 @@ describe('angular-nvd3 directive', function() {
values: [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 3}],
key: 'Line Chart',
color: '#ff7f0e'
}
};

it('parent scope options SHOULD MATCH directive scope options', function() {
var element = compileTpl(chartOptions, data);
Expand All @@ -65,5 +66,5 @@ describe('angular-nvd3 directive', function() {
key: 'Line Chart'
}));
});
})
});
});
4 changes: 4 additions & 0 deletions test/karma.conf.js
@@ -1,4 +1,8 @@
/* global module */

module.exports = function(config) {
'use strict';

config.set({

// The root path location that will be used to resolve all relative paths defined in files and exclude.
Expand Down

0 comments on commit 9b1d4fb

Please sign in to comment.