2014-08-10 11:37:05 +02:00
|
|
|
/*global module:false*/
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
require('time-grunt')(grunt);
|
|
|
|
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
banner: '/*! <%= pkg.name %> <%= pkg.version %> by <%= pkg.author.name %>\n'+
|
|
|
|
'* Library to provide geo functions like distance calculation,\n' +
|
|
|
|
'* conversion of decimal coordinates to sexagesimal and vice versa, etc.\n' +
|
|
|
|
'* WGS 84 (World Geodetic System 1984)\n' +
|
|
|
|
'* \n' +
|
|
|
|
'* @author <%= pkg.author.name %>\n' +
|
|
|
|
'* @url <%= pkg.author.url %>\n' +
|
|
|
|
'* @version <%= pkg.version %>\n' +
|
|
|
|
'* @license <%= _.pluck(pkg.licenses, "type").join(", ") %> \n**/',
|
|
|
|
lint: {
|
|
|
|
files: ['src/geolib.js']
|
|
|
|
},
|
|
|
|
qunit: {
|
|
|
|
files: ['tests/*.html']
|
|
|
|
},
|
|
|
|
concat: {
|
|
|
|
main: {
|
|
|
|
options: {
|
|
|
|
banner: '<%= banner %>',
|
|
|
|
report: false
|
|
|
|
},
|
|
|
|
src: ['src/geolib.js'],
|
|
|
|
dest: 'dist/geolib.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
component: {
|
|
|
|
files: [{
|
|
|
|
src: "package.json",
|
|
|
|
dest: "component.json"
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elev: {
|
|
|
|
files: [{
|
|
|
|
src: ['src/geolib.elevation.js'],
|
|
|
|
dest: 'dist/geolib.elevation.js'
|
|
|
|
}]
|
2016-05-16 13:33:49 +02:00
|
|
|
},
|
|
|
|
pointInside: {
|
|
|
|
files: [{
|
|
|
|
src: ['src/geolib.isPointInsideRobust.js'],
|
|
|
|
dest: 'dist/geolib.isPointInsideRobust.js'
|
|
|
|
}]
|
|
|
|
},
|
2014-08-10 11:37:05 +02:00
|
|
|
},
|
|
|
|
replace: {
|
|
|
|
version: {
|
2016-05-16 13:33:49 +02:00
|
|
|
src: ['dist/*.js', 'bower.json', 'README.md'],
|
2014-08-10 11:37:05 +02:00
|
|
|
overwrite: true,
|
2016-05-16 13:33:49 +02:00
|
|
|
replacements: [
|
|
|
|
{
|
|
|
|
from: '$version$',
|
|
|
|
to: '<%= pkg.version %>'
|
|
|
|
}, {
|
|
|
|
from: /"version": "([0-9a-zA-Z\-\.\+]*)",/,
|
|
|
|
to: '"version": "<%= pkg.version %>",'
|
|
|
|
}, {
|
|
|
|
from: /v[0-9]+\.[0-9]{1,2}\.[0-9]{1,}/,
|
|
|
|
to: 'v<%= pkg.version %>'
|
|
|
|
}
|
|
|
|
]
|
2014-08-10 11:37:05 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
preserveComments: 'some'
|
|
|
|
},
|
|
|
|
main: {
|
|
|
|
files: {
|
|
|
|
'dist/geolib.min.js': ['dist/geolib.js']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
elev: {
|
|
|
|
files: {
|
|
|
|
'dist/geolib.elevation.min.js': ['dist/geolib.elevation.js']
|
|
|
|
}
|
2016-05-16 13:33:49 +02:00
|
|
|
},
|
|
|
|
pointInside: {
|
|
|
|
files: {
|
|
|
|
'dist/geolib.isPointInsideRobust.min.js': ['dist/geolib.isPointInsideRobust.js']
|
|
|
|
}
|
|
|
|
},
|
2014-08-10 11:37:05 +02:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
all: {
|
|
|
|
files: '<%= jshint.all %>',
|
|
|
|
tasks: ['default']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
all: [
|
|
|
|
'src/geolib.js',
|
2016-05-16 13:33:49 +02:00
|
|
|
'src/geolib.elevation.js',
|
|
|
|
'src/geolib.isPointInsideRobust.js',
|
2014-08-10 11:37:05 +02:00
|
|
|
],
|
|
|
|
options: {
|
|
|
|
curly: true,
|
|
|
|
eqeqeq: false,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: false,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
undef: true,
|
2016-05-16 13:33:49 +02:00
|
|
|
evil: true,
|
2014-08-10 11:37:05 +02:00
|
|
|
boss: true,
|
|
|
|
eqnull: true,
|
|
|
|
globals: {
|
|
|
|
module: true,
|
|
|
|
define: true,
|
|
|
|
require: true,
|
|
|
|
elevationResult: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Default task.
|
|
|
|
grunt.registerTask('default', ['concat:main', 'copy', 'replace', 'uglify']);
|
|
|
|
grunt.registerTask('travis', ['jshint','qunit']);
|
|
|
|
grunt.registerTask('test', ['qunit']);
|
|
|
|
|
|
|
|
};
|