From 78e67921f643a5208d4042bdf8f419ae036a4648 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 4 Sep 2014 23:22:04 -0400 Subject: [PATCH 1/2] Refactor to use project's bower for deps. * Updates structure and export POJO from addon. * Remove bower.json. * Add `ember-cli-qunit` blueprint (that installs the bower packages). --- README.md | 9 ++- blueprints/ember-cli-qunit/index.js | 22 ++++++ bower.json | 9 --- index.js | 109 ++++++++++++---------------- package.json | 13 +--- 5 files changed, 81 insertions(+), 81 deletions(-) create mode 100644 blueprints/ember-cli-qunit/index.js delete mode 100644 bower.json diff --git a/README.md b/README.md index 308ae08c..31212adc 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,17 @@ This addon that adds `QUnit` to the generated Ember CLI test output (in `test-ve ### Installation / Usage -From within your Ember CLI application (must be > 0.0.39), run the following: +From within your Ember CLI application (must be > 0.0.42), run the following: ```bash npm install --save-dev ember-cli-qunit +ember generate ember-cli-qunit +``` + +### Upgrading + +```bash +ember generate ember-cli-qunit ``` ### References diff --git a/blueprints/ember-cli-qunit/index.js b/blueprints/ember-cli-qunit/index.js new file mode 100644 index 00000000..7a97608b --- /dev/null +++ b/blueprints/ember-cli-qunit/index.js @@ -0,0 +1,22 @@ +module.exports = { + normalizeEntityName: function() { + // this prevents an error when the entityName is + // not specified (since that doesn't actually matter + // to us + }, + + afterInstall: function() { + var addonContext = this; + + return this.addBowerPackageToProject('qunit', '~1.15.0') + .then(function() { + return addonContext.addBowerPackageToProject('stefanpenner/ember-cli-shims', '0.0.3'); + }) + .then(function() { + return addonContext.addBowerPackageToProject('ember-qunit-notifications', '0.0.4'); + }) + .then(function() { + return addonContext.addBowerPackageToProject('ember-qunit', '0.1.8'); + }); + } +}; diff --git a/bower.json b/bower.json deleted file mode 100644 index 1171f730..00000000 --- a/bower.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "ember-cli-qunit", - "dependencies": { - "qunit": "~1.15.0", - "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3", - "ember-qunit-notifications": "~0.0.4", - "ember-qunit": "~0.1.8" - } -} diff --git a/index.js b/index.js index 7dce6369..bf9d7f1d 100644 --- a/index.js +++ b/index.js @@ -1,77 +1,62 @@ 'use strict'; -var path = require('path'); -var fs = require('fs'); +var path = require('path'); -function EmberCLIQUnit(project) { - this.project = project; - this.name = 'Ember CLI QUnit'; -} +module.exports = { + name: 'Ember CLI QUnit', -function unwatchedTree(dir) { - return { - read: function() { return dir; }, - cleanup: function() { } - }; -} + blueprintsPath: function() { + return path.join(__dirname, 'blueprints'); + }, -EmberCLIQUnit.prototype.treeFor = function treeFor(name) { - if(name !== 'vendor') { return; } + included: function included(app) { + this._super.included(app); - var treePath = path.join(__dirname, 'vendor'); + if (app.tests) { + var fileAssets = [ + 'bower_components/qunit/qunit/qunit.js', + 'bower_components/qunit/qunit/qunit.css', + 'bower_components/qunit-notifications/index.js', + ]; - if (fs.existsSync(treePath)) { - return unwatchedTree(treePath); - } -}; - -EmberCLIQUnit.prototype.included = function included(app) { - if (app.tests) { - var fileAssets = [ - 'vendor/qunit/qunit/qunit.js', - 'vendor/qunit/qunit/qunit.css', - 'vendor/qunit-notifications/index.js', - ]; + var imgAssets = [ + 'bower_components/ember-qunit-notifications/passed.png', + 'bower_components/ember-qunit-notifications/failed.png', + ]; - var imgAssets = [ - 'vendor/ember-qunit-notifications/passed.png', - 'vendor/ember-qunit-notifications/failed.png', - ]; - - app.import('vendor/ember-qunit/dist/named-amd/main.js', { - type: 'test', - exports: { - 'ember-qunit': [ - 'globalize', - 'moduleFor', - 'moduleForComponent', - 'moduleForModel', - 'test', - 'setResolver' - ] - } - }); + app.import('bower_components/ember-qunit/dist/named-amd/main.js', { + type: 'test', + exports: { + 'ember-qunit': [ + 'globalize', + 'moduleFor', + 'moduleForComponent', + 'moduleForModel', + 'test', + 'setResolver' + ] + } + }); - app.import('vendor/ember-cli-shims/test-shims.js', { - type: 'test', - exports: { - 'qunit': ['default'] - } - }); + app.import('bower_components/ember-cli-shims/test-shims.js', { + type: 'test', + exports: { + 'qunit': ['default'] + } + }); - fileAssets.forEach(function(file){ - app.import(file, { - type: 'test' + fileAssets.forEach(function(file){ + app.import(file, { + type: 'test' + }); }); - }); - imgAssets.forEach(function(img){ - app.import(img, { - type: 'test', - destDir: 'assets' + imgAssets.forEach(function(img){ + app.import(img, { + type: 'test', + destDir: 'assets' + }); }); - }); + } } }; - -module.exports = EmberCLIQUnit; diff --git a/package.json b/package.json index 3d07acdf..ac2db500 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,10 @@ "description": "QUnit testing package for ember-cli applications", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "postinstall": "bower install" + "test": "echo \"Error: no test specified\" && exit 1" }, "ember-addon": { - "main": "index" + "main": "index.js" }, "repository": { "type": "git", @@ -25,10 +24,6 @@ "url": "https://github.com/jakecraige/ember-cli-qunit/issues" }, "homepage": "https://github.com/jakecraige/ember-cli-qunit", - "dependencies": { - "bower": "^1.3.9" - }, - "bundledDependencies": [ - "bower" - ] + "dependencies": { }, + "bundledDependencies": [ ] } From 06c79c0d06bc38c8abbbbcac537198dd8902530c Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 4 Sep 2014 23:24:10 -0400 Subject: [PATCH 2/2] Bump version to indicate major change. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac2db500..15cb156b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-cli-qunit", - "version": "0.0.7", + "version": "0.1.0", "description": "QUnit testing package for ember-cli applications", "main": "index.js", "scripts": {