Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
add cdn deployment code
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickarlt committed Nov 12, 2013
1 parent 184fe41 commit cd79e2a
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
examples
examples
versions
source
out
docs
39 changes: 32 additions & 7 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@

module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

meta: {
version: '0.0.1'
},
aws: grunt.file.readJSON(process.env.HOME + '/terraformer-s3.json'),
pkg: grunt.file.readJSON('package.json'),

jshint: {
files: [ 'gruntfile.js', 'terraformer.js' ],
Expand All @@ -17,14 +14,18 @@ module.exports = function (grunt) {
uglify: {
options: {
report: 'gzip',
banner: '/*! Terraformer JS - <%= meta.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
banner: '/*! Terraformer JS - <%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* https://github.com/esri/Terraformer\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> Environmental Systems Research Institute, Inc.\n' +
'* Licensed MIT */'
},
terraformer: {
src: ['terraformer.js'],
dest: 'terraformer.min.js'
},
versioned: {
src: ['terraformer.js'],
dest: 'versions/terraformer-<%= pkg.version %>.min.js'
}
},

Expand Down Expand Up @@ -76,6 +77,28 @@ module.exports = function (grunt) {
maintainability: 65
}
}
},

s3: {
options: {
key: '<%= aws.key %>',
secret: '<%= aws.secret %>',
bucket: '<%= aws.bucket %>',
access: 'public-read',
headers: {
// 1 Year cache policy (1000 * 60 * 60 * 24 * 365)
"Cache-Control": "max-age=630720000, public",
"Expires": new Date(Date.now() + 63072000000).toUTCString()
}
},
dev: {
upload: [
{
src: 'versions/terraformer-<%= pkg.version %>.min.js',
dest: 'terraformer/<%= pkg.version %>/terraformer.min.js'
}
]
},
}
});

Expand All @@ -85,7 +108,9 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-complexity');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.loadNpmTasks('grunt-s3');

grunt.registerTask('test', ['jshint', 'jasmine_node', 'jasmine']);
grunt.registerTask('default', ['test', 'uglify', 'complexity' ]);
grunt.registerTask('version', ['test', 'uglify', 's3']);
grunt.registerTask('default', ['test']);
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"grunt-complexity": "~0.1.3",
"grunt-contrib-jasmine": "~0.4.2",
"grunt-jasmine-node": "https://github.com/magicmoose/grunt-jasmine-node/tarball/master",
"grunt-template-jasmine-istanbul": "~0.2.4"
"grunt-template-jasmine-istanbul": "~0.2.4",
"grunt-s3": "~0.2.0-alpha.3"
},
"scripts": {
"test": "grunt test"
Expand Down
15 changes: 10 additions & 5 deletions spec/terraformerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ describe("Primitives", function(){
});

it("should calculate convex hull", function(){
expect(multiPoint.convexHull()).toEqual([[-45, 122], [100, 0]]);
expect(multiPoint.convexHull().coordinates).toEqual([[-45, 122], [100, 0]]);
expect(multiPoint.convexHull().type).toEqual("Polygon");
});

it("should calculate envelope", function(){
Expand Down Expand Up @@ -271,7 +272,8 @@ describe("Primitives", function(){
});

it("should calculate convex hull", function(){
expect(lineString.convexHull()).toEqual([ [-45, 122], [100, 0]]);
expect(lineString.convexHull().coordinates).toEqual([ [-45, 122], [100, 0]]);
expect(lineString.convexHull().type).toEqual("Polygon");
});

it("should calculate envelope", function(){
Expand Down Expand Up @@ -310,7 +312,8 @@ describe("Primitives", function(){
});

it("should calculate convex hull", function(){
expect(multiLineString.convexHull()).toEqual([ [ -115, 55 ], [ -110, 45 ], [ -105, 40 ], [ -100, 40 ], [ -110, 55 ] ]);
expect(multiLineString.convexHull().coordinates).toEqual([ [ -115, 55 ], [ -110, 45 ], [ -105, 40 ], [ -100, 40 ], [ -110, 55 ] ]);
expect(multiLineString.convexHull().type).toEqual("Polygon");
});

it("should calculate envelope", function(){
Expand Down Expand Up @@ -369,7 +372,8 @@ describe("Primitives", function(){
});

it("should calculate convex hull", function(){
expect(polygon.convexHull()).toEqual([ [ 100, 1 ], [ 100, 0 ], [ 101, 0 ], [ 101, 1 ] ]);
expect(polygon.convexHull().coordinates).toEqual([ [ 100, 1 ], [ 100, 0 ], [ 101, 0 ], [ 101, 1 ] ]);
expect(polygon.convexHull().type).toEqual("Polygon");
});

it("should calculate envelope", function(){
Expand Down Expand Up @@ -415,7 +419,8 @@ describe("Primitives", function(){
});

it("should calculate convex hull", function (){
expect(multiPolygon.convexHull()).toEqual([ [ 102, 3 ], [ 100, 1 ], [ 100, 0 ], [ 101, 0 ], [ 103, 2 ], [ 103, 3 ] ]);
expect(multiPolygon.convexHull().coordinates).toEqual([ [ 102, 3 ], [ 100, 1 ], [ 100, 0 ], [ 101, 0 ], [ 103, 2 ], [ 103, 3 ] ]);
expect(multiPolygon.convexHull().type).toEqual("Polygon");
});

it("should calculate envelope", function(){
Expand Down
2 changes: 1 addition & 1 deletion terraformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@

Primitive.prototype.contains = function(primitive){
return new Primitive(primitive).within(this);
}
};

Primitive.prototype.within = function(primitive) {
var coordinates, i, contains;
Expand Down
Loading

0 comments on commit cd79e2a

Please sign in to comment.