From 21aaf6a74bf144ead5f4403dff3463c078929c72 Mon Sep 17 00:00:00 2001 From: Hector Leon Zarco Garcia Date: Tue, 17 Nov 2015 21:04:54 +0100 Subject: [PATCH] Upgrade Ember defaults --- .editorconfig | 3 +- .npmignore | 14 +++++++++ .travis.yml | 16 +++++++++- .watchmanconfig | 3 ++ config/ember-try.js | 36 +++++++++++++++++++++++ config/environment.js | 1 + ember-cli-build.js | 18 ++++++++++++ testem.json | 3 +- tests/dummy/app/router.js | 2 +- tests/dummy/app/templates/application.hbs | 2 +- tests/dummy/public/robots.txt | 1 + tests/helpers/destroy-app.js | 5 ++++ tests/helpers/module-for-acceptance.js | 23 +++++++++++++++ tests/helpers/resolver.js | 2 +- tests/helpers/start-app.js | 15 +++++----- 15 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 .npmignore create mode 100644 .watchmanconfig create mode 100644 config/ember-try.js create mode 100644 ember-cli-build.js create mode 100644 tests/helpers/destroy-app.js create mode 100644 tests/helpers/module-for-acceptance.js diff --git a/.editorconfig b/.editorconfig index 5d5dea4..47c5438 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,6 +18,7 @@ indent_style = space indent_size = 2 [*.hbs] +insert_final_newline = false indent_style = space indent_size = 2 @@ -29,5 +30,5 @@ indent_size = 2 indent_style = space indent_size = 2 -[*.md] +[*.{diff,md}] trim_trailing_whitespace = false diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..49996f5 --- /dev/null +++ b/.npmignore @@ -0,0 +1,14 @@ +bower_components/ +tests/ +tmp/ +dist/ + +.bowerrc +.editorconfig +.ember-cli +.travis.yml +.npmignore +**/.gitkeep +bower.json +Brocfile.js +testem.json diff --git a/.travis.yml b/.travis.yml index cf23938..8197d31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ --- language: node_js +node_js: + - "0.12" sudo: false @@ -7,7 +9,19 @@ cache: directories: - node_modules +env: + - EMBER_TRY_SCENARIO=default + - EMBER_TRY_SCENARIO=ember-release + - EMBER_TRY_SCENARIO=ember-beta + - EMBER_TRY_SCENARIO=ember-canary + +matrix: + fast_finish: true + allow_failures: + - env: EMBER_TRY_SCENARIO=ember-canary + before_install: + - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH - "npm config set spin false" - "npm install -g npm@^2" @@ -17,4 +31,4 @@ install: - bower install script: - - npm test + - ember try $EMBER_TRY_SCENARIO test diff --git a/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000..e7834e3 --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1,3 @@ +{ + "ignore_dirs": ["tmp", "dist"] +} diff --git a/config/ember-try.js b/config/ember-try.js new file mode 100644 index 0000000..3e88bc6 --- /dev/null +++ b/config/ember-try.js @@ -0,0 +1,36 @@ +/*jshint node:true*/ +module.exports = { + scenarios: [ + { + name: 'default', + dependencies: { } + }, + { + name: 'ember-release', + dependencies: { + 'ember': 'components/ember#release' + }, + resolutions: { + 'ember': 'release' + } + }, + { + name: 'ember-beta', + dependencies: { + 'ember': 'components/ember#beta' + }, + resolutions: { + 'ember': 'beta' + } + }, + { + name: 'ember-canary', + dependencies: { + 'ember': 'components/ember#canary' + }, + resolutions: { + 'ember': 'canary' + } + } + ] +}; diff --git a/config/environment.js b/config/environment.js index 0dfaed4..28a787b 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,3 +1,4 @@ +/*jshint node:true*/ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js new file mode 100644 index 0000000..c8c48f8 --- /dev/null +++ b/ember-cli-build.js @@ -0,0 +1,18 @@ +/*jshint node:true*/ +/* global require, module */ +var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); + +module.exports = function(defaults) { + var app = new EmberAddon(defaults, { + // Add options here + }); + + /* + This build file specifes the options for the dummy test app of this + addon, located in `/tests/dummy` + This build file does *not* influence how the addon or the app using it + behave. You most likely want to be modifying `./index.js` or app's build file + */ + + return app.toTree(); +}; diff --git a/testem.json b/testem.json index eff93f9..0f35392 100644 --- a/testem.json +++ b/testem.json @@ -1,6 +1,7 @@ { "framework": "qunit", - "test_page": "tests/index.html", + "test_page": "tests/index.html?hidepassed", + "disable_watching": true, "launch_in_ci": [ "PhantomJS" ], diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index cef554b..3bba78e 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,7 +1,7 @@ import Ember from 'ember'; import config from './config/environment'; -var Router = Ember.Router.extend({ +const Router = Ember.Router.extend({ location: config.locationType }); diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index d08c11f..f8bc38e 100644 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -1,3 +1,3 @@ -

Welcome to Ember.js

+

Welcome to Ember

{{outlet}} diff --git a/tests/dummy/public/robots.txt b/tests/dummy/public/robots.txt index 5debfa4..f591645 100644 --- a/tests/dummy/public/robots.txt +++ b/tests/dummy/public/robots.txt @@ -1,2 +1,3 @@ # http://www.robotstxt.org User-agent: * +Disallow: diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js new file mode 100644 index 0000000..c3d4d1a --- /dev/null +++ b/tests/helpers/destroy-app.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default function destroyApp(application) { + Ember.run(application, 'destroy'); +} diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js new file mode 100644 index 0000000..ed23003 --- /dev/null +++ b/tests/helpers/module-for-acceptance.js @@ -0,0 +1,23 @@ +import { module } from 'qunit'; +import startApp from '../helpers/start-app'; +import destroyApp from '../helpers/destroy-app'; + +export default function(name, options = {}) { + module(name, { + beforeEach() { + this.application = startApp(); + + if (options.beforeEach) { + options.beforeEach.apply(this, arguments); + } + }, + + afterEach() { + destroyApp(this.application); + + if (options.afterEach) { + options.afterEach.apply(this, arguments); + } + } + }); +} diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js index 28f4ece..ebfb4e4 100644 --- a/tests/helpers/resolver.js +++ b/tests/helpers/resolver.js @@ -1,7 +1,7 @@ import Resolver from 'ember/resolver'; import config from '../../config/environment'; -var resolver = Resolver.create(); +const resolver = Resolver.create(); resolver.namespace = { modulePrefix: config.modulePrefix, diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index e087e48..e098f1d 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -1,19 +1,18 @@ import Ember from 'ember'; import Application from '../../app'; -import Router from '../../router'; import config from '../../config/environment'; export default function startApp(attrs) { - var App; + let application; - var attributes = Ember.merge({}, config.APP); + let attributes = Ember.merge({}, config.APP); attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; - Ember.run(function() { - App = Application.create(attributes); - App.setupForTesting(); - App.injectTestHelpers(); + Ember.run(() => { + application = Application.create(attributes); + application.setupForTesting(); + application.injectTestHelpers(); }); - return App; + return application; }