Skip to content

Commit

Permalink
Merge pull request #45 from kategengler/npm-support
Browse files Browse the repository at this point in the history
Support for npm dependencies + improved output
  • Loading branch information
kategengler committed Jan 29, 2016
2 parents 59fb10b + d38f22c commit 987173f
Show file tree
Hide file tree
Showing 45 changed files with 1,523 additions and 544 deletions.
2 changes: 0 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ dist/
.npmignore
**/.gitkeep
bower.json
ember-cli-build.js
Brocfile.js
testem.json
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
language: node_js

sudo: false

node_js:
- "0.10"
- "0.12"
- "iojs"
- "4.2"
- "5"

sudo: false

cache:
directories:
Expand All @@ -17,18 +17,17 @@ env:
- NPM_SCRIPT=client-test

matrix:
fast_finish: true
allow_failures:
- node_js: "0.10"
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- mkdir travis-phantomjs
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
- export PATH=$PWD/travis-phantomjs:$PATH
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- "npm config set spin false"
- "npm install -g npm@^2"

install:
- node --version
- npm install -g bower
- npm install
- bower install
Expand Down
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp"]
"ignore_dirs": ["tmp", "dist"]
}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015
Copyright (c) 2016

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
85 changes: 52 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ember-try [![Build Status](https://travis-ci.org/kategengler/ember-try.svg?branch=master)](https://travis-ci.org/kategengler/ember-try)

An ember-cli addon to test against multiple bower dependencies, such as `ember` and `ember-data`.
An ember-cli addon to test against multiple bower and npm dependencies, such as `ember` and `ember-data`.

### Installation

Expand Down Expand Up @@ -57,37 +57,53 @@ module.exports = {
scenarios: [
{
name: 'Ember 1.10 with ember-data',
dependencies: {
'ember': '1.10.0',
'ember-data': '1.0.0-beta.15'
bower: {
dependencies: {
'ember': '1.10.0',
'ember-data': '1.0.0-beta.15'
}
}
},
{
name: 'Ember 1.11.0-beta.5',
dependencies: {
'ember': '1.11.0-beta.5'
bower: {
dependencies: {
'ember': '1.11.0-beta.5'
}
}
},
{
name: 'Ember canary',
dependencies: {
'ember': 'canary'
name: 'Ember canary with Ember-Data 2.3.0',
npm: {
devDependencies: {
'ember-data': '2.3.0'
}
},
bower: {
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
}
}
},
{
name: 'Ember beta',
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: { // Resolutions are only necessary when they do not match the version specified in `dependencies`
'ember': 'canary'
bower: {
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: { // Resolutions are only necessary when they do not match the version specified in `dependencies`
'ember': 'beta'
}
}
}
]
};
```

Scenarios are sets of dependencies (`bower` only). They can be specified exactly as in the `bower.json`
Scenarios are sets of dependencies (`bower` and `npm` only). They can be specified exactly as in the `bower.json` or `package.json`
The `name` can be used to try just one scenario using the `ember try` command.

If no `config/ember-try.js` file is present, the default config will be used. This is the current default config:
Expand All @@ -96,27 +112,35 @@ If no `config/ember-try.js` file is present, the default config will be used. Th
{
scenarios: [
{
name: "default",
dependencies: { } // no dependencies needed as the
// default is already specified in
// the consuming app's bower.json
name: 'default',
bower: {
dependencies: { } /* No dependencies needed as the
default is already specified in
the consuming app's bower.json */
}
},
{
name: "ember-release",
dependencies: {
"ember": "release"
name: 'ember-release',
bower: {
dependencies: {
ember: 'release'
}
}
},
{
name: "ember-beta",
dependencies: {
"ember": "beta"
name: 'ember-beta',
bower: {
dependencies: {
ember: 'beta'
}
}
},
{
name: "ember-canary",
dependencies: {
"ember": "canary"
name: 'ember-canary',
bower: {
dependencies: {
ember: 'canary'
}
}
}
]
Expand All @@ -128,8 +152,3 @@ See an example of using `ember-try` for CI [here](https://github.com/kategengler
### Special Thanks

- Much credit is due to [Edward Faulkner](https://github.com/ef4) The scripts in [liquid-fire](https://github.com/ef4/liquid-fire) that test against multiple ember versions were the inspriation for this project.

### TODO
- [ ] Add tests
- [ ] Add a blueprint for the config
- [ ] Look into `SilentError` as seen on other `ember-cli` addons to see if its preferable to `throw new Error` for preconditions.
20 changes: 10 additions & 10 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "ember-try",
"dependencies": {
"ember": "1.13.7",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
"ember-qunit": "0.4.9",
"ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.18",
"jquery": "^1.11.3",
"loader.js": "ember-cli/loader.js#3.2.1",
"qunit": "~1.18.0"
"ember": "beta",
"ember-cli-shims": "0.1.0",
"ember-cli-test-loader": "0.2.2",
"ember-load-initializers": "0.1.7",
"ember-qunit-notifications": "0.1.0",
"jquery": "1.11.3",
"loader.js": "^3.5.0"
},
"resolutions": {
"ember": "beta"
}
}
1 change: 1 addition & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint node:true*/
'use strict';

module.exports = function(/* environment, appConfig */) {
Expand Down
7 changes: 4 additions & 3 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*jshint node:true*/
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-addon');
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
var app = new EmberApp(defaults, {
var app = new EmberAddon(defaults, {
// Add options here
});

/*
This build file specifes the options for the dummy test app of this
This build file specifies 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
Expand Down
4 changes: 3 additions & 1 deletion lib/commands/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ module.exports = {
works: 'insideProject',

run: function(commandOptions, rawArgs) {
var config = require('../utils/config')({ project: this.project });
var ResetTask = require('../tasks/reset');
var resetTask = new ResetTask({
ui: this.ui,
project: this.project
project: this.project,
config: config
});

return resetTask.run();
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/testall.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ module.exports = {

var config = require('../utils/config')({ project: this.project });

var TestallTask = require('../tasks/testall');
var TryEach = require('../tasks/try-each');

var testallTask = new TestallTask({
var tryEachTask = new TryEach({
ui: this.ui,
project: this.project,
config: config
});

return testallTask.run(commandOptions);
return tryEachTask.run(config.scenarios, commandOptions);
}
};
9 changes: 5 additions & 4 deletions lib/commands/try.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ module.exports = {
'specified in the ember-try.js config.');
}

var TryTask = require('../tasks/try');
var tryTask = new TryTask({
var TryEachTask = require('../tasks/try-each');
var tryEachTask = new TryEachTask({
ui: this.ui,
project: this.project,
config: config
config: config,
commandArgs: commandArgs
});

return tryTask.run(scenario, commandArgs, commandOptions);
return tryEachTask.run([scenario], commandOptions);
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/reset.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
var CoreObject = require('core-object');
var BowerHelpers = require('../utils/bower-helpers');
var ScenarioManager = require('../utils/scenario-manager');

module.exports = CoreObject.extend({
run: function() {
return BowerHelpers.cleanup(this.project.root);
return new ScenarioManager({project: this.project, config: this.config}).cleanup();
}
});
78 changes: 0 additions & 78 deletions lib/tasks/testall.js

This file was deleted.

Loading

0 comments on commit 987173f

Please sign in to comment.