Refactor ModVersion into Mod and ModVersion

* Remove V1 of the mod version parser and shift V2 up to be V1
* Add a parser for mod.cg files, and refactor the the mod-version.cg
  files to push the appropriate content up to the mod.cg
* Remove the concept of "silent" from BaseModel along with logging
  each event as they are fired (which is what really prompted the
  need for it in the first place)
* Move use of the Storage class to be completely the province of the
  controllers most closely related to models affected
* Convert the ModVersionController to the ModController and have it
  take on responsibility for choosing the mod version
* Update BaseModel to support simple accessors for the current state
* Update CraftingPlan to be able to remove uncraftable items
* Implement the Mod model
This commit is contained in:
Andrew Miner
2015-01-18 10:48:12 -08:00
parent 76dc863372
commit d1621bb9f6
39 changed files with 922 additions and 1176 deletions
+4 -21
View File
@@ -16,20 +16,15 @@ modVersion = null
describe 'ModVersion', ->
beforeEach -> modVersion = new ModVersion name:'Test', version:'0.0'
beforeEach -> modVersion = new ModVersion modSlug:'test', version:'0.0'
describe 'constructor', ->
it 'requires a mod name', ->
expect(-> new ModVersion version:'0.0').to.throw Error, 'attributes.name is required'
it 'requires a mod slug', ->
expect(-> new ModVersion version:'0.0').to.throw Error, 'attributes.modSlug is required'
it 'requires a mod version', ->
expect(-> new ModVersion name:'Test').to.throw Error, 'attributes.version is required'
it 'supplies default values', ->
modVersion.description.should.equal ''
modVersion.enabled.should.be.true
modVersion.slug.should.equal 'test'
expect(-> new ModVersion modSlug:'test').to.throw Error, 'attributes.version is required'
describe 'addItem', ->
@@ -45,18 +40,6 @@ describe 'ModVersion', ->
modVersion.addItem new Item name:'Wool'
modVersion._items.wool.modVersion.should.equal modVersion
describe 'compareTo', ->
it 'lists required mods first', ->
minecraft = new ModVersion name:'Minecraft', version:'1.7.10'
modVersion.compareTo(minecraft).should.equal +1
minecraft.compareTo(modVersion).should.equal -1
it 'sorts by name second', ->
buildcraft = new ModVersion name:'Buildcraft', version:'3.0'
modVersion.compareTo(buildcraft).should.equal +1
buildcraft.compareTo(modVersion).should.equal -1
describe 'findItemByName', ->
it 'locates items by slugified name', ->