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

Commit

Permalink
Merge pull request #1 from mwisner/bugfix/fastboot
Browse files Browse the repository at this point in the history
Fastboot Support
  • Loading branch information
mwisner authored Sep 6, 2017
2 parents 6d38344 + 54ad0fc commit e82afdf
Show file tree
Hide file tree
Showing 8 changed files with 399 additions and 52 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default
#- EMBER_TRY_SCENARIO=fastboot-addon-tests

matrix:
fast_finish: true
Expand Down
7 changes: 7 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ module.exports = {
npm: {
devDependencies: {}
}
},
{
name: 'fastboot-addon-tests',
command: 'ember fastboot:test',
bower: {
dependencies: {}
}
}
]
};
12 changes: 12 additions & 0 deletions fastboot-tests/fixtures/fastboot/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
location: config.locationType,
rootURL: config.rootURL
});

Router.map(function() {
});

export default Router;
1 change: 1 addition & 0 deletions fastboot-tests/fixtures/fastboot/app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>ember-fastboot-addon-tests</h1>
22 changes: 22 additions & 0 deletions fastboot-tests/index-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const expect = require('chai').expect;
const setupTest = require('ember-fastboot-addon-tests').setupTest;

describe('index', function() {
setupTest('fastboot'/*, options */);

it('renders', function() {
return this.visit('/')
.then(function(res) {
let $ = res.jQuery;
let response = res.response;

// add your real tests here
expect(response.statusCode).to.equal(200);
expect($('body').length).to.equal(1);
expect($('h1').text().trim()).to.equal('ember-fastboot-addon-tests');
});
});

});
41 changes: 21 additions & 20 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@
const path = require('path');
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
const map = require('broccoli-stew').map;

module.exports = {
name: 'ember-videojs-dash',

included: function(app) {
included: function (app) {
this._super.included.apply(this, arguments);

if (!process.env.EMBER_CLI_FASTBOOT) {
let options = app.options.videojs || {};
app.import({
development: path.join('vendor/dash.all.debug.js'),
production: path.join('vendor/dash.all.min.js')
});

app.import({
development: path.join('vendor/dash.all.debug.js'),
production: path.join('vendor/dash.all.min.js')
});
app.import({
development: path.join('vendor/videojs-dash.js'),
production: path.join('vendor/videojs-dash.min.js')
});

app.import({
development: path.join('vendor/videojs-dash.js'),
production: path.join('vendor/videojs-dash.min.js')
});

}
},

treeForVendor(vendorTree) {
Expand All @@ -34,13 +31,17 @@ module.exports = {
trees.push(vendorTree);
}

trees.push(
new Funnel(path.join(this.project.root, 'node_modules', 'dashjs', 'dist'))
);

trees.push(
new Funnel(path.join(this.project.root, 'node_modules', 'videojs-contrib-dash', 'dist'))
);
//
// Dash Library
let dashLib = new Funnel(path.join(this.project.root, 'node_modules', 'dashjs', 'dist'));
dashLib = map(dashLib, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);
trees.push(dashLib);

//
// Videojs Dash
let videojsDash = new Funnel(path.join(this.project.root, 'node_modules', 'videojs-contrib-dash', 'dist'));
videojsDash = map(videojsDash, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);
trees.push(videojsDash);

return new MergeTrees(trees);
},
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ember-addon"
],
"license": "MIT",
"author": "",
"author": "Matt Wisner",
"directories": {
"doc": "doc",
"test": "tests"
Expand All @@ -20,13 +20,16 @@
"dependencies": {
"broccoli-funnel": "^2.0.1",
"broccoli-merge-trees": "^2.0.0",
"broccoli-stew": "^1.5.0",
"dashjs": "^2.5.0",
"ember-cli-babel": "^6.3.0",
"ember-cli-videojs-shim": "https://github.com/mwisner/ember-cli-videojs-shim.git#feat/npm",
"videojs-contrib-dash": "^2.9.1"
},
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"broccoli-merge-trees": "^2.0.0",
"chai": "^4.1.2",
"ember-ajax": "^3.0.0",
"ember-cli": "~2.14.0",
"ember-cli-dependency-checker": "^1.3.0",
Expand All @@ -40,6 +43,7 @@
"ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-export-application-global": "^2.0.0",
"ember-fastboot-addon-tests": "^0.4.0",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.0.0",
"ember-source": "~2.14.0",
Expand Down
Loading

0 comments on commit e82afdf

Please sign in to comment.