├── app ├── .gitkeep └── initializers │ └── hellgate.js ├── vendor ├── .gitkeep └── ember-hellgate.css ├── tests ├── unit │ └── .gitkeep ├── dummy │ ├── app │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ ├── routes │ │ │ ├── .gitkeep │ │ │ └── escape.js │ │ ├── components │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── templates │ │ │ ├── components │ │ │ │ └── .gitkeep │ │ │ ├── nested │ │ │ │ ├── regular.hbs │ │ │ │ └── index.hbs │ │ │ ├── nested.hbs │ │ │ └── application.hbs │ │ ├── resolver.js │ │ ├── styles │ │ │ └── app.css │ │ ├── app.js │ │ ├── router.js │ │ └── index.html │ ├── public │ │ ├── robots.txt │ │ ├── test1.html │ │ ├── test2.html │ │ ├── nested-page.html │ │ ├── test-escape.html │ │ └── crossdomain.xml │ └── config │ │ └── environment.js ├── test-helper.js ├── helpers │ ├── destroy-app.js │ ├── resolver.js │ ├── start-app.js │ └── module-for-acceptance.js ├── .jshintrc ├── index.html └── acceptance │ └── show-page-test.js ├── .watchmanconfig ├── .bowerrc ├── addon ├── controller.js ├── templates │ └── view.hbs └── setup.js ├── config ├── environment.js └── ember-try.js ├── index.js ├── bower.json ├── testem.json ├── .npmignore ├── testem.js ├── .ember-cli ├── .gitignore ├── ember-cli-build.js ├── .jshintrc ├── .editorconfig ├── .travis.yml ├── LICENSE.md ├── package.json └── README.md /app/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/nested/regular.hbs: -------------------------------------------------------------------------------- 1 | My regular Ember page -------------------------------------------------------------------------------- /tests/dummy/app/templates/nested/index.hbs: -------------------------------------------------------------------------------- 1 | My nested index page 2 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tests/dummy/app/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | 3 | export default Resolver; 4 | -------------------------------------------------------------------------------- /vendor/ember-hellgate.css: -------------------------------------------------------------------------------- 1 | .hellgate-iframe { 2 | height: 100%; 3 | width: 100%; 4 | border: 0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/dummy/public/test1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My first test 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/dummy/public/test2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My second test 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/dummy/public/nested-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My nested page 4 | 5 | 6 | -------------------------------------------------------------------------------- /addon/controller.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Controller.extend({ 4 | url: null 5 | }); 6 | -------------------------------------------------------------------------------- /addon/templates/view.hbs: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | 'use strict'; 3 | 4 | module.exports = function(/* environment, appConfig */) { 5 | return { }; 6 | }; 7 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | 6 | setResolver(resolver); 7 | -------------------------------------------------------------------------------- /tests/helpers/destroy-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default function destroyApp(application) { 4 | Ember.run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- 1 | .hellgate-container { 2 | width: 100px; 3 | height: 200px; 4 | border: 1px solid red; 5 | } 6 | 7 | a.active { 8 | color: red; 9 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | module.exports = { 5 | name: 'ember-hellgate', 6 | 7 | included: function(app) { 8 | app.import('vendor/ember-hellgate.css'); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /tests/dummy/public/test-escape.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Escape hell 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-hellgate", 3 | "dependencies": { 4 | "ember": "~2.4.1", 5 | "ember-cli-shims": "0.1.0", 6 | "ember-cli-test-loader": "0.2.2", 7 | "ember-qunit-notifications": "0.1.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/initializers/hellgate.js: -------------------------------------------------------------------------------- 1 | import setupHellgate from 'ember-hellgate/setup'; 2 | 3 | setupHellgate(); 4 | 5 | export function initialize(application) { 6 | 7 | } 8 | 9 | export default { 10 | name: 'ember-hellgate', 11 | initialize 12 | }; 13 | -------------------------------------------------------------------------------- /testem.json: -------------------------------------------------------------------------------- 1 | { 2 | "framework": "qunit", 3 | "test_page": "tests/index.html?hidepassed", 4 | "disable_watching": true, 5 | "launch_in_ci": [ 6 | "PhantomJS" 7 | ], 8 | "launch_in_dev": [ 9 | "PhantomJS", 10 | "Chrome" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/nested.hbs: -------------------------------------------------------------------------------- 1 |

Nested header

2 | 3 | {{link-to "Index page" "nested.index"}} 4 | {{link-to "Regular page" "nested.regular"}} 5 | {{link-to "Nested page" "nested.page"}} 6 | 7 |
8 |
9 | 10 | {{outlet}} -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /bower_components 2 | /config/ember-try.js 3 | /dist 4 | /tests 5 | /tmp 6 | **/.gitkeep 7 | .bowerrc 8 | .editorconfig 9 | .ember-cli 10 | .gitignore 11 | .jshintrc 12 | .watchmanconfig 13 | .travis.yml 14 | bower.json 15 | ember-cli-build.js 16 | testem.js 17 | .idea/ 18 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 | {{link-to "Test 1" "test1" class="link1"}} 2 | {{link-to "Test 2" "test2" class="link2"}} 3 | {{link-to "Escape" "escape"}} 4 | {{link-to "Nested page" "nested.page"}} 5 |

6 | 7 |
{{message}}
8 | 9 | {{outlet}} 10 | -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | "framework": "qunit", 4 | "test_page": "tests/index.html?hidepassed", 5 | "disable_watching": true, 6 | "launch_in_ci": [ 7 | "PhantomJS" 8 | ], 9 | "launch_in_dev": [ 10 | "PhantomJS", 11 | "Chrome" 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/escape.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Route.extend({ 4 | 5 | actions: { 6 | setMessage(message) { 7 | var applicationController = this.controllerFor('application'); 8 | applicationController.set('message', message); 9 | } 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from '../../resolver'; 2 | import config from '../../config/environment'; 3 | 4 | const resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | .idea/ 19 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from './resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | let App; 7 | 8 | Ember.MODEL_FACTORY_INJECTIONS = true; 9 | 10 | App = Ember.Application.extend({ 11 | modulePrefix: config.modulePrefix, 12 | podModulePrefix: config.podModulePrefix, 13 | Resolver 14 | }); 15 | 16 | loadInitializers(App, config.modulePrefix); 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import config from './config/environment'; 3 | 4 | const Router = Ember.Router.extend({ 5 | location: config.locationType 6 | }); 7 | 8 | Router.map(function() { 9 | this.hellgate('test1', '/test1.html'); 10 | this.hellgate('test2', '/test2.html'); 11 | this.hellgate('escape', '/test-escape.html'); 12 | this.route('nested', function() { 13 | this.route('regular'); 14 | this.hellgate('page', '/nested-page.html'); 15 | }); 16 | }); 17 | 18 | export default Router; 19 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Application from '../../app'; 3 | import config from '../../config/environment'; 4 | 5 | export default function startApp(attrs) { 6 | let application; 7 | 8 | let attributes = Ember.merge({}, config.APP); 9 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 10 | 11 | Ember.run(() => { 12 | application = Application.create(attributes); 13 | application.setupForTesting(); 14 | application.injectTestHelpers(); 15 | }); 16 | 17 | return application; 18 | } 19 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | /* global require, module */ 3 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | module.exports = function(defaults) { 6 | var app = new EmberAddon(defaults, { 7 | // Add options here 8 | }); 9 | 10 | /* 11 | This build file specifies the options for the dummy test app of this 12 | addon, located in `/tests/dummy` 13 | This build file does *not* influence how the addon or the app using it 14 | behave. You most likely want to be modifying `./index.js` or app's build file 15 | */ 16 | 17 | return app.toTree(); 18 | }; 19 | -------------------------------------------------------------------------------- /tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import startApp from '../helpers/start-app'; 3 | import destroyApp from '../helpers/destroy-app'; 4 | 5 | export default function(name, options = {}) { 6 | module(name, { 7 | beforeEach() { 8 | this.application = startApp(); 9 | 10 | if (options.beforeEach) { 11 | options.beforeEach.apply(this, arguments); 12 | } 13 | }, 14 | 15 | afterEach() { 16 | if (options.afterEach) { 17 | options.afterEach.apply(this, arguments); 18 | } 19 | 20 | destroyApp(this.application); 21 | } 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "-Promise" 6 | ], 7 | "browser": true, 8 | "boss": true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.js] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.hbs] 21 | insert_final_newline = false 22 | indent_style = space 23 | indent_size = 2 24 | 25 | [*.css] 26 | indent_style = space 27 | indent_size = 2 28 | 29 | [*.html] 30 | indent_style = space 31 | indent_size = 2 32 | 33 | [*.{diff,md}] 34 | trim_trailing_whitespace = false 35 | -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | 12 | 13 | 14 | 15 | {{content-for "head-footer"}} 16 | 17 | 18 | {{content-for "body"}} 19 | 20 | 21 | 22 | 23 | {{content-for "body-footer"}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | 6 | sudo: false 7 | 8 | cache: 9 | directories: 10 | - node_modules 11 | 12 | env: 13 | - EMBER_TRY_SCENARIO=default 14 | - EMBER_TRY_SCENARIO=ember-1-13 15 | - EMBER_TRY_SCENARIO=ember-release 16 | - EMBER_TRY_SCENARIO=ember-beta 17 | - EMBER_TRY_SCENARIO=ember-canary 18 | 19 | matrix: 20 | fast_finish: true 21 | allow_failures: 22 | - env: EMBER_TRY_SCENARIO=ember-canary 23 | 24 | before_install: 25 | - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH 26 | - "npm config set spin false" 27 | - "npm install -g npm@^2" 28 | 29 | install: 30 | - npm install -g bower 31 | - npm install 32 | - bower install 33 | 34 | script: 35 | - ember try $EMBER_TRY_SCENARIO test 36 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "define", 10 | "console", 11 | "visit", 12 | "exists", 13 | "fillIn", 14 | "click", 15 | "keyEvent", 16 | "triggerEvent", 17 | "find", 18 | "findWithAssert", 19 | "wait", 20 | "DS", 21 | "andThen", 22 | "currentURL", 23 | "currentPath", 24 | "currentRouteName" 25 | ], 26 | "node": false, 27 | "browser": false, 28 | "boss": true, 29 | "curly": true, 30 | "debug": false, 31 | "devel": false, 32 | "eqeqeq": true, 33 | "evil": true, 34 | "forin": false, 35 | "immed": false, 36 | "laxbreak": false, 37 | "newcap": true, 38 | "noarg": true, 39 | "noempty": false, 40 | "nonew": false, 41 | "nomen": false, 42 | "onevar": false, 43 | "plusplus": false, 44 | "regexp": false, 45 | "undef": true, 46 | "sub": true, 47 | "strict": false, 48 | "white": false, 49 | "eqnull": true, 50 | "esnext": true, 51 | "unused": true 52 | } 53 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | {{content-for "body-footer"}} 32 | {{content-for "test-body-footer"}} 33 | 34 | 35 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | scenarios: [ 4 | { 5 | name: 'default', 6 | bower: { 7 | dependencies: { } 8 | } 9 | }, 10 | { 11 | name: 'ember-1-13', 12 | bower: { 13 | dependencies: { 14 | 'ember': '~1.13.0' 15 | }, 16 | resolutions: { 17 | 'ember': '~1.13.0' 18 | } 19 | } 20 | }, 21 | { 22 | name: 'ember-release', 23 | bower: { 24 | dependencies: { 25 | 'ember': 'components/ember#release' 26 | }, 27 | resolutions: { 28 | 'ember': 'release' 29 | } 30 | } 31 | }, 32 | { 33 | name: 'ember-beta', 34 | bower: { 35 | dependencies: { 36 | 'ember': 'components/ember#beta' 37 | }, 38 | resolutions: { 39 | 'ember': 'beta' 40 | } 41 | } 42 | }, 43 | { 44 | name: 'ember-canary', 45 | bower: { 46 | dependencies: { 47 | 'ember': 'components/ember#canary' 48 | }, 49 | resolutions: { 50 | 'ember': 'canary' 51 | } 52 | } 53 | } 54 | ] 55 | }; 56 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 3 | module.exports = function(environment) { 4 | var ENV = { 5 | modulePrefix: 'dummy', 6 | environment: environment, 7 | baseURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. 'with-controller': true 13 | } 14 | }, 15 | 16 | APP: { 17 | // Here you can pass flags/options to your application instance 18 | // when it is created 19 | } 20 | }; 21 | 22 | if (environment === 'development') { 23 | // ENV.APP.LOG_RESOLVER = true; 24 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 25 | // ENV.APP.LOG_TRANSITIONS = true; 26 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 27 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 28 | } 29 | 30 | if (environment === 'test') { 31 | // Testem prefers this... 32 | ENV.baseURL = '/'; 33 | ENV.locationType = 'none'; 34 | 35 | // keep test console output quieter 36 | ENV.APP.LOG_ACTIVE_GENERATION = false; 37 | ENV.APP.LOG_VIEW_LOOKUPS = false; 38 | 39 | ENV.APP.rootElement = '#ember-testing'; 40 | } 41 | 42 | if (environment === 'production') { 43 | 44 | } 45 | 46 | return ENV; 47 | }; 48 | -------------------------------------------------------------------------------- /addon/setup.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import HellgateController from './controller'; 3 | import template from "ember-hellgate/templates/view"; 4 | import getOwner from 'ember-getowner-polyfill'; 5 | 6 | const {Router, RouterDSL, String, run} = Ember; 7 | 8 | const dasherize = String.dasherize; 9 | 10 | let gates = []; 11 | 12 | function canNest(dsl) { 13 | return dsl.parent && dsl.parent !== 'application'; 14 | } 15 | 16 | function getFullName(dsl, name, resetNamespace) { 17 | if (canNest(dsl) && resetNamespace !== true) { 18 | return `${dsl.parent}.${name}`; 19 | } else { 20 | return name; 21 | } 22 | } 23 | 24 | function setupHellgate() { 25 | RouterDSL.prototype.hellgate = function(name, url, options = {}) { 26 | if (!name || !url) { throw new Error("You must provide at least a name and URL to `hellgate`."); } 27 | 28 | this.route(name, options); 29 | 30 | let fullName = getFullName(this, name, options.resetNamespace); 31 | gates.push([fullName, url]); 32 | }; 33 | 34 | Router.reopen({ 35 | setupRouter() { 36 | const ret = this._super(...arguments); 37 | const owner = getOwner(this); 38 | 39 | gates.forEach(([fullName, url]) => { 40 | let moduleName = dasherize(fullName); 41 | owner.register(`template:${moduleName}`, template); 42 | owner.register(`controller:${moduleName}`, HellgateController.extend({url: url})); 43 | }); 44 | 45 | window.escapeHell = (...args) => { 46 | run(() => { 47 | this.send(...args); 48 | }); 49 | }; 50 | 51 | return ret; 52 | } 53 | }); 54 | } 55 | 56 | export default setupHellgate; 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-hellgate", 3 | "version": "0.2.0", 4 | "description": "This addon helps you migrate an old application to Ember. It lets you define routes that load plain html pages inside an Ember app.", 5 | "directories": { 6 | "doc": "doc", 7 | "test": "tests" 8 | }, 9 | "scripts": { 10 | "build": "ember build", 11 | "start": "ember server", 12 | "test": "ember try:testall" 13 | }, 14 | "repository": "https://github.com/diogomafra/ember-hellgate", 15 | "engines": { 16 | "node": ">= 0.10.0" 17 | }, 18 | "author": "Diogo Edegar Mafra", 19 | "contributors": [ 20 | { 21 | "name": "Robert Wagner", 22 | "email": "rwwagner90@gmail.com", 23 | "url": "https://github.com/rwwagner90" 24 | } 25 | ], 26 | "license": "MIT", 27 | "devDependencies": { 28 | "broccoli-asset-rev": "^2.2.0", 29 | "ember-ajax": "0.7.1", 30 | "ember-cli": "2.4.2", 31 | "ember-cli-app-version": "^1.0.0", 32 | "ember-cli-dependency-checker": "^1.2.0", 33 | "ember-cli-htmlbars-inline-precompile": "^0.3.1", 34 | "ember-cli-inject-live-reload": "^1.3.1", 35 | "ember-cli-qunit": "^1.2.1", 36 | "ember-cli-release": "0.2.8", 37 | "ember-cli-sri": "^2.1.0", 38 | "ember-cli-uglify": "^1.2.0", 39 | "ember-disable-prototype-extensions": "^1.1.0", 40 | "ember-disable-proxy-controllers": "^1.0.1", 41 | "ember-export-application-global": "^1.0.4", 42 | "ember-getowner-polyfill": "1.0.1", 43 | "ember-load-initializers": "^0.5.0", 44 | "ember-resolver": "^2.0.3", 45 | "ember-try": "^0.1.2", 46 | "loader.js": "^4.0.0" 47 | }, 48 | "keywords": [ 49 | "ember-addon" 50 | ], 51 | "dependencies": { 52 | "ember-cli-babel": "^5.1.5", 53 | "ember-cli-htmlbars": "^1.0.1" 54 | }, 55 | "ember-addon": { 56 | "configPath": "tests/dummy/config" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ember-hellgate [![Build Status](https://travis-ci.org/diogomafra/ember-hellgate.svg?branch=master)](https://travis-ci.org/diogomafra/ember-hellgate) 2 | 3 | This addon helps you migrate an old application to Ember. It lets you define routes that load plain html pages inside an Ember app. 4 | 5 | Pages loaded in a hellgate are loaded inside an iframe, so, they're totally isolated from the Ember app. 6 | 7 | The objective of this addon is to let you create an Ember app that links to pages of the old system and, as you migrate each page to Ember, you replace the "hellgate" with normal routes. 8 | 9 | ## Install 10 | ```bash 11 | ember install ember-hellgate 12 | ``` 13 | 14 | 15 | ## Defining hellgates 16 | 17 | In the router you call `this.hellgate(route, url)` to define the name of the route and the url that should be loaded. 18 | 19 | ```js 20 | // app/router.js 21 | Router.map(function() { 22 | this.hellgate('some-page', '/somepage.html'); 23 | this.hellgate('my-search', 'http://apple.com'); 24 | }); 25 | ``` 26 | 27 | ### Escaping hell 28 | 29 | The page loaded inside a "hellgate" can call actions of the route. For that, you should use the function `escapeHell`. 30 | 31 | ```js 32 | // app/router.js 33 | Router.map(function() { 34 | this.hellgate('test', '/test.html'); 35 | }); 36 | ``` 37 | 38 | 39 | ```js 40 | 41 | 42 | 43 | Escape hell 44 | 47 | 48 | 49 | ``` 50 | 51 | ```js 52 | // app/routes/test.js 53 | export default Ember.Route.extend({ 54 | actions: { 55 | showMessage(message) { 56 | alert(`Message from hell: ${message}`); 57 | } 58 | } 59 | }); 60 | ``` 61 | 62 | ### Styling the hellgate 63 | 64 | The hellgate generates the following HTML: 65 | 66 | ```html 67 |
68 | 69 |
70 | ``` 71 | 72 | So you can define styles for the container and for the iframe: 73 | 74 | ```css 75 | .hellgate-container { 76 | width: 100px; 77 | height: 400px; 78 | border: 1px solid red; 79 | } 80 | ``` 81 | -------------------------------------------------------------------------------- /tests/acceptance/show-page-test.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import { module, test } from 'qunit'; 3 | import startApp from '../helpers/start-app'; 4 | 5 | module('Acceptance: show page', { 6 | beforeEach() { 7 | this.application = startApp(); 8 | }, 9 | afterEach() { 10 | Ember.run(this.application, 'destroy'); 11 | } 12 | }); 13 | 14 | test('displays the correct page', function(assert) { 15 | visit('/test1'); 16 | andThen(function() { 17 | iframeHasUrlWithContent(assert, '/test1.html', 'My first test'); 18 | }); 19 | 20 | visit('/test2'); 21 | andThen(function() { 22 | iframeHasUrlWithContent(assert, '/test2.html', 'My second test'); 23 | }); 24 | }); 25 | 26 | test('displays hellgates inside nested routes', function(assert) { 27 | visit('/nested/page'); 28 | andThen(function() { 29 | assert.equal(find('.header-title').text(), 'Nested header'); 30 | iframeHasUrlWithContent(assert, '/nested-page.html', 'My nested page'); 31 | }); 32 | }); 33 | 34 | test('displays nested ember pages next to a hellgate', function(assert) { 35 | visit('/nested'); 36 | andThen(function() { 37 | assert.equal(find('.header-title').text(), 'Nested header'); 38 | assert.equal(find('span').text(), 'My nested index page'); 39 | }); 40 | 41 | visit('/nested/regular'); 42 | andThen(function() { 43 | assert.equal(find('.header-title').text(), 'Nested header'); 44 | assert.equal(find('span').text(), 'My regular Ember page'); 45 | }); 46 | }); 47 | 48 | test('navigates through links', function(assert) { 49 | visit('/'); 50 | click('a.link2'); 51 | andThen(function() { 52 | iframeHasUrlWithContent(assert, '/test2.html', 'My second test'); 53 | }); 54 | 55 | visit('/'); 56 | click('a.link1'); 57 | andThen(function() { 58 | iframeHasUrlWithContent(assert, '/test1.html', 'My first test'); 59 | }); 60 | }); 61 | 62 | 63 | test('allows to escape hell', function(assert) { 64 | visit('/test1'); 65 | andThen(function() { 66 | Ember.run.later(() => { 67 | assert.equal(find('#the-message').text(), ''); 68 | }, 100); 69 | }); 70 | 71 | visit('/escape'); 72 | andThen(function() { 73 | Ember.run.later(() => { 74 | assert.equal(find('#the-message').text(), 'hello'); 75 | }, 100); 76 | }); 77 | }); 78 | 79 | function iframeHasUrlWithContent(assert, url, content) { 80 | // TODO: instead of waiting 200ms, check when the iframe has loaded. 81 | Ember.run.later(() => { 82 | assert.equal(find('iframe').attr('src'), url); 83 | assert.equal(find("iframe").contents().find('span').text(), content); 84 | }, 100); 85 | } 86 | --------------------------------------------------------------------------------