-
Notifications
You must be signed in to change notification settings - Fork 34
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
Prepare for FastBoot 1.0 #21
Merged
rwjblue
merged 7 commits into
ember-fastboot:master
from
simonihmig:prepare-fastboot-1.0
Jun 1, 2017
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
abefcb7
Add FastBoot tests
simonihmig 8777d6a
Fix for FastBoot 1.0
simonihmig f4e7b7b
Added FastBoot 1.0 tests, fixed Travis
simonihmig e7fb768
Use addToFastBootTree hook
simonihmig 3b2ae51
Use new treeForFastBoot hook, run FastBoot tests against ember-cli-fa…
simonihmig a31877f
Fix missing merge of app-lt-2-10 for new FastBoot build
simonihmig 022a6e7
Fix FastBoot tests
simonihmig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Ember from 'ember'; | ||
import config from './config/environment'; | ||
|
||
const Router = Ember.Router.extend({ | ||
location: config.locationType, | ||
rootURL: config.rootURL | ||
}); | ||
|
||
Router.map(function() { | ||
this.route('other-page'); | ||
}); | ||
|
||
export default Router; |
10 changes: 10 additions & 0 deletions
10
fastboot-tests/fixtures/fastboot/app/routes/application.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Ember from 'ember'; | ||
|
||
const { set } = Ember; | ||
|
||
export default Ember.Route.extend({ | ||
headData: Ember.inject.service(), | ||
afterModel() { | ||
set(this, 'headData.title', "Hello page"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Ember from 'ember'; | ||
|
||
const { set } = Ember; | ||
|
||
export default Ember.Route.extend({ | ||
headData: Ember.inject.service(), | ||
afterModel() { | ||
set(this, 'headData.title', "Other page"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- Add content you wish automatically added to the documents head--> | ||
<!-- here. The 'model' available in this template can be populated by--> | ||
<!-- setting values on the 'head-data' service. --> | ||
|
||
<meta property="og:title" content={{model.title}} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Hello page</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Other page</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'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; | ||
|
||
expect(response.statusCode).to.equal(200); | ||
expect($('h1').text().trim()).to.equal('Hello page'); | ||
expect($('meta[property="og:title"]', 'head').attr('content')).to.equal('Hello page'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const setupTest = require('ember-fastboot-addon-tests').setupTest; | ||
|
||
describe('otherPage', function() { | ||
setupTest('fastboot'/*, options */); | ||
|
||
it('renders', function() { | ||
return this.visit('/other-page') | ||
.then(function(res) { | ||
let $ = res.jQuery; | ||
let response = res.response; | ||
|
||
expect(response.statusCode).to.equal(200); | ||
expect($('h1').text().trim()).to.equal('Other page'); | ||
expect($('meta[property="og:title"]', 'head').attr('content')).to.equal('Other page'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,29 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var filterInitializers = require('fastboot-filter-initializers'); | ||
var VersionChecker = require('ember-cli-version-checker'); | ||
var mergeTrees = require('broccoli-merge-trees'); | ||
const path = require('path'); | ||
const VersionChecker = require('ember-cli-version-checker'); | ||
const mergeTrees = require('broccoli-merge-trees'); | ||
|
||
module.exports = { | ||
name: 'ember-cli-head', | ||
|
||
treeForApp: function(defaultTree) { | ||
var checker = new VersionChecker(this); | ||
var emberVersion = checker.for('ember-source', 'npm'); | ||
treeForApp(defaultTree) { | ||
let checker = new VersionChecker(this); | ||
let emberVersion = checker.for('ember-source', 'npm'); | ||
|
||
if (!emberVersion.version) { | ||
emberVersion = checker.for('ember', 'bower'); | ||
} | ||
|
||
var trees = [defaultTree]; | ||
let trees = [defaultTree]; | ||
|
||
// 2.9.0-beta.1 - 2.9.0-beta.5 used glimmer2 (but 2.9.0 did not) | ||
// 2.10.0-beta.1+ includes glimmer2 | ||
if (!(emberVersion.gt('2.9.0-beta') && emberVersion.lt('2.9.0')) && !emberVersion.gt('2.10.0-beta')) { | ||
trees.push(this.treeGenerator(path.resolve(this.root, 'app-lt-2-10'))); | ||
} | ||
|
||
var tree = mergeTrees(trees, { overwrite: true }); | ||
|
||
return filterInitializers(tree); | ||
return mergeTrees(trees, { overwrite: true }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PR exposes a process environment
process.env.FASTBOOT_NEW_BUILD
andaddToFastBootTree
for these cases. Instead of merging here you can just do this:Let me know if this doesn't work or you feel this may not be needed but I exposed those hooks in my PR to have this in mind. More than happy to drop code 😄
When FastBoot 1.0 is released, we can remove
treeForApp
.