There are not enough days/weeks/months to write all the thoughts I have so I’ll do the best I can with my limited human abilities/faults.
#1
I think this is wrong because wouldn’t that just be testing the framework? This is tied to the next thought, see below.
#2
That’s the second time you’ve said that to me - and I’ve searched long and hard to find out what you mean. The best I can come up with is… a rather long explanation… but summed up in the phrase “coding with intent”. Let me explain what that means to me. When coding in Java and in a controller and I want to access some property/method on another class I simply write out that name of the method I want. If it won’t compile it shows intent that I want that other object to have that property or method. I then go create or modify a test to begin to realize that intent and finally add the method to the other object. Once my test is green I go back to working on the controller who will now compile.
Remember I said this is a long explanation, as I have been using CLI, I have encountered the feeling of Coding-With-Intent by using the generators. When you write “ember g route route-name” you’re declaring a really big intent of having a “route-name” page in your application.
@kylecoberly What else might I be missing the spirit of (as obvious by my (hopefully passing) clash of culture with Ember-CLI methodology my “missings” may be huge)?
#3
OK, I’m a little stuck. In my old Ember application I used the concept of a “Fixture” to load data from the local storage. My route did this:
App.CollectionRoute = Ember.Route.extend({
model: function() {
return loadCollectionData();
}
});
My fixture was:
// Fixtures
var collectionData = {collection: [], genes: []};
The method that loaded the fixture (and was called in the route) was:
function loadCollectionData() {
var StoredData = localStorage.getItem('Collection');
if (StoredData)
{
StoredData = JSON.parse(StoredData);
collectionData = {collection: [], genes: []};
var Collection = StoredData['collection'];
for (var Index in Collection)
{
// Ember bug protection
if (isNumber(Index))
{
var aSnake = App.Snake.create({name: Collection[Index]['name'], sex: Collection[Index]['sex'], yearAcquired:
Collection[Index]['yearAcquired'], yearBorn: Collection[Index]['yearBorn'], image: Collection[Index]['image']});
// genetics: [],
var Loci = Collection[Index]['genetics'];
Genes = Ember.A();
for (var Index in Loci)
{
// Ember bug protection
if (isNumber(Index))
{
Genes.pushObject(App.Locus.create({allele1: Loci[Index]['allele1'], allele2: Loci[Index]['allele2'],
type: Loci[Index]['type'], complex: Loci[Index]['complex']}));
}
}
aSnake.set('genetics', Genes);
collectionData['collection'].pushObject(aSnake);
}
}
}
return collectionData;
}
What is the CLI version of “Fixtures”?
Edit: #4
In my previous app I used a number of objects, where do I create those in CLI? Like:
App.Gene = Ember.Object.extend({
name: null,
type: null,
complex: null
});
App.Snake = Ember.Object.extend({
id: null,
name: null,
sex: null,
yearAcquired: null,
yearBorn: null,
genetics: [],
image: null,
morph: function() {
var Genes = this.get('genetics');
if (Genes.get('length') > 0)
{
var Result = "";
for (var Index in Genes)
{
if (isNumber(Index)) // Leaking properties bug
{
Result += Genes[Index].get('morph') + " ";
}
}
return Result;
}
else
{
return "Normal";
}
}.property('genetics.[]'),
age: function() {
if (this.get('yearBorn') == null)
{
return 0;
}
var aDate = new Date();
return aDate.getFullYear() - this.get('yearBorn');
}.property('yearBorn')
});
#5
I tried “ember g model model-name” and the model was created as an Ember-Data model. I’m not using Ember-Data, how do I fix that?