Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  add change log entry. Use populateLegacyFiles to populate test files
  use _processedVendorTree() instead of hardcoded 'vendor'
  remove deprecation warning
  move QUnit assets into test-vendor.js and test-vendor.css. Add type option to import to specify which that it's a test asset
  normalizeEntityName should be able to modify the entity name.
  Fix smoke test.
  Fix `app.import`'s behavior in addons.
  Coffee script support is provided by `ember-cli-coffeescript` addon.
  Update CHANGELOG.md
  Add UpdateTask test to check if package.json file gets updated with new version number
  [fixes ember-cli#1265] don’t diverge the promise chains (we must wait for the update to occur)
  fix public folder deleted breaking build
  fixing changelog link
  Always use forward slash for vendor warning.
  update outdated deps
  Update CHANGELOG.md
  Update README.md
  • Loading branch information
simonexmachina committed Jul 7, 2014
2 parents bfa8b7c + 4382775 commit 894ccc2
Show file tree
Hide file tree
Showing 21 changed files with 389 additions and 120 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ember-cli Changelog

* [BUGIFX] fix ember update (broken promises) [ #1265](https://github.com/stefanpenner/ember-cli/pull/1169)
* [BUGFIX] eagerly requireing inquirer was cost ~100ms -> 150ms on boot [https://github.com/stefanpenner/ember-cli/commit/0ae78df5b4772b126facfed1d3203e9c695e80a1)
* [BUGFIX] Fix issue with invalid warnings (regarding files in the root of `vendor/`) on Windows. [#1264](https://github.com/stefanpenner/ember-cli/issues/1264)
* [BUGFIX] Fix addons being unable to use `app.import` to pull in non-js/css assets from their own `vendor/` tree. [#1159](https://github.com/stefanpenner/ember-cli/pull/1159)
* [ENHANCEMENT] When using `app.import` to import non-js/css assets, you can now specify the destination of the asset. [#1159](https://github.com/stefanpenner/ember-cli/pull/1159)
* [BUGFIX] Fix issue with `ember build` failing if the public/ folder was deleted. [#1270](https://github.com/stefanpenner/ember-cli/issues/1270)
* [BREAKING ENHANCEMENT] CoffeeScript support is now brought in by `ember-cli-coffeescript`. To use CoffeeScript with future versions run `npm install --save-dev ember-cli-coffeescript` (and `broccoli-coffee` is no longer needed as a direct dependency). [#1289](https://github.com/stefanpenner/ember-cli/pull/1289)
* [BUGFIX] `Blueprint.prototype.normalizeEntityName`'s return value should update the entity name. [#1283](https://github.com/stefanpenner/ember-cli/issues/1283)
* [BREAKING ENHANCEMENT] Move test only js/css assets into test-vendor.js and test-vendor.css respectively. [#1288](https://github.com/stefanpenner/ember-cli/pull/1288)

### 0.0.39

* [BUGFIX] `ember build --watch` should run until SIGTERM. [#1197](https://github.com/stefanpenner/ember-cli/issues/1197)
Expand All @@ -23,7 +33,7 @@
* [ENHANCEMENT] Provide Ember CLI version to Project model. [#1239](https://github.com/stefanpenner/ember-cli/pull/1239)
* [BREAKING ENHANCEMENT] Split `app/templates` into its own tree to prevent preprocessing template files as if they were JavaScript. [#1238](https://github.com/stefanpenner/ember-cli/pull/1238)
* [ENHANCEMENT] Print a warning when using `app.import` for assets in the root of `vendor/` (this is a significant performance penalty).
* [ENHANCEMENT] Model generation no longer requires an attribute type. [#1252]
* [ENHANCEMENT] Model generation no longer requires an attribute type. [#1252](https://github.com/stefanpenner/ember-cli/pull/1252)
* [ENHANCEMENT] Allow vendor files to be configurable. [#1187](https://github.com/stefanpenner/ember-cli/pull/1187)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## ember-cli [![Build Status](https://travis-ci.org/stefanpenner/ember-cli.png?branch=master)](https://travis-ci.org/stefanpenner/ember-cli) [![Stories in Ready](https://badge.waffle.io/stefanpenner/ember-cli.png?label=ready&title=Ready)](https://waffle.io/stefanpenner/ember-cli)
## ember-cli [![Build Status](https://travis-ci.org/stefanpenner/ember-cli.png?branch=master)](https://travis-ci.org/stefanpenner/ember-cli) [![Dependency Status](https://david-dm.org/stefanpenner/ember-cli.svg)](https://david-dm.org/stefanpenner/ember-cli)

An ember command line utility.

Expand Down
5 changes: 2 additions & 3 deletions blueprints/app/files/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/<%= name %>.css">
<link rel="stylesheet" href="assets/qunit.css">
<link rel="stylesheet" href="assets/test-vendor.css">
<style>
#ember-testing-container {
position: absolute;
Expand All @@ -37,8 +37,7 @@
window.<%= namespace %>ENV = {{ENV}};
window.EmberENV = window.<%= namespace %>ENV.EmberENV;
</script>
<script src="assets/qunit.js"></script>
<script src="assets/qunit-notifications.js"></script>
<script src="assets/test-vendor.js"></script>
<script src="assets/vendor.js"></script>
<script src="assets/<%= name %>.js"></script>
<script src="testem.js"></script>
Expand Down
3 changes: 2 additions & 1 deletion blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var Blueprint = require('../../lib/models/blueprint');

module.exports = Blueprint.extend({
normalizeEntityName: function(entityName) {
Blueprint.prototype.normalizeEntityName.apply(this, arguments);
entityName = Blueprint.prototype.normalizeEntityName.apply(this, arguments);

if(! /\-/.test(entityName)) {
throw new Error('You specified "' + entityName + '", but in order to prevent ' +
Expand All @@ -16,5 +16,6 @@ module.exports = Blueprint.extend({
'allowed.\n');
}

return entityName;
}
});
123 changes: 72 additions & 51 deletions lib/broccoli/ember-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var compileES6 = require('broccoli-es6-concatenator');
var pickFiles = require('broccoli-static-compiler');
var jshintTrees = require('broccoli-jshint');
var concatFiles = require('broccoli-concat');
var moveFile = require('broccoli-file-mover');
var remove = require('broccoli-file-remover');

var upstreamMergeTrees = require('broccoli-merge-trees');
Expand Down Expand Up @@ -116,6 +115,21 @@ function EmberApp(options) {
'ember/load-initializers': ['default']
}
}
],
'qunit.js' : [
'vendor/qunit/qunit/qunit.js', {
type: 'test '
}
],
'qunit.css': [
'vendor/qunit/qunit/qunit.css', {
type: 'test'
}
],
'qunit-notifications.js': [
'vendor/qunit-notifications/index.js', {
type: 'test'
}
]
}, defaults);

Expand All @@ -131,11 +145,13 @@ function EmberApp(options) {
vendor: unwatchedTree('vendor')
}, defaults);

this.importWhitelist = {};
this.legacyFilesToAppend = [];
this.vendorStaticStyles = [];
this.otherAssetTrees = [];
this._importTrees = [];
this.importWhitelist = {};
this.legacyFilesToAppend = [];
this.vendorStaticStyles = [];
this.otherAssetPaths = [];
this._importTrees = [];
this.legacyTestFilesToAppend = [];
this.vendorTestStaticStyles = [];

this.trees = this.options.trees;

Expand Down Expand Up @@ -174,13 +190,12 @@ EmberApp.prototype.addonPostprocessTree = function(type, tree) {

EmberApp.prototype.populateLegacyFiles = function () {
var name;

for (name in this.vendorFiles) {
var args = this.vendorFiles[name];

if (args === null) { continue; }

this.import.apply(this, [].concat(this.vendorFiles[name]));
this.import.apply(this, [].concat(args));
}
};

Expand Down Expand Up @@ -420,27 +435,16 @@ EmberApp.prototype.styles = memoize(function() {
});

EmberApp.prototype.testFiles = memoize(function() {
var qunitFiles = pickFiles(this.trees.vendor, {
srcDir: '/qunit/qunit',
files: [
'qunit.css', 'qunit.js'
],
destDir: '/assets/'
});
var vendor = this._processedVendorTree();

var notificationsFile = moveFile(this.trees.vendor, {
srcFile: '/qunit-notifications/index.js',
destFile: '/assets/qunit-notifications.js',
duplicate: false,
description: 'moveFile - notificationsFile'
var testJs = concatFiles(vendor, {
inputFiles: this.legacyTestFilesToAppend,
outputFile: '/assets/test-vendor.js'
});

qunitFiles = mergeTrees([
qunitFiles,
notificationsFile
], {
overwrite: true,
description: 'TreeMerger (qunitFiles)'
var testCss = concatFiles(vendor, {
inputFiles: this.vendorTestStaticStyles,
outputFile: '/assets/test-vendor.css'
});

var testemPath = path.join(__dirname, 'testem');
Expand Down Expand Up @@ -471,7 +475,8 @@ EmberApp.prototype.testFiles = memoize(function() {
});

var sourceTrees = [
qunitFiles,
testJs,
testCss,
testemTree,
iconsTree,
testLoader
Expand All @@ -484,7 +489,15 @@ EmberApp.prototype.testFiles = memoize(function() {
});

EmberApp.prototype.otherAssets = memoize(function() {
return mergeTrees(this.otherAssetTrees, {
var vendor = this._processedVendorTree();
var otherAssetTrees = this.otherAssetPaths.map(function (path) {
return pickFiles(vendor, {
srcDir: path.src,
files: [path.file],
destDir: path.dest
});
});
return mergeTrees(otherAssetTrees, {
description: 'TreeMerger (otherAssetTrees)'
});
});
Expand All @@ -498,32 +511,26 @@ EmberApp.prototype.import = function(asset, options) {
assetPath = asset;
}

if (assetPath === null) {
if (!assetPath) {
return;
}

if (assetPath.split(path.sep).length < 2) {
if (assetPath.split('/').length < 2) {
console.log(chalk.red('Using `app.import` with a file in the root of `vendor/` causes a significant performance penalty. Please move `'+ assetPath + '` into a subdirectory.'));
}

if (typeof options === 'object' && typeof options.exports === 'undefined') {
console.log(chalk.red('app.import('+ assetPath +') - Passing modules object is deprecated. Please pass an option object with modules as export key (see http://git.io/H1GsPw for more info).'));

options = {
exports: options
};
}

options = options || {};
options = defaults(options || {}, {
type: 'vendor'
});

if (/[\*\,]/.test(assetPath)) {
throw new Error('You must pass a file path (without glob pattern) to `app.import`. path was: `' + assetPath + '`');
}

var directory = path.dirname(assetPath);
var directory = path.dirname(assetPath);
var subdirectory = directory.replace(/^vendor\//, '');
var extension = path.extname(assetPath);
var basename = path.basename(assetPath);
var extension = path.extname(assetPath);
var basename = path.basename(assetPath);

if (!extension) {
throw new Error('You must pass a file to `app.import`. For directories specify them to the constructor under the `trees` option.');
Expand All @@ -539,31 +546,45 @@ EmberApp.prototype.import = function(asset, options) {
}

if (isType(assetPath, 'js')) {
this.legacyFilesToAppend.push(assetPath);
if(options.type === 'vendor') {
this.legacyFilesToAppend.push(assetPath);
} else {
this.legacyTestFilesToAppend.push(assetPath);
}

this.importWhitelist = assign(this.importWhitelist, options.exports || {});
} else if (extension === '.css') {
this.vendorStaticStyles.push(assetPath);
if(options.type === 'vendor') {
this.vendorStaticStyles.push(assetPath);
} else {
this.vendorTestStaticStyles.push(assetPath);
}
} else {
var otherAssetTree = pickFiles(this.trees.vendor, {
srcDir: subdirectory,
files: [basename],
destDir: subdirectory
var destDir = options.destDir;
if (destDir === '') {
destDir = '/';
}
this.otherAssetPaths.push({
src: directory,
file: basename,
dest: destDir || subdirectory
});

this.otherAssetTrees.push(otherAssetTree);
}
};

EmberApp.prototype.toArray = function() {
var sourceTrees = [
this.index(),
this.javascript(),
this.publicFolder(),
this.styles(),
this.otherAssets()
];

var publicFolder = this.publicFolder();
if (fs.existsSync(publicFolder)) {
sourceTrees.push(publicFolder);
}

if (this.tests) {
sourceTrees = sourceTrees.concat(this.testIndex(), this.testFiles());
}
Expand Down
4 changes: 4 additions & 0 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ CLI.prototype.run = function(environment) {
var args = environment.cliArgs.slice();
var commandName = args.shift();
var commandArgs = args;

var CurrentCommand = lookupCommand(environment.commands, commandName, commandArgs, {
project: environment.project,
ui: this.ui
});

var command = new CurrentCommand({
ui: this.ui,
analytics: this.analytics,
Expand Down Expand Up @@ -53,6 +55,7 @@ CLI.prototype.logError = function(error) {
console.error(error.message);
console.error(error.stack);
}

if (error) {
if (error instanceof Error) {
this.ui.write(chalk.red(error.message));
Expand All @@ -61,5 +64,6 @@ CLI.prototype.logError = function(error) {
this.ui.write(chalk.red(error));
}
}

return 1;
};
3 changes: 2 additions & 1 deletion lib/cli/lookup-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ module.exports = function(commands, commandName, commandArgs, options) {
}

if (command && addonCommand) {
ui.write(chalk.cyan('warning: An ember-addon has attempted to override the core command "' + command.prototype.name + '". The core command will be used.\n'));
ui.write(chalk.cyan('warning: An ember-addon has attempted to override the core command "' +
command.prototype.name + '". The core command will be used.\n'));
return command;
}

Expand Down
10 changes: 8 additions & 2 deletions lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ module.exports = Command.extend({
analytics: this.analytics,
project: this.project
});

var npmInstall = new this.tasks.NpmInstall({
ui: this.ui,
analytics: this.analytics,
project: this.project
});

var bowerInstall = new this.tasks.BowerInstall({
ui: this.ui,
analytics: this.analytics,
Expand All @@ -62,12 +64,16 @@ module.exports = Command.extend({
return installBlueprint.run(blueprintOpts)
.then(function() {
if (!commandOptions.skipNpm) {
return npmInstall.run({ verbose: commandOptions.verbose });
return npmInstall.run({
verbose: commandOptions.verbose
});
}
})
.then(function() {
if (!commandOptions.skipBower) {
return bowerInstall.run({ verbose: commandOptions.verbose });
return bowerInstall.run({
verbose: commandOptions.verbose
});
}
});
}
Expand Down
6 changes: 5 additions & 1 deletion lib/models/blueprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ Blueprint.prototype.normalizeEntityName = function(entityName) {
'trailing slash as an entity name with generators. Please ' +
're-run the command with "' + entityName.replace(trailingSlash, '') + '".\n');
}

return entityName;
};

/*
Expand Down Expand Up @@ -254,7 +256,9 @@ Blueprint.prototype.install = function(options) {
ui.write(chalk.yellow('You specified the dry-run flag, so no changes will be written.\n'));
}

if(options.entity) { this.normalizeEntityName( options.entity.name); }
if(options.entity) {
options.entity.name = this.normalizeEntityName(options.entity.name);
}

return this.processFiles(intoDir, locals)
.map(commit)
Expand Down
1 change: 0 additions & 1 deletion lib/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module.exports.setupRegistry = function(app) {

registry.add('minify-css', 'broccoli-csso', null);

registry.add('js', 'broccoli-coffee', 'coffee');
registry.add('js', 'broccoli-ember-script', 'em');
registry.add('js', 'broccoli-sweetjs', 'js');

Expand Down
2 changes: 1 addition & 1 deletion lib/preprocessors/javascript-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ JavascriptPlugin.prototype.constructor = JavascriptPlugin;
JavascriptPlugin.prototype._superConstructor = Plugin;

JavascriptPlugin.prototype.toTree = function(tree, inputPath, outputPath, options) {
if (this.name.indexOf('coffee') !== -1 || this.name.indexOf('ember-script') !== -1) {
if (this.name.indexOf('ember-script') !== -1) {
options = options || {};
options.bare = true;
options.srcDir = inputPath;
Expand Down
Loading

0 comments on commit 894ccc2

Please sign in to comment.