Skip to content

Commit

Permalink
Update to cli 2.3.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltan-nz committed Feb 7, 2016
1 parent ed2d194 commit 9c6f642
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
42 changes: 27 additions & 15 deletions app/controllers/admin/seeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ export default Ember.Controller.extend({
const counter = parseInt(this.get('librariesCounter'));

for (let i = 0; i < counter; i++) {
this.store.createRecord('library').randomize().save().then(() => {
if (i === counter-1) {
this.set('librariesCounter', 0);
this.set('libDone', true);
}
});
const isTheLast = i === counter-1;
this._saveRandomLibrary(isTheLast);
}
},

Expand All @@ -32,15 +28,8 @@ export default Ember.Controller.extend({
const counter = parseInt(this.get('authorCounter'));

for (let i = 0; i < counter; i++) {
let newAuthor = this.store.createRecord('author');
newAuthor.randomize()
.save().then(() => {
if (i === counter-1) {
this.set('authorCounter', 0);
this.set('authDone', true);
}
}
);
const isTheLast = i === counter-1;
const newAuthor = this._saveRandomAuthor(isTheLast);

this._generateSomeBooks(newAuthor);
}
Expand All @@ -56,6 +45,29 @@ export default Ember.Controller.extend({

// Private methods

_saveRandomLibrary(isLast) {
const randomLibrary = this.store.createRecord('library').randomize();

randomLibrary.save().then(() => {
if (isLast) {
this.set('librariesCounter', 0);
this.set('libDone', true);
}
});
},

_saveRandomAuthor(isLast) {
const newAuthor = this.store.createRecord('author').randomize();
newAuthor.save().then(() => {
if (isLast) {
this.set('authorCounter', 0);
this.set('authDone', true);
}
}
);
return newAuthor;
},

_generateSomeBooks(author) {
const bookCounter = Faker.random.number(10);

Expand Down
6 changes: 2 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"name": "library-app",
"dependencies": {
"ember": "^2.3.0",
"ember": "2.3.0",
"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",
"bootstrap-sass": "^3.3.6",
"firebase": "^2.1.0",
"Faker": "~3.0.1"
},
"resolutions": {
"ember": "2.2.0"
"ember": "2.3.0"
}
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"devDependencies": {
"broccoli-asset-rev": "^2.2.0",
"ember-ajax": "0.7.1",
"ember-cli": "2.3.0-beta.1",
"ember-cli": "2.3.0-beta.2",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.5",
"ember-cli-bootstrap-sassy": "0.5.0",
Expand All @@ -38,7 +38,9 @@
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-faker": "1.1.0",
"ember-load-initializers": "^0.5.0",
"ember-resolver": "^2.0.3",
"emberfire": "1.6.4"
"emberfire": "1.6.4",
"loader.js": "^4.0.0"
}
}

0 comments on commit 9c6f642

Please sign in to comment.