Skip to content

Commit

Permalink
[BUGFIX] Blueprint.prototype.insertIntoFile is async (#984)
Browse files Browse the repository at this point in the history
* [BUGFIX] Blueprint.prototype.insertIntoFile is async

This prevents the termination of the process and updating these files from racing.

* update travis

* drop node
* cache npm + bower caches (not high level folders)

* use new npm

* update default ember versions
  • Loading branch information
stefanpenner authored and samselikoff committed Jan 16, 2017
1 parent 1e4a5ef commit acd3377
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
@@ -1,13 +1,16 @@
---
language: node_js
node_js:
- "0.12"
- "4"
- "6"
- "7"

sudo: false

cache:
directories:
- node_modules
- $HOME/.npm
- $HOME/.cache # includes bower's cache

env:
- EMBER_TRY_SCENARIO=default
Expand All @@ -23,7 +26,7 @@ matrix:
before_install:
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- "npm config set spin false"
- "npm install -g npm@^2"
- "npm install -g npm@^4"

install:
- npm install -g bower
Expand Down
44 changes: 22 additions & 22 deletions blueprints/ember-cli-mirage/index.js
Expand Up @@ -30,29 +30,29 @@ module.exports = {
},

afterInstall: function() {
this.insertIntoFile('.jshintrc', ' "server",', {
return this.insertIntoFile('.jshintrc', ' "server",', {
after: '"predef": [\n'
});

this.insertIntoFile('tests/.jshintrc', ' "server",', {
after: '"predef": [\n'
});

if (existsSync('tests/helpers/destroy-app.js')) {
this.insertIntoFile('tests/helpers/destroy-app.js', ' server.shutdown();', {
after: "Ember.run(application, 'destroy');\n"
}).then(() => {
return this.insertIntoFile('tests/.jshintrc', ' "server",', {
after: '"predef": [\n'
}).then(() =>{
if (existsSync('tests/helpers/destroy-app.js')) {
return this.insertIntoFile('tests/helpers/destroy-app.js', ' server.shutdown();', {
after: "Ember.run(application, 'destroy');\n"
});
} else {
this.ui.writeLine(
EOL +
chalk.yellow(
'******************************************************' + EOL +
'destroy-app.js helper is not present. Please read this' + EOL +
'https://gist.github.com/blimmer/35d3efbb64563029505a' + EOL +
'to see how to fix the problem.' + EOL +
'******************************************************' + EOL
)
);
}
});
} else {
this.ui.writeLine(
EOL +
chalk.yellow(
'******************************************************' + EOL +
'destroy-app.js helper is not present. Please read this' + EOL +
'https://gist.github.com/blimmer/35d3efbb64563029505a' + EOL +
'to see how to fix the problem.' + EOL +
'******************************************************' + EOL
)
);
}
});
}
};
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -2,7 +2,7 @@
"name": "ember-cli-mirage",
"dependencies": {
"jquery": "2.1.4",
"ember": "2.3.0",
"ember": "2.10.0",
"ember-cli-shims": "0.1.0",
"ember-cli-test-loader": "0.2.2",
"ember-qunit-notifications": "0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -40,7 +40,7 @@
"ember-cli-release": "0.2.8",
"ember-cli-sri": "^2.0.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.3.0",
"ember-data": "^2.10.0",
"ember-disable-prototype-extensions": "^1.0.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
Expand Down

0 comments on commit acd3377

Please sign in to comment.