Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bneigher committed Dec 14, 2016
2 parents fb55740 + 200560b commit 25324d9
Show file tree
Hide file tree
Showing 8 changed files with 47,481 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### v1.2.0
- Ported to work both on the client side as well as server side

### v1.1.2
- Fix typo

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ ptolemy.getProjection('epsg:2004', 'proj4')
"proj4": "+proj=tmerc +lat_0=0 +lon_0=-62 +k=0.9995000000000001 +x_0=400000 +y_0=0 +ellps=clrk80 +towgs84=174,359,365,0,0,0,0 +units=m +no_defs"
}
```
### Bundling
To build this library, run:
```
gulp build
```
This will make a bundled version which is used when included in the browser.


### Ptolemy Configuration

Expand Down
47,376 changes: 47,376 additions & 0 deletions dist/ptolemy.js

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
'use strict';

const Gulp = require('gulp');
const Rename = require('gulp-rename');
const Source = require('vinyl-source-stream');
const Browserify = require('browserify');
const Derequire = require('gulp-derequire');
const Watchify = require('watchify');
const Babelify = require('babelify');
const Notify = require('gulp-notify');


function compile (watch) {
let bundler = Browserify({
// Required watchify args
cache: {}, packageCache: {},
// Specify the entry point of your app
entries: ['./lib/ptolemy.js'],
// Enable source maps!
debug: true,
// Allows this to be included from as bundled library
standalone: 'window'
});

bundler
.transform(Babelify.configure({
presets: ['latest']
}))
.transform('debowerify');

let bundle = function () {
console.log('Bundling ->');
return bundler.bundle()
.on('error', function() {
let args = Array.prototype.slice.call(arguments);
// Send error to notification center with gulp-notify
Notify.onError({
title: 'Compile Error',
message: '<%= error.message %>'
}).apply(this, args);

// Keep gulp from hanging on this task
this.emit('end');
})
.pipe(Source('./index.js'))
.pipe(Derequire())
.pipe(Rename('ptolemy.js'))
.pipe(Gulp.dest('dist/'))
};

if (watch) {
bundler = Watchify(bundler)
.on('update', bundle);

return bundle();
}

return bundle();
}

function watch() {
return compile(true);
};

Gulp.task('build', function () { return compile(); });
Gulp.task('watch', function() { return watch(); });


1 change: 0 additions & 1 deletion lib/adapters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class BaseAdapter {

makeRequest (method, url, data, options) {
options = options || {};

return new Promise((resolve, reject) => {
Needle.request(method, url, data, options, (err, res) => {
if (err) {
Expand Down
13 changes: 8 additions & 5 deletions lib/ptolemy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use strict';


const Errors = require('./errors');
const UnknownCRSError = Errors.UnknownCRSError;

const Logger = console;

const Epsgio = require('./adapters/epsgio');
const Skycatch = require('./adapters/skycatch');
const adapters = {};

class Ptolemy {
Expand All @@ -21,8 +25,8 @@ class Ptolemy {

static get bundledAdapters () {
return [
'epsgio',
'skycatch'
{name: 'epsgio', adapter: Epsgio},
{name: 'skycatch', adapter: Skycatch}
];
}

Expand Down Expand Up @@ -59,9 +63,8 @@ class Ptolemy {
}

static registerBundledAdapters () {
Ptolemy.bundledAdapters.forEach(function (filename) {
let adapter = require(`./adapters/${filename}`);
Ptolemy.registerAdapter(filename, adapter);
Ptolemy.bundledAdapters.forEach(function (adapter) {
Ptolemy.registerAdapter(adapter.name, adapter.adapter);
});
}

Expand Down
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "ptolemy",
"version": "1.1.2",
"version": "1.2.0",
"description": "Retrieve geographic projection information from an EPSG SRID",
"main": "index.js",
"browser": {
"index.js": "./dist/ptolemy.js"
},
"scripts": {
"test": "lab -r console"
},
Expand All @@ -27,12 +30,23 @@
},
"homepage": "https://github.com/Skycatch/ptolemy",
"dependencies": {
"needle": "^1.0.0",
"xml2js": "^0.4.16"
"needle": "^1.4.2",
"xml2js": "^0.4.17"
},
"devDependencies": {
"babel-preset-latest": "^6.16.0",
"babelify": "^7.3.0",
"browserify": "^13.1.1",
"code": "^4.0.0",
"debowerify": "^1.5.0",
"derequire": "^2.0.3",
"eslint-bootstrap": "github:skycatch/eslint-bootstrap",
"lab": "^11.1.0"
"gulp": "^3.9.1",
"gulp-derequire": "^2.1.0",
"gulp-notify": "^2.2.0",
"gulp-rename": "^1.2.2",
"lab": "^11.1.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
}
}
2 changes: 1 addition & 1 deletion test/ptolemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const Code = require('code');
const Lab = require('lab');
const Ptolemy = require('../');
const Ptolemy = require('../index');

const lab = exports.lab = Lab.script();
const describe = lab.describe;
Expand Down

0 comments on commit 25324d9

Please sign in to comment.