Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Experimentally added travis-ci

Added qunit test to grunt.js
  • Loading branch information...
commit 64c2fbfc24d43baa718836b72a3d78a81e029e81 1 parent be8a06b
@manuelbieh authored
Showing with 30 additions and 11 deletions.
  1. +14 −6 geolib.js
  2. +4 −3 grunt.js
  3. +6 −2 package.json
  4. +6 −0 travis.yml
View
20 geolib.js
@@ -33,19 +33,24 @@
* }
*/
getKeys: function(point) {
+
var latitude = point.hasOwnProperty('lat') ? 'lat' : 'latitude';
+
var longitude = (point.hasOwnProperty('lng') ? 'lng' : false) ||
- (point.hasOwnProperty('long') ? 'long' : false) ||
- 'longitude';
+ (point.hasOwnProperty('long') ? 'long' : false) ||
+ 'longitude';
+
var elevation = (point.hasOwnProperty('alt') ? 'alt' : false) ||
- (point.hasOwnProperty('altitude') ? 'altitude' : false) ||
- (point.hasOwnProperty('elev') ? 'elev' : false) ||
- 'elevation';
+ (point.hasOwnProperty('altitude') ? 'altitude' : false) ||
+ (point.hasOwnProperty('elev') ? 'elev' : false) ||
+ 'elevation';
+
return {
latitude: latitude,
longitude: longitude,
elevation: elevation
};
+
},
/**
@@ -670,7 +675,7 @@
'samples': path.length
};
var elevationService = new google.maps.ElevationService();
- elevationService.getElevationAlongPath(positionalRequest,function (results, status){
+ elevationService.getElevationAlongPath(positionalRequest,function (results, status) {
geolib.elevationHandler(results, status, coords, keys, cb);
});
@@ -692,13 +697,16 @@
//coords[0]
var latitude = keys.latitude;
var longitude = keys.longitude;
+
for(var i = 0; i < coords.length; i++) {
path.push(geolib.useDecimal(coords[i][latitude]) + ',' +
geolib.useDecimal(coords[i][longitude]));
}
+
gm.elevationFromPath(path.join('|'), path.length, function(err, results) {
geolib.elevationHandler(results.results, results.status, coords, keys, cb);
});
+
},
elevationHandler: function(results, status, coords, keys, cb){
View
7 grunt.js
@@ -18,8 +18,8 @@ module.exports = function(grunt) {
lint: {
files: ['geolib.js']
},
- test: {
- files: ['tests/*.js']
+ qunit: {
+ files: ['tests/*.html']
},
concat: {
dist: {
@@ -57,6 +57,7 @@ module.exports = function(grunt) {
// Default task.
//grunt.registerTask('default', 'lint test concat min');
- grunt.registerTask('default', 'lint concat min');
+ grunt.registerTask('default', 'lint qunit concat min');
+ grunt.registerTask('travis', 'lint qunit');
};
View
8 package.json
@@ -13,7 +13,8 @@
"url": "http://github.com/manuelbieh/geolib.git"
},
"dependencies": {
- "googlemaps": ">= 0.1.6"
+ "googlemaps": ">= 0.1.6",
+ "grunt": ">=0.3.9"
},
"devDependencies": {
"mocha": "*"
@@ -33,6 +34,9 @@
"geo",
"distance"
],
- "version": "1.1.8",
+ "scripts": {
+ "test": "grunt travis --verbose"
+ },
+ "version": "1.2.0",
"main": "./geolib"
}
View
6 travis.yml
@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+ - 0.6
+before_script:
+ - "export DISPLAY=:99.0"
+ - "sh -e /etc/init.d/xvfb start"
Please sign in to comment.
Something went wrong with that request. Please try again.