Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow execution on fastboot #110

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ Think of your map as a set of layers inside a container. Your main container wil
* `ember test`
* `ember test --server`

## Fastboot support

There's rudimentary support for fastboot right now. Node.js 6.0 an up work out of the box. For node.js < 6.0 you have to start the fastboot server with `--harmony_proxies` like `node --harmony_proxies node_modules/.bin/ember fastboot`.

## Building

* `ember build`
Expand Down
21 changes: 21 additions & 0 deletions addon/L.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* global L */

let L_ = null;

if (typeof L !== 'undefined') {
L_ = L;
} else {
let N = () => {};
let handler = {
get() {
return N;
}
};

L_ = Proxy.create ? Proxy.create(handler) : new Proxy({}, handler);
L_.Icon.Default = {};
L_.tileLayer.wms = N;
}

export default L_;

2 changes: 1 addition & 1 deletion addon/components/base-layer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import { ChildMixin } from 'ember-composability-tools';
import { InvokeActionMixin } from 'ember-invoke-action';
/* global L */
import L from 'ember-leaflet/L';

const { assert, computed, Component, run, K, A, String: { classify } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/div-icon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/icon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/lat-lng-bounds.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/point.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion app/initializers/leaflet-assets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ENV from '../config/environment';
/* global L */
import L from 'ember-leaflet/L';

export function initialize(/* container, application */) {
L.Icon.Default.imagePath = `${ENV.rootURL || ENV.baseURL || '/'}assets/images/`;
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module.exports = {
included: function(app) {
this._super.included.apply(this, arguments);

if (process.env.EMBER_CLI_FASTBOOT) {
return;
}

// If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just
// use that.
if (typeof this._findHost === 'function') {
Expand All @@ -23,7 +27,7 @@ module.exports = {
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));

//import javascript
app.import(app.bowerDirectory + '/leaflet/dist/leaflet-src.js');

Expand Down
2 changes: 1 addition & 1 deletion tests/assertions/bounds-contain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global L */
import L from 'ember-leaflet/L';

export default function boundsContain(bounds1, bounds2, msg = 'Bounds 1 doesn\'t contain bounds 2') {
// use this.push to add the assertion.
Expand Down
3 changes: 2 additions & 1 deletion tests/helpers/locations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global L */
import L from 'ember-leaflet/L';

export default {
nyc: L.latLng(40.713282, -74.006978),
sf: L.latLng(37.77493, -122.419415),
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/geojson-layer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assertionInjector, assertionCleanup } from '../../assertions';
import GeoJSONLayerComponent from 'ember-leaflet/components/geojson-layer';
import locations from '../../helpers/locations';
import sampleGeoJSON from '../../helpers/sample-geojson';
/* globals L */
import L from 'ember-leaflet/L';

const emptyGeoJSON = {
type: 'FeatureCollection',
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/leaflet-map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import hbs from 'htmlbars-inline-precompile';
import { assertionInjector, assertionCleanup } from '../../assertions';
import LeafletMapComponent from 'ember-leaflet/components/leaflet-map';
import locations from '../../helpers/locations';
/* global L */
import L from 'ember-leaflet/L';

let map;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/marker-collection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import wait from 'ember-test-helpers/wait';
import { assertionInjector, assertionCleanup } from '../../assertions';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

const { run } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/marker-layer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assertionInjector, assertionCleanup } from '../../assertions';
import hasEmberVersion from 'ember-test-helpers/has-ember-version';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

//Needed to silence leaflet autodetection error
L.Icon.Default.imagePath = 'some-path';
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/popup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import wait from 'ember-test-helpers/wait';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import ArrayPathLayerComponent from 'ember-leaflet/components/array-path-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

const { computed, run, A } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/tooltip-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import wait from 'ember-test-helpers/wait';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import ArrayPathLayerComponent from 'ember-leaflet/components/array-path-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

const { computed, run, A } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/div-icon-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { divIcon } from 'dummy/helpers/div-icon';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | div-icon');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/icon-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { icon } from 'dummy/helpers/icon';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | icon');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/lat-lng-bounds-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { latLngBounds } from 'dummy/helpers/lat-lng-bounds';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | lat-lng-bounds');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/point-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { point } from 'dummy/helpers/point';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | point');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/initializers/leaflet-assets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';
import ENV from '../../../config/environment';
import { initialize } from '../../../initializers/leaflet-assets';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

const { run, Application } = Ember;

Expand Down