Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from rwjblue/refactor
Browse files Browse the repository at this point in the history
Refactor to use project's bower for deps.
  • Loading branch information
jakecraige committed Sep 5, 2014
2 parents 001c2b6 + 06c79c0 commit fb7b746
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 82 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions blueprints/ember-cli-qunit/index.js
Original file line number Diff line number Diff line change
@@ -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');
});
}
};
9 changes: 0 additions & 9 deletions bower.json

This file was deleted.

109 changes: 47 additions & 62 deletions index.js
Original file line number Diff line number Diff line change
@@ -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;
15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "ember-cli-qunit",
"version": "0.0.7",
"version": "0.1.0",
"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",
Expand All @@ -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": [ ]
}

0 comments on commit fb7b746

Please sign in to comment.