-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented build system, basic unit test support
- Loading branch information
Marco Rinck
committed
Sep 16, 2013
1 parent
dd7e310
commit 35ff11b
Showing
6 changed files
with
267 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"author": "Marco Rinck", | ||
"name": "angular-onbeforeunload", | ||
"description": "angular directive to handle window.onbeforeunload event in angularJS forms", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/marcorinck/angular-onbeforeunload", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/marcorinck/angular-onbeforeunload" | ||
}, | ||
"main": "./build/angular-onbeforeunload", | ||
"dependencies": { | ||
"angular": "1.0.8" | ||
}, | ||
"devDependencies": { | ||
"angular-mocks": "1.0.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
module.exports = function (grunt) { | ||
"use strict"; | ||
|
||
grunt.initConfig({ | ||
|
||
pkg: grunt.file.readJSON('bower.json'), | ||
|
||
language: grunt.option('lang') || 'en', | ||
|
||
meta: { | ||
banner: '/**\n * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | ||
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + | ||
' * <%= pkg.homepage %>\n' + | ||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + | ||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n */\n' | ||
}, | ||
|
||
build_dir: 'build', | ||
|
||
lib_files: { | ||
|
||
core: [ | ||
'src/onbeforeunload.js', | ||
'src/onbeforeunloadDirective.js' | ||
], | ||
|
||
test: ['test/**/*.js'] | ||
}, | ||
|
||
watch: { | ||
|
||
scripts: { | ||
files: ['gruntfile.js', '<%= lib_files.core %>', '<%= lib_files.test %>'], | ||
tasks: ['jshint:all', 'karma:unit'] | ||
}, | ||
|
||
livereload: { | ||
options: { | ||
livereload: true | ||
}, | ||
files: ['src/**/*.js', 'demo/*'], | ||
tasks: ['jshint', 'karma:unit', 'concat', 'copy:demo'] | ||
} | ||
}, | ||
|
||
jshint: { | ||
|
||
options: { | ||
jshintrc: '.jshintrc' | ||
}, | ||
|
||
all: ['gruntfile.js', '<%= lib_files.core %>', '<%= lib_files.test %>'], | ||
|
||
core: { | ||
files: { | ||
src: ['<%= lib_files.core %>'] | ||
} | ||
}, | ||
|
||
test: { | ||
files: { | ||
src: ['<%= lib_files.test %>'] | ||
} | ||
} | ||
}, | ||
|
||
concat: { | ||
banner: { | ||
options: { | ||
banner: '<%= meta.banner %>' | ||
}, | ||
src: '<%= concat.core.dest %>', | ||
dest: '<%= concat.core.dest %>' | ||
}, | ||
|
||
core: { | ||
src: ['<%= lib_files.core %>'], | ||
dest: '<%= build_dir %>/angular-onbeforeunload.js' | ||
} | ||
}, | ||
|
||
uglify: { | ||
core: { | ||
files: { | ||
'<%= build_dir %>/angular-onbeforeunload.min.js': '<%= concat.core.dest %>' | ||
} | ||
} | ||
}, | ||
|
||
copy: { | ||
demo: { | ||
files: [ | ||
{ | ||
src: 'angular-translate.js', | ||
dest: 'demo/js/', | ||
cwd: 'dist/', | ||
expand: true | ||
} | ||
] | ||
} | ||
}, | ||
|
||
karma: { | ||
unit: { | ||
configFile: 'karma.conf.js', | ||
singleRun: true | ||
} | ||
}, | ||
|
||
ngmin: { | ||
|
||
core: { | ||
src: '<%= concat.core.dest %>', | ||
dest: '<%= concat.core.dest %>' | ||
} | ||
} | ||
}); | ||
|
||
|
||
grunt.registerTask('default', ['jshint:all', 'karma']); | ||
grunt.registerTask('test', ['karma']); | ||
|
||
grunt.registerTask('build', [ | ||
'jshint:all', | ||
'karma', | ||
'build:core' | ||
]); | ||
|
||
grunt.registerTask('build:core', [ | ||
'jshint:core', | ||
'concat:core', | ||
'ngmin:core', | ||
'concat:banner', | ||
'uglify:core' | ||
]); | ||
|
||
// For development purpose. | ||
grunt.registerTask('dev', ['jshint', 'karma:unit', 'concat', 'copy:demo', 'watch:livereload']); | ||
|
||
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Karma configuration | ||
// Generated on Mon Sep 16 2013 12:55:41 GMT+0200 (W. Europe Daylight Time) | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
|
||
// base path, that will be used to resolve files and exclude | ||
basePath: '', | ||
|
||
|
||
// frameworks to use | ||
frameworks: ['jasmine'], | ||
|
||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'bower_components/angular/angular.js', | ||
'bower_components/angular-mocks/angular-mocks.js', | ||
'src/**/*.js', | ||
'test/**/*.js' | ||
], | ||
|
||
|
||
// list of files to exclude | ||
exclude: [ | ||
|
||
], | ||
|
||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | ||
reporters: ['progress'], | ||
|
||
|
||
// web server port | ||
port: 9876, | ||
|
||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera | ||
// - Safari (only Mac) | ||
// - PhantomJS | ||
// - IE (only Windows) | ||
browsers: ['PhantomJS'], | ||
|
||
|
||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: false | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "angular-onbeforeunload", | ||
"version": "0.1.0", | ||
"description": "angular directive to handle window.onbeforeunload event in angularJS forms", | ||
"keywords": ["angular", "angularJS", "onbeforeunload", "browser", "event", "window"], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/marcorinck/angular-growl" | ||
}, | ||
"author": { | ||
"name": "Marco Rinck" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"karma": "~0.10.x", | ||
"grunt": "~0.4.1", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-copy": "~0.4.1", | ||
"grunt-contrib-concat": "~0.3.x", | ||
"grunt-contrib-jshint": "~0.6.x", | ||
"grunt-contrib-uglify": "~0.2.x", | ||
"grunt-contrib-watch": "~0.5.x", | ||
"grunt-bump": "0.0.2", | ||
"grunt-karma": "~0.7.x", | ||
"grunt-ngmin": "0.0.2", | ||
"matchdep": "0.1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
describe("onbeforeunload", function() { | ||
"use strict"; | ||
|
||
it("should be true", function() { | ||
expect(true).toBe(true); | ||
}); | ||
}); |